

Reducing the number of garbage collector threads and increasing the size of the tenured generation will reduce this fragmentation effect. Each garbage collection thread involved in a minor collection reserves a part of the tenured generation for promotions and the division of the available space into these "promotion buffers" can cause a fragmentation effect. Because multiple garbage collector threads are participating in a minor collection, some fragmentation is possible due to promotions from the young generation to the tenured generation during the collection. However, enabling the parallel collector should make the collection pauses shorter.
#JAVA 16 GARBAGE COLLECTOR SERIAL#
If explicit tuning of the heap is being done with command-line options, then the size of the heap needed for good performance with the parallel collector is the same as needed with the serial collector. The number of garbage collector threads can be controlled with the command-line option -XX:ParallelGCThreads=. However, when running applications with medium-sized to large-sized heaps, it generally outperforms the serial collector by a modest amount on machines with two processors, and usually performs significantly better than the serial collector when more than two processors are available. On a host with one processor, the parallel collector will likely not perform as well as the serial collector because of the overhead required for parallel execution (for example, synchronization). The specific number of garbage collector threads can be adjusted with a command-line option (which is described later). On selected platforms, the fraction drops to 5/16. At values of N below 8, the number used is N. The fraction is approximately 5/8 for large values of N. On a machine with N hardware threads where N is greater than 8, the parallel collector uses a fixed fraction of N as the number of garbage collector threads. By default, with this option, both minor and major collections are executed in parallel to further reduce garbage collection overhead. The parallel collector is enabled with the command-line option -XX:+UseParallelGC. The parallel collector (also referred to here as the throughput collector) is a generational collector similar to the serial collector the primary difference is that multiple threads are used to speed up garbage collection.
