Serial collector: Single thread, "Stop the World", must stop all worker threads when doing garbage collection threads;
Parnew collector (Parallel parallel): Multi-threaded, garbage collection will also stop the worker thread;
Both can be used in conjunction with the CMS (concurrent Mark Sweep) collector, and all three are concerned with minimizing the downtime of the user thread when garbage collection is minimized.
Parallel (parallel): Refers to multiple garbage collection threads working in parallel, but at this point the user thread is still in the waiting state;
Concurrency (Concurrent): User threads are executed concurrently with the garbage collection thread (but not necessarily in parallel, may be alternately executed), the user program continues to run, and the garbage collector runs on the other CPU.
Parallel scavenge (Purge) collector: cannot be used with the CMS collector, the target reaches a controllable throughput (throughput). throughput = Run user code time/(run user code time + garbage collection time).
The shorter the pause time, the more suitable for the need to interact with the user program, good response time speed can improve the user experience, and high throughput can be efficient use of CPU time, as soon as possible to complete the operation of the program tasks, mainly for the background operation and do not need too many interactive tasks.
Control maximum garbage collection pause time:-xx:maxgcpausemillis, directly set throughput size parameter:-xx:gctimeratio (0-100).
-xx:+useadaptivesizeplicvy, switch parameters, when the parameters are opened, you do not need to manually specify the Cenozoic size-xmn, Eden and survivor area of the proportion-xx:surviviorratio, promotion to the old age object ages-xx: Pretenuresizethreshold and other details parameters, the virtual opportunity to collect performance monitoring information according to the current system operation, dynamically adjust these parameters to provide the appropriate pause time or maximum throughput, this regulation is called GC Adaptive Tuning Strategy (GC ergonomics).
The first three belong to the younger generation, using the copy algorithm, the next belongs to the old age, using the marker-collation algorithm.
Serial old collector: in the General client mode, if the server mode, with the parallel scavenge, or as a backup scheme of the CMS, in the concurrent collection occurs concurrent mode failure use;
Parallel old collector;
CMS collector (Mark Sweep: Tag-purge algorithm): A collector that targets the shortest recovery pause time. At present, a large part of the Java applications are concentrated in the Internet or B/s system service side.
Initial tag (CMS initial mark): Stop the world, just mark the object that GC roots can directly relate to, the user process pauses
Concurrency token (CMS concurrent mark): Process for GC Roots tracing (tracing) Concurrent user processes
Re-tagging (CMS remark): Stop the world, the user process pauses in order to fix the tag record of the part of the object that caused the tag to change while the user program continues to function during the concurrent tag
Concurrent Purge (CMS concurrent sweep) Concurrent User Processes
The advantages of concurrent collection and low pauses.
G1 Collector: Garbage collector for the service side
Features: Parallel and Concurrency: shortening stop time
Generational collection: Dealing with new objects in different ways and objects that survive for a period of time
Spatial integration: Unlike the CMS's tag---cleanup algorithm, the overall tag-based---Finishing algorithm, from the local (two region) based replication algorithm. Does not produce space debris.
Predictable pauses
Initial tag
Concurrency token
Final tag
Filter Collection