Summary of features of SERIAL,PARALLEL,CMS,G1 four GC collectors

Source: Internet
Author: User
Tags garbage collection

1.Serial Collector
A single-threaded collector that, during garbage collection, must suspend all other worker threads until it is collected.
Features: CPU utilization is highest, pause time is longer than user wait time.
Application Scenarios: Small applications
The serial garbage collector can be used with the JVM parameter-XX:+USESERIALGC.

2.Parallel Collector
use multiple threads to scan and compress the heap
Features: Short pause time, high recovery efficiency, high throughput requirements.
Application scenarios: Large-scale applications, scientific calculations, large-scale data collection, etc.
Open the Concurrency tag scan garbage collector with the JVM parameter XX:+USEPARNEWGC.

3.CMS Collector
using the "mark-and-sweep" algorithm, a multi-threaded algorithm is used to scan the heap to reclaim objects that are not used.
(1) Initial mark
(2) Concurrent tagging
(3) Concurrency preprocessing
(4) Re-tagging
(5) Concurrent cleanup
(6) Concurrent reset
Features: Response time priority, reduce garbage collection pause time
Adapt to the scene: servers, telecommunications and other fields.
Set by JVM parameter-XX:+USECONCMARKSWEEPGC

4.G1 Collector
in G1, the heap is divided into a number of contiguous regions (region). The G1 algorithm is used to recover and absorb the features of CMS collector.
Features: Large heap support, high throughput
--Support for multi-CPU and garbage collection threads
--using parallel collection in the case where the main thread is paused
--use concurrent collection in the case where the main thread is running
Real-time target: can be configured to consume up to m milliseconds for garbage collection in n milliseconds
Using the G1 garbage collector through the JVM parameter –XX:+USEG1GC

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.