-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Printer Status: Performance improvements #1124
Conversation
A lot of the slowdown with #1116 was due to printService.getName() which was reaching out to native and was called dozens of time for each status returned. I added a cached value that has a TTL of 10 seconds. I want to take a look at the various places getname is used to make sure this wont lead to any issues. |
Quick test on my system results in high CPU utilization for 4 seconds after 10 prints to a usb label printer. Prior it would take 1:30s with the same test. I think the actual print time improved too, though I don't have an easy way to measure that. |
Both In a stand alone test, I made 100 calls to each and recorded the execution time.
I cached the values for both and tested the cached version on arm Window, Mac and Linux and tested how fast Tray could match 10 arbitrary printer names. On Mac, both helped. On linux, only defaultPrintService caching helped, and on windows none of this seemed to matter.
|
FYI this last commit is 100% untested. I just needed to commit it. |
I really like the introduction of the cached object handling. I have a few cosmetic requests but I think this is ready for testing. |
I have been load testing this with a handful of virtual printer. Under high status traffic, sanitizePrinterName slows down on mac. I am investigating and will have a commit for it soon. |
After further examination I found the slowdown was occurring when we called In a stand-alone test, I was only able to recreate the issue after setting "sun.java2d.print.polling" to I dug into the JRE and found that internally, java is adding PrintServices to an arraylist and calling .indexOf on that list. This calls https://gist.github.com/Vzor-/0a4d5f2883dcfc4539426b6948c029ca |
A friendly reminder, this MUST be filed upstream (first with our JDK support provider, and then they'll report it to OpenJDK). In regards to the caching improvements, the benchmarks above are helpful, but hard to understand. I think they should be better quantified in terms of API calls. For example, |
This comment was marked as outdated.
This comment was marked as outdated.
The printer list is falling back on [lpstat, -l, -p] until |
Fix thread deadlock Related #1116, #1124 Co-authored-by: Tres Finocchiaro <[email protected]>
Caching for CUPS status performance --------- Co-authored-by: Vzor- <[email protected]>
This code should be good to be merged. Just some final testing. |
Tests:
Simple congestion test, lots of prints, lots of statuses
[*] Job statuses aren't working, but it seems to be an issue on master as well. We will consider this a pass and open a separate issue. |
Resolved |
FYI, if a job is sent to Linux after a printer has been removed, but before the cache has refreshed, this may throw the following error: (this is a bit misleading, but I consider it a rather graceful catch).
|
All of my tests passed. Looks ready to merge from my end. |
Introduce
PrintService
caching to workaround https://bugs.openjdk.org/browse/JDK-7001133Upstream:
JDK-7001133
BellSoft:
QZ-14
(private)Related: #1181
Closes #1116
Closes #1189