-
Hi all, I have a Java application with JFreeChart library reading a real-time data stream over network from a controller over UDP-protocol. The data stream feeds in up to 128 signals in parallel with fixed 10ms cycle-time. The data stream is streamed to a file and in parallel is fed into TimeSeries with function addOrUpdate(). For each signal one TimeSeries. Over buttons you can select/deselect each signal to be displayed on a common chart with XYplot. Each TimeSeries is limited to 60s/60.000 values/items. When signals are displayed the chart is updated 300ms cyclically. As long as I use the old library JFreeChart-1.0.7 everything works fine. No freeze but of course the app gets slowlier the more signals are displayed and the more items are in the time domain. When I use newer JFC library, e.g. 1.0.14 or 1.5.3, currently 1.5.3, the GUI freezes after 3.5minutes and the CPU-load rises from 5% to 15%. This happens when the data stream feeds in at least about 25 signals in parallel with function addOrUpdate() into the TimeSeries. It does not matter if these signals are displayed on the chart or not. The control buttons still work, but have a long response delay, about 20s. So if I stop calling addOrUpdate(), the GUI 'wakes up' again slowly and after some time it is fully responsive again. It feels like if there is a calculation queue somewhere inside which gets saturated. I use Windows 10 with openjdk-13.0.2. Does anyone have an idea, what the reason for the freeze is and how I can fix it? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
All supported host platform GUIs are single threaded, so saturation is inevitable. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your quick answer. But now I have found the root cause of the problem: This also explains why the GUI does not freeze with the old library JFC-1.0.7, because it does not have these MinY and MaxY variables and the update function updateMinMaxYByIteration(). I think about a more run-time efficient implementation of the updateMinMaxYByIteration(). But I have no good idea. An idea is to add a So far commenting out updateMinMaxYByIteration() works for me. Best regards Christian |
Beta Was this translation helpful? Give feedback.
-
Glad you found the bottleneck. I'm not sure how your application is synchronized, but both |
Beta Was this translation helpful? Give feedback.
-
I would urge you to consider migrating to |
Beta Was this translation helpful? Give feedback.
All supported host platform GUIs are single threaded, so saturation is inevitable.
SwingWorker
limits updates to 30Hz, while a JavaFXTask
can do 60Hz.