这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@chri50
Copy link

@chri50 chri50 commented Oct 7, 2025

Regarding: #940 (comment)
Topic: (n)k printer queues startup time

Similar to the needs described in Issue #940, I implemented a defensive caching framework that could dramatically improve the startup time of cupsd, especially if the majority of printing queues are based on the same PPD and MIME types

Core testing results:
Base: opencups 2.4.7 with cache framework applied , set up 6947 printing queues with four different PPD and 30 MIME types.
Core: +400 times improvment

Before: ~32 minutes
After:   ~5 seconds

@chri50
Copy link
Author

chri50 commented Oct 7, 2025

With CUPS_FORMATS_CACHE_OPT=1, an in-memory cache is enabled that stores the MIME type lists determined by mimeFilter() for each printer model (make_model); this allows subsequent queues with the same model to directly adopt the formats already found instead of performing the costly filter discovery again.
Optional add-on ENV:CUPS_CANONICAL_DEST

Please let me know, what you think about.
Thx.

@michaelrsweet michaelrsweet self-assigned this Oct 7, 2025
@michaelrsweet michaelrsweet added enhancement New feature or request investigating Investigating the issue labels Oct 7, 2025
@michaelrsweet michaelrsweet added this to the v2.5 milestone Oct 7, 2025
@michaelrsweet
Copy link
Member

I need to set aside some time to look at this, and I have my doubts that this duplicate PPD configuration is all that common.

That said, I'm thinking we could just cache based on the cupsFilter lines in each PPD file vs. hashing the PPD itself. That would offer the same benefits across all PPDs (regardless of whether they are the same) - all PS printers that handle "application/vnd.cups-postscript" will report the same supported document formats, for example. If a printer supports multiple media types (multiple cupsFilter lines) then we can either cache based on the set of supported media types (e.g. "image/urf+image/jpeg" for an AirPrint printer) or merge the cached lists of source types that can be filtered (that should be a little faster but I'm not sure whether the optimization would be worthwhile...)

@chri50
Copy link
Author

chri50 commented Oct 8, 2025

Thank you so much for sharing your thoughts. I just wanted to mention that I don't assume this PR will be accepted as is.
I totally agree with you that the root cause triggering this investigation is not very common, but it is for me at least!-)
I really appreciate your suggestion, and I'll try to address the cupsFilter instead of the entire PPD.

Thx.

@chri50 chri50 marked this pull request as draft October 17, 2025 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request investigating Investigating the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants