Reducing the impact of the GC
When Java was released in 1996, one of the big promises was the end of the dreadful segFault
error, so familiar to all C/C++ developers. Java decided to remove all the objects and pointer life cycle out of the hands of the developer and entrust the logic to the JVM. This gave birth to the GC.
There is not a single type of garbage collection. There have been multiple versions developed; all have different specifications to offer either low-latency pauses, predictability, or high throughput.
One of the biggest parts of tuning Java is to find the most appropriate GC for your application as well as the best parameters for it. The main GC algorithms are as follows:
- Serial GC: Recommended for the small dataset or single-threaded with no pause time requirements.
- Parallel/throughput collector: Recommended for peak performance and not pause time requirements.
- Concurrent Mark Sweep collector: Recommended for minimum GC pause time.
- G1 GC...