JDK Vergleich Java 8

Ticket:

Fehler beim Rendern des Makros 'jira': Der Jira-Server für dieses Makro konnte nicht gefunden werden. Das könnte an der Konfiguration des Anwendungslinks liegen.
 

Der Jira-Server für dieses Makro konnte nicht gefunden werden. Das könnte an der Konfiguration des Anwendungslinks liegen.

Überblick:

Stand am 11.03: JDK Vergleich_Java8.pptx

Testumgebung:

Windows 10 mit Java 8

JDK:

  1. Oracle JDK (jdk1.8.0_181)
  2. Red hat OpenJDK (1.8.0.242-3.b08)
  3. AdoptOpenJDK (jdk8u242-b08)
  4. 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)


oracleoracle Marlinadoptadopt Marlinredhatredhat Marlinzulu

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)


oracleoracle Marlinadoptadopt Marlinredhatredhat Marlinzulu

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 memoryUsed: 31MB, Allocated: 243MBUsed: 33MB, Allocated: 142MBUsed: 4.8MB, Allocated: 8.5MBUsed: 6.3MB, Allocated: 8.1MBUsed: 9.9MB, Allocated: 141MBUsed: 10MB, Allocated: 185MBUsed: 19MB, Allocated: 243MB
Non-heap memoryUsed: 13MB, Allocated: 14MBUsed: 30MB, Allocated: 31MBUsed: 55MB, Allocated: 877MBUsed: 65MB, Allocated: 881MBUsed: 27MB, Allocated: 28MBUsed: 28MB, Allocated: 29MBUsed: 11MB, Allocated: 12MB


testdoc_rendering_pixel.png (1 page)


oracleoracle Marlinadopt

adopt

Marlin

redhatredhat Marlinzulu

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 memoryUsed: 14MB, Allocated: 141MBUsed: 14MB, Allocated: 177MBUsed: 4.7MB, Allocated: 8.5MBUsed: 3.4MB, Allocated: 8.5MBUsed: 13MB, Allocated: 141MBUsed: 15MB, Allocated: 175MBUsed: 10MB, Allocated: 141MB
Non-heap memoryUsed: 28MB, Allocated: 29MBUsed: 28MB, Allocated: 29MBUsed: 55MB, Allocated: 876MBUsed: 60MB, Allocated: 861MBUsed: 28MB, Allocated: 29MBUsed: 28MB, Allocated: 29MBUsed: 27MB, Allocated: 28MB


stat1.afp(4 pages)


oracleoracle Marlinadoptadopt Marlinredhatredhat Marlinzulu

Throughput (ops/min)

103811082902185065901297
Average time (ms/op)66201911115
Sampling Time (ms/op)65201910145
Single Shot Time (min)1193429202517
Heap memoryUsed: 31MB, Allocated: 142MBUsed: 28MB, Allocated: 142MBUsed: 6.8MB, Allocated: 10MBUsed: 12MB, Allocated: 14MBUsed: 43MB, Allocated: 188MBUsed: 19MB, Allocated: 191MBUsed: 41MB, Allocated: 243MB
Non-heap memoryUsed: 34MB, Allocated: 35MBUsed: 34MB, Allocated: 36MBUsed: 57MB, Allocated: 877MBUsed: 62MB, Allocated: 879MBUsed: 33MB, Allocated: 34MBUsed: 30MB, Allocated: 30MBUsed: 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.

RedHatOpenJDKManchmal 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(Minus)(Plus)
Zulu JDK(Plus)Enterprise Version
Redhat JDK(Plus)(Plus)
AdoptJDK(Plus)(Minus)

Quelle: https://www.azul.com/products/zulu-enterprise/jdk-comparison-matrix/

Garbage Collector:

To display in a cmd: java -XX:+PrintCommandLineFlags -version
  1. Oracle JDK (jdk1.8.0_181) - ParallelGC
  2. Red hat OpenJDK (1.8.0.242-3.b08) - ParallelGC
  3. AdoptOpenJDK (jdk8u242-b08) - ParallelGC
  4. 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


OracleOracle MarlinRedhatRedhat MarlinZulu

ParallelGC default

SerialGCCMS GC

G1 GC

ParallelGC defaultSerialGCCMS GCG1 GC

ParallelGC default

SerialGCCMS GCG1 GCParallelGC defaultSerialGCCMS GCG1 GCParallelGC defaultSerialGCCMS GCG1 GC

Throughput (ops/min)

10,8

11,911,811,511,4511,411,511,4

10,8

12,212,211,312,712,412,312,2

10,8

12,212,112,3
Average time (ms/op)

514

499490512503497513512

507

498505511470477479474

552

496484485
Sampling Time (ms/op)

520

505486520510501496515

485

493577507467475473483

508

486485486
Single Shot Time (ms)

533

518511534521519540524

524

506597521490494491508

518

503502501
Heap memoryUsed: 14MB, Allocated: 141MBUsed: 14MB, Allocated: 177MBUsed: 23MB, Allocated: 245MBUsed: 3.4MB, Allocated: 8.5MBUsed: 14MB, Allocated: 177MBUsed: 14MB, Allocated: 175MBUsed: 24MB, Allocated: 245MBUsed: 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 memoryUsed: 28MB, Allocated: 29MBUsed: 28MB, Allocated: 29MBUsed: 28MB, Allocated: 29MBUsed: 60MB, Allocated: 861MBUsed: 28MB, Allocated: 29MBUsed: 28MB, Allocated: 29MBUsed: 28MB, Allocated: 29MBUsed: 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/