TL;DR
Types of Garbage Collectors in HotSpot:
- Serial
- Parallel
- Concurrent (CMS)
Young Generation Collectors:
- -XX:+UseSerialGC
- -XX:+UseParallelGC (Use parallel for Young, Serial for Old)
- -XX:+UseParNewGC
Old Generation Collectors:
- -XX:+UseParallelOldGC (Parallel Young and Old)
- -XX:+UseConcMarkSweepGC –XX:-UseParNewGC (Concurrent Mark Sweep with Serial Young)
- -XX:+UseConcMarkSweepGC –XX:+UseParNewG (Concurrent Mark Sweep + Parallel Young)
-XX:+DisableExplicitGC - prevent calls to System.gc()
Details:
Serial collector:
Serial Collector - runs in single thread. No communication overhead between the threads. Used for mini data sets (<100MB). This collector is quick but suited for single CPU machines.
Serial collector:
-XX:+UseSerialGC
Serial Collector - runs in single thread. No communication overhead between the threads. Used for mini data sets (<100MB). This collector is quick but suited for single CPU machines.
Parallel collector:
-XX:+UseParallelGCand (optionally) enable parallel compaction with
-XX:+UseParallelOldGC
-XX:+UseParNewGCThis type of collector is similar to the serial collector, but runs with multiple threads and does the minor collection in these threads. Be default:
N garbage collector threads = N CPUs on the host.
We can take the control over the number of threads by using the following option:
-XX:ParallelGCThreads=[number of threads]
-XX:+UseConcMarkSweepGC
One thread is used during initial mark and remark phase. For the concurrent marking and sweeping, CMS thread runs along the application threads. Used when the short pauses and response time are crucial.
In this collector parallel version of the young generation collector is used. For the Old/ Tenured generation, serial collector is used.
Concurrent low pause collector:
This collector is used to collect Old Generation and is done concurrently with the running application, however application is still paused for short amounts of time during the collection.. A parallel version of the young generation copying collector is used with the concurrent collector.
In this collector parallel version of the young generation collector is used. For the Old/ Tenured generation, serial collector is used.
Concurrent low pause collector:
-Xincgc ™ or -XX:+UseConcMarkSweepGC
This collector is used to collect Old Generation and is done concurrently with the running application, however application is still paused for short amounts of time during the collection.. A parallel version of the young generation copying collector is used with the concurrent collector.
Incremental low pause collector:
-XX:+UseTrainGC
This is currently not under the development, and has not changed since the J2SE Platform version 1.4.2
Note:
ParallelGC partially implies the -XX:+UseConcMarkSweepGC and should not (this doesn't mean you can't use it ;) ) be used in the same cmd line.
ParallelGC partially implies the -XX:+UseConcMarkSweepGC and should not (this doesn't mean you can't use it ;) ) be used in the same cmd line.
No comments:
Post a Comment