Updatethrottle singleton#3792
Conversation
so all updates across all windows come from a single thread
as we now only have a single UpdateThrottle and so do not need to name the instance based on how many there are.
georgweiss
left a comment
There was a problem hiding this comment.
@rjwills28 , this looks like a nice optimization.
Please check warnings issued by SonarCloud.
|
|
Thanks for taking a look @georgweiss . I will fix the SonarQube warning before this is ready. I came across an issue when testing which I have tried to fix but I could do with some input on the design pattern here. What I had missed was that there is a There are 2 ways of fixing this:
Any input would be much appreciated! |
|
I suggest you keep the reference count and at the same time keep the one |



A little while we were looking at the performance of Phoebus when there are multiple windows open (see issue #3169), specifically that CPU usage was very high with multiple windows with PVs updating at 10Hz.
After some further investigations, including testing a standalone JavaFX application, we found that a lot of the bad performance stems from JavaFX itself and the way it handles repainting multiple windows (as also suggested by Kay in the above issue).
However, we continued to look for any ways that we could improve performance on the Phoebus side, which we address in this PR. Currently Phoebus creates an
RepresentationUpdateThrottleinstance for each window. This class is in charge of collecting updates and running them on the UI thread. This means that in the case of 10 windows, there are 10RepresentationUpdateThrottleall scheduling jobs on the single UI thread.Instead we found that it was slightly more efficient to turn the
RepresentationUpdateThrottleclass into a singleton and only have this one thread to collect updates across all windows and hence there is only one thread trying to run jobs on the UI thread. In testing, with this change, we saw CPU usage drop by about 10%, e.g. from 165% to 155%.There is only one UI thread that can repaint the display and so I can't see any ill effects of only having one thread to collect updates and call this UI thread, but I would appreciate some further thoughts on this. Is there anything we haven't thought of that this might affect?
Checklist
Testing:
Documentation: