Jerry0022 / MixedFX

A library project to support JavaFX features and has a built in network capability
0 stars 0 forks source link

Performance issues #38

Open Jerry0022 opened 9 years ago

Jerry0022 commented 8 years ago

@spike-rabbit Thanks to yourkit I could precisely find the problem. There is no performance issue because of the code. Actually it does behave correctly. Since the monitoring interval is set to 1 second, there are often some objects created. But the garbage collector does only execute every minute, two minutes and even six minutes (once about 30MB are created for one type of monitoring callback, maximal there can be 3). It is configured by Java to garbage collect if it has to. unbenannt

Nevertheless there is a solution: -> After every monitoring full check the garbage collector is manually called (memory usage of monitoring low) -> Theorethical DISADVANTAGE: This usually slows the system every second down (in terms of cpu, not memory). I can't garbage collect only some objects - everything or nothing. There is a possibility to garbage collect after for example 5 cycles, but that is only heuristically. I've set it to collect after each cycle and calculate it into the the wait interval of the cycles. If we have a high cpu usage issue because of that we should increase the cycles to wait before garbage collecting. PLEASE KEEP THIS IN MIND! But currently Thread time goes from 250ms to 70ms so there is actually a performance improvement. So no need to adjust the logic above.

@spike-rabbit If seen, please close this issue.

Jerry0022 commented 8 years ago

Maybe Spring CDI helps?