JDK Vergleich Java 8
Ticket:
Überblick:
Stand am 11.03: JDK Vergleich_Java8.pptx
Testumgebung:
Windows 10 mit Java 8
JDK:
- Oracle JDK (jdk1.8.0_181)
- Red hat OpenJDK (1.8.0.242-3.b08)
- AdoptOpenJDK (jdk8u242-b08)
- Azul Zulu JDK (1.8.0_242)
JMH Benchmarks modes:
- Throughput: operations per unit of time [Runs by continuously calling Benchmark methods,
* counting the total throughput over all worker threads. This mode is time-based, and it will * run until the iteration time expires]
- AverageTime: average time per operation [Runs by continuously calling Benchmark methods,
* counting the average time to call over all worker threads. This is the inverse of Mode#Throughput, * but with different aggregation policy. This mode is time-based, and it will run until the iteration time * expires.]
- SampleTime: samples the time for each operation [Runs by continuously calling Benchmark methods,
* and randomly samples the time needed for the call. This mode automatically adjusts the sampling * frequency, but may omit some pauses which missed the sampling measurement. This mode is time-based, and it will * run until the iteration time expires.]
- SingleShotTime: measures the time for a single operation [Runs by calling Benchmark once and measuring its time.
* This mode is useful to estimate the "cold" performance when you don't want to hide the warmup invocations, or * if you want to see the progress from call to call, or you want to record every single sample. This mode is * work-based, and will run only for a single invocation of {@link Benchmark} * method.]
Memory:
- Heap memory: is the storage for Java objects.
- Non-heap memory: is used by Java to store loaded classes and other meta-data.
- The allocated memory is an overall amount of memory allocated by the JVM, while used memory is the amount of memory which is actually in use.
Ergebnisse:
– das beste Ergebnis | – das schlechteste Ergebnis | – das beste Ergebnis mit Marlin |
---|
05_square-annot-and-page-rotation.pdf (8 pages)
oracle | oracle Marlin | adopt | adopt Marlin | redhat | redhat Marlin | zulu | |
---|---|---|---|---|---|---|---|
Throughput (ops/min) | 1702 | 1697 | 960 | 960 | 1771 | 1961 | 4253 |
Average time (ms/op) | 3 | 3 | 6 | 6 | 3 | 3 | 1 |
Sampling Time (ms/op) | 3 | 3 | 6 | 6 | 3 | 3 | 1 |
Single Shot Time (ms) | 8 | 8 | 8 | 7 | 9 | 8 | 6 |
Heap memory | Used: 21MB Allocated: 170MB | Used: 15MB Allocated: 243MB | Used: 3.8MB Allocated: 8.2MB | Used: 4.8MB Allocated: 8.5MB | Used: 39MB Allocated: 243MB | Used: 17MB Allocated: 243MB | Used: 21MB Allocated: 243MB |
Non-heap memory | Used: 29MB, Allocated: 30MB | Used: 11MB Allocated: 12MB | Used: 48MB, Allocated: 870MB | Used: 54MB Allocated: 871MB | Used: 25MB, Allocated: 26MB | Used: 23MB Allocated: 24MB | Used: 11MB, Allocated: 12MB |
Musterantrag.pdf (6 pages)
oracle | oracle Marlin | adopt | adopt Marlin | redhat | redhat Marlin | zulu | |
---|---|---|---|---|---|---|---|
Throughput (ops/min) | 710 | 770 | 87 | 115 | 214 | 289 | 1044 |
Average time (ms/op) | 8 | 8 | 60 | 50 | 24 | 20 | 6 |
Sampling Time (ms/op) | 9 | 8 | 63 | 57 | 25 | 20 | 6 |
Single Shot Time (ms) | 20 | 11 | 113 | 72 | 53 | 33 | 18 |
Heap memory | Used: 31MB, Allocated: 243MB | Used: 33MB, Allocated: 142MB | Used: 4.8MB, Allocated: 8.5MB | Used: 6.3MB, Allocated: 8.1MB | Used: 9.9MB, Allocated: 141MB | Used: 10MB, Allocated: 185MB | Used: 19MB, Allocated: 243MB |
Non-heap memory | Used: 13MB, Allocated: 14MB | Used: 30MB, Allocated: 31MB | Used: 55MB, Allocated: 877MB | Used: 65MB, Allocated: 881MB | Used: 27MB, Allocated: 28MB | Used: 28MB, Allocated: 29MB | Used: 11MB, Allocated: 12MB |
testdoc_rendering_pixel.png (1 page)
oracle | oracle Marlin | adopt | adopt Marlin | redhat | redhat Marlin | zulu | |
---|---|---|---|---|---|---|---|
Throughput (ops/min) | 10,8 | 11,45 | 10,89 | 10,99 | 10,8 | 12,7 | 10,8 |
Average time (ms/op) | 514 | 503 | 546 | 540 | 507 | 470 | 552 |
Sampling Time (ms/op) | 520 | 510 | 540 | 530 | 485 | 467 | 508 |
Single Shot Time (ms) | 533 | 521 | 533 | 537 | 524 | 490 | 518 |
Heap memory | Used: 14MB, Allocated: 141MB | Used: 14MB, Allocated: 177MB | Used: 4.7MB, Allocated: 8.5MB | Used: 3.4MB, Allocated: 8.5MB | Used: 13MB, Allocated: 141MB | Used: 15MB, Allocated: 175MB | Used: 10MB, Allocated: 141MB |
Non-heap memory | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 55MB, Allocated: 876MB | Used: 60MB, Allocated: 861MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 27MB, Allocated: 28MB |
stat1.afp(4 pages)
oracle | oracle Marlin | adopt | adopt Marlin | redhat | redhat Marlin | zulu | |
---|---|---|---|---|---|---|---|
Throughput (ops/min) | 1038 | 1108 | 290 | 218 | 506 | 590 | 1297 |
Average time (ms/op) | 6 | 6 | 20 | 19 | 11 | 11 | 5 |
Sampling Time (ms/op) | 6 | 5 | 20 | 19 | 10 | 14 | 5 |
Single Shot Time (min) | 11 | 9 | 34 | 29 | 20 | 25 | 17 |
Heap memory | Used: 31MB, Allocated: 142MB | Used: 28MB, Allocated: 142MB | Used: 6.8MB, Allocated: 10MB | Used: 12MB, Allocated: 14MB | Used: 43MB, Allocated: 188MB | Used: 19MB, Allocated: 191MB | Used: 41MB, Allocated: 243MB |
Non-heap memory | Used: 34MB, Allocated: 35MB | Used: 34MB, Allocated: 36MB | Used: 57MB, Allocated: 877MB | Used: 62MB, Allocated: 879MB | Used: 33MB, Allocated: 34MB | Used: 30MB, Allocated: 30MB | Used: 15MB, Allocated: 16MB |
Ergebnisse ohne Marlin:
AdoptOpenJDK: Insgesamt am langsamsten. Das merkwürdige Memory Management: die JVM teilt sehr hocheffizient heap-memory und nicht rational non-heap memory zu, der nicht voll verwendet ist. Es könnte nützlich sein für eine hohe horizontale Skalierbarkeit aufgrund des geringen Heapspeichers.
Oracle JDK: Mittleres JDK mit Performance. Dies könnte jedoch aufgrund der Oracle Änderungen am Lizenzmodell zu Problemen bei der Lizenzierung für große Unternehmen führen.
RedHatOpenJDK: Manchmal am schnellsten, aber nicht konsequent. Keine Lizenzierung Probleme. Allerdings etwas hinter Zulu
Zulu OpenJDK: Hocheffiziente Speicherverwaltung. Insgesamt das ist die schnellste Option mit konsistenten Ergebnissen allgemein.
Gewinner: ZuluOpenJDK - Hocheffiziente Speicherverwaltung und der höchste Durchsatz (Throughput).
Ergebnisse mit Marlin:
Allgemein Marlin hat den Durchsatz (Throughput) erhöht und die Bearbeitungszeit verbessert. Das ZuluJDK hat Marlin als Rendering Engine by default.
Lizenzierung:
100% Open Source | Commercial Support | |
---|---|---|
Oracle JDK | ||
Zulu JDK | Enterprise Version | |
Redhat JDK | ||
AdoptJDK |
Quelle: https://www.azul.com/products/zulu-enterprise/jdk-comparison-matrix/
Garbage Collector:
To display in a cmd: java -XX:+PrintCommandLineFlags -version
- Oracle JDK (jdk1.8.0_181) - ParallelGC
- Red hat OpenJDK (1.8.0.242-3.b08) - ParallelGC
- AdoptOpenJDK (jdk8u242-b08) - ParallelGC
- Azul Zulu JDK (1.8.0_242) - ParallelGC
Die Beschreibung der verschiedenen Typen des GCs: https://javapapers.com/java/types-of-java-garbage-collectors/
Parallel GC - throughput GC. It works by freezing all the application threads while performing GC (multiple threads)
Serial GC - Good for the single-threaded environments. It works by freezing all the application threads while performing GC (Unlike Parallel GC, it uses a single thread)
CMS GC [Concurrent Mark Sweep] - uses multiple threads to scan the heap memory to mark instances for eviction and then sweep the marked instances. In comparison with parallel GC, CMS uses more CPU to ensure better application throughtput. If you can allocate more CPU for better performance then CMS garbage collector is the preferred choice over the parallel collector.
G1 GC - for large heap memory areas. It separates the heap memory into regions and does collection within them in parallel.
testdoc_rendering_pixel.png (1 page) - verschidene GC
Oracle | Oracle Marlin | Redhat | Redhat Marlin | Zulu | ||||||||||||||||
ParallelGC default | SerialGC | CMS GC | G1 GC | ParallelGC default | SerialGC | CMS GC | G1 GC | ParallelGC default | SerialGC | CMS GC | G1 GC | ParallelGC default | SerialGC | CMS GC | G1 GC | ParallelGC default | SerialGC | CMS GC | G1 GC | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Throughput (ops/min) | 10,8 | 11,9 | 11,8 | 11,5 | 11,45 | 11,4 | 11,5 | 11,4 | 10,8 | 12,2 | 12,2 | 11,3 | 12,7 | 12,4 | 12,3 | 12,2 | 10,8 | 12,2 | 12,1 | 12,3 |
Average time (ms/op) | 514 | 499 | 490 | 512 | 503 | 497 | 513 | 512 | 507 | 498 | 505 | 511 | 470 | 477 | 479 | 474 | 552 | 496 | 484 | 485 |
Sampling Time (ms/op) | 520 | 505 | 486 | 520 | 510 | 501 | 496 | 515 | 485 | 493 | 577 | 507 | 467 | 475 | 473 | 483 | 508 | 486 | 485 | 486 |
Single Shot Time (ms) | 533 | 518 | 511 | 534 | 521 | 519 | 540 | 524 | 524 | 506 | 597 | 521 | 490 | 494 | 491 | 508 | 518 | 503 | 502 | 501 |
Heap memory | Used: 14MB, Allocated: 141MB | Used: 14MB, Allocated: 177MB | Used: 23MB, Allocated: 245MB | Used: 3.4MB, Allocated: 8.5MB | Used: 14MB, Allocated: 177MB | Used: 14MB, Allocated: 175MB | Used: 24MB, Allocated: 245MB | Used: 16MB, Allocated: 254MB | Used: 15MB, Allocated: 175MB | Used: 15MB, Allocated: 245MB | Used: 20MB, Allocated: 245MB | Used: 14MB, Allocated: 254MB | Used: 15MB, Allocated: 175MB | Used: 14MB, Allocated: 245MB | Used: 20MB, Allocated: 245MB | Used: 15MB, Allocated: 254MB | Used: 10MB, Allocated: 141MB | Used: 8,1MB, Allocated: 245MB | Used: 22MB, Allocated: 245MB | Used: 10MB, Allocated: 254MB |
Non-heap memory | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 60MB, Allocated: 861MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 29MB | Used: 28MB, Allocated: 30MB | Used: 27MB, Allocated: 28MB | Used: 26MB, Allocated: 27MB | Used: 28MB, Allocated: 28MB | Used: 27MB, Allocated: 28MB |
Garbage Collections | Duration:~4s | Duration:~4s | Duration:~6s | Duration:~6s | Duration:~5s | Duration:~4s | Duration:~6s | Duration:~5s | Duration:~9s | Duration:~6s | Duration:~4s | Duration:~9s | Duration:~6s | Duration:~4s | Duration:~5s | Duration:~5s | Duration:~5s | Duration:~7s | Duration:~9s | Duration:~5s |
Ergebnisse über GCs:
Theorie: If you can allocate more CPU for better performance then CMS garbage collector is the preferred choice over the parallel collector.
Tools:
JMH Benchmarks (Java Microbenchmark Harness)
Yourkit
Visualisator JMH Benchmarks https://jmh.morethan.io/