Black LineLine indicates that two recyclers can be used together,The two can be used in the same region. G1 is commercially available in JDK and is rarely used in online environments. The following describes the other six types:
It can be seen from the name that it means serial. This recycler was first implemented. It is simple and efficient based on a single thread, however, garbage collection results in "Stop-the-World" (STW). When the memory to be recycled is large, the response time of the program becomes longer.
The full name is Parallel New Generation, that is, the garbage collection period of the New Generation in Parallel. This recycler is basically the same as Serial, but it only uses multiple threads for garbage collection.
Parallel cleanup, that is, the parallel garbage collector. The biggest difference between the recycler and ParNew is that ParNew is usually used with CMS, which generally focuses on reducing the pause time of garbage collection and improving the response speed.
CMS:Concurrent Mark Sweep is a Concurrent recycler designed to reduce the pause time for garbage collection. We can analyze the processing process:
There is nothing to say about Serial's old version.
Parallel Old:Parallel Scavenge's older version.
For applications running on the machine, Serial + Serial Old can be used; for applications with priority in response to web servers, such as Serial) + CMS; For background processing and scientific operations, it can be used to end now, sleep!