Performance Impact of Chunk Size

This section provides tests to find out performance impact of the chunk size (number of objects created and released in a single test run). The throughput performance seems to be not impacted by the chunk size, if some throughput jumps are ignored.

While running tests with GCPerformance.java, I also noticed an interesting behavior when using a lower test chunk size.

Test 1 - Running GCPerformance.java with chunk size of 16 objects. For some test junks, the throughput jumped from 4000 to 5333 objects:

herong> java -Xms1600m -Xmx1600m GCPerformance 1024 32 16 0 32

Parameters: Size=1024KB, Base=32, Chunk=16, Wait=0ms, Warmup=32
Real:Exec  Lat.     Throughput      Total:Free  Proc.
Time:Time  ms/o  Ave:Min:Max:Chunk   Mem.:Mem.   Obj.
4:4  250  4000:4000:4000:4000  1638400:1145616  16
24:24  1250  1333:800:4000:800  1638400:1111822  32
28:28  1250  1714:800:4000:4000  1638400:1079054  48
33:33  1250  1939:800:4000:3200  1638400:1046286  64
37:37  1250  2162:800:4000:4000  1638400:1013518  80
42:42  1250  2285:800:4000:3200  1638400:980750  96
46:46  1250  2434:800:4000:4000  1638400:947982  112
50:50  1250  2560:800:4000:4000  1638400:915214  128
59:59  1250  2440:800:4000:1777  1638400:1538717  144
64:64  1250  2500:800:4000:3200  1638400:1505949  160
69:69  1250  2550:800:4000:3200  1638400:1473181  176
73:73  1250  2630:800:4000:4000  1638400:1440413  192
76:76  1250  2736:800:5333:5333  1638400:1407645  208
79:79  1250  2835:800:5333:5333  1638400:1374877  224
...
127:127  1250  3275:800:5333:4000  1638400:981156  416
131:131  1250  3297:800:5333:4000  1638400:948388  432
134:134  1250  3343:800:5333:5333  1638400:915620  448
                             ----
       Throughput jumped here - |
...

Test 2 - Running GCPerformance.java with chunk size of 24 objects. For some test runs, the throughput jumped from 4000 to 4800 objects:

herong> java -Xms1600m -Xmx1600m GCPerformance 1024 32 24 0 32

Parameters: Size=1024KB, Base=32, Chunk=24, Wait=0ms, Warmup=32
Real:Exec  Lat.     Throughput      Total:Free  Proc.
Time:Time  ms/o  Ave:Min:Max:Chunk   Mem.:Mem.   Obj.
7:7  291  3428:3428:3428:3428  1638400:1227479  24
30:30  958  1600:1043:3428:1043  1638400:1177301  48
38:38  958  1894:1043:3428:3000  1638400:1128149  72
45:45  958  2133:1043:3428:3428  1638400:1078997  96
52:52  958  2307:1043:3428:3428  1638400:1029845  120
57:57  958  2526:1043:4800:4800  1638400:980693  144
63:63  958  2666:1043:4800:4000  1638400:931541  168
...
104:104  958  3000:1043:4800:4000  1638400:1276579  312
110:110  958  3054:1043:4800:4000  1638400:1227427  336
115:115  958  3130:1043:4800:4800  1638400:1178275  360
...
180:180  958  3333:1043:4800:4000  1638400:1325201  600
186:186  958  3354:1043:4800:4000  1638400:1276049  624
191:191  958  3392:1043:4800:4800  1638400:1226897  648
                             ----
       Throughput jumped here - |
...

Test 3 - Running GCPerformance.java with chunk size of 32 objects. For some test runs, the throughput jumped from 516 to 695 objects:

herong> java -Xms1600m -Xmx1600m GCPerformance 1024 32 32 0 32

Parameters: Size=1024KB, Base=32, Chunk=32, Wait=0ms, Warmup=32
Real:Exec  Lat.     Throughput      Total:Free  Proc.
Time:Time  ms/o  Ave:Min:Max:Chunk   Mem.:Mem.   Obj.
8:8  250  4000:4000:4000:4000  1638400:1374975  32
31:31  718  2064:1391:4000:1391  1638400:1308413  64
39:39  718  2461:1391:4000:4000  1638400:1242877  96
47:47  718  2723:1391:4000:4000  1638400:1177341  128
55:55  718  2909:1391:4000:4000  1638400:1111805  160
63:63  718  3047:1391:4000:4000  1638400:1046269  192
71:71  718  3154:1391:4000:4000  1638400:980733  224
79:79  718  3240:1391:4000:4000  1638400:915197  256
...
107:107  718  3289:1391:4571:4000  1638400:1374889  352
114:114  718  3368:1391:4571:4571  1638400:1309353  384
...
138:138  718  3478:1391:4571:4000  1638400:1112745  480
146:146  718  3506:1391:4571:4000  1638400:1047209  512
153:153  718  3555:1391:4571:4571  1638400:981673  544
                             ----
       Throughput jumped here - |
...

Test result summary

Chunk Size   Ave Throughput   Max Throughput
----------   --------------   --------------
    32 obj             3555             4571
    24 obj             3392             4800
    16 obj             3343             5333

If we ignore these jumps, the throughput performance seems to be not impacted much by the chunk size.

Table of Contents

 About This Book

 Heap Memory Area and Size Control

 JVM Garbage Collection Logging

 Introduction of Garbage Collectors

 Serial Collector - "+XX:+UseSerialGC"

 Parallel Collector - "+XX:+UseParallelGC"

 Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"

 Garbage First (G1) Collector - "+XX:+UseG1GC"

 The Z Garbage Collector (ZGC) - "+XX:+UseZGC"

 Object References and Garbage Collection

Garbage Collection Performance Test Program

 GCPerformance.java - GC Performance Test Program

 GCPerformance.java - Program Output

 Performance Impact of Wait Time

 Performance Impact of Object Size

Performance Impact of Chunk Size

 Performance Jumps Not Related to GC

 Performance Test and System Interruptions

 "START /REALTIME" - Run JVM with Highest Priority

 GCPerfP99.java - 99th Percentile Performance

 GCPerfP99.java - Output Verification

 GCPerfP99V2.java - Percentile Performance with Load

 GCPerfP99V2.java - Work Load Level

 GCPerfP99V2.java - Object Number and Size

 Performance Tests on Serial Collector

 Performance Tests on Parallel collector

 Performance Tests on Concurrent collector

 Performance Tests on G1 collector

 Garbage Collection Performance Test Summary

 References

 Full Version in PDF/EPUB