micro-manager / micro-manager

Microscope control and image acquisition integrated with ImageJ
https://micro-manager.org
254 stars 230 forks source link

Evaluate the garbage collector and change to a more optimal one #905

Open nicost opened 4 years ago

nicost commented 4 years ago

JDK8 on multiple CPU (multi-core) machines defaults to using the Throughput (parallel) GC. JDK11 uses the G1GC by default. Pavek Shah reports success operating two cameras at 200fps using the Concurrent Mark-Sweep (CMS) garbage collector. the throughput collector will block all running threads while doing its garbage collection, hence will lead to pile ups in the circular buffer, and increase the chances of overflow. Use of the CMS collector is discouraged, so it may be best to test the G1GC collector. This will need figuring out how to change the launcher code, and possibly testing which Java version is used to run MM.

marktsuchida commented 4 years ago

I very much agree with this. I experimented with this a little way back when, and optimizing the GC settings also improved GUI responsiveness during acquisition even at more moderate speeds (30-100 fps) with a single camera, IIRC.

In the current launchers we use, the ImageJ.cfg file (Windows) or Info.plist (macOS) can be used to set JVM arguments, though I don't remember off the top of my head how that interacts with rewrites by ImageJ (ImageJ.cfg) and code signing (Info.plist).

Also, G1 is the default GC in Java 9+ (for multicore).