jdk 8 lts to the latest performance and responsiveness … · 2020-03-17 · java team jdk 8 lts to...

42
Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance [email protected] @RajputAnilK Monica Beckwith JVM Performance java-performance@Microsoft @mon_beck * All trademarks are the property of their respective owners

Upload: others

Post on 25-Jun-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Java Team

JDK 8 LTS to the latestPerformance and Responsiveness Prospective

Anil Kumar

Datacenter Performance

[email protected]

@RajputAnilK

Monica Beckwith

JVM Performance

java-performance@Microsoft

@mon_beck

* All trademarks are the property of their respective owners

Page 2: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Pre-production deployment

0.00

0.50

1.00

1.50

2.00

Full capacity metric Operational range metric

Run to run variability (Normalized)

Worst run Best run

QCon SFO 2019

Page 3: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

What test is running?

Thousands of apps from

small data footprint (Heap 2GB)

to

very large data footprint (Heap 100GB)

Test: a representative benchmark !QCon SFO 2019

Page 4: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Deployment environment?

JVM

App

Hypervisor/

Guest OSContainer

OS1 2 3

QCon SFO 2019

Page 5: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Deployment environment?

QCon SFO 2019

JVM

App

Hypervisor/

Guest OSContainer

OS1 2 3

CPU threads?

Container,

Guest OS policies,

Pinning

Heap memory?

Guest OS policies,

Memory fragmentation,

Transparent large pages

Page 6: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Agenda

JDK 8 LTS to latest high level changes

Data using various benchmarks

Explanation for expected and/or strange behaviors

Summary

QCon SFO 2019

Page 7: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

JDK 8 LTS to the latest …

Monitoring, code readability and debugging

New usages

Containers FaaS (Function as a Service)

Microservices Polyglot programming

Performance

Concurrency → Fork/Join → Parallel Streams → Project Loom

Value Types

Networking: Java I/O → NIO → Netty

QCon SFO 2019

Page 8: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Java SE JDK 8 as base for normalization

Currently most use Java SE ?

QCon SFO 2019

Page 9: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Avoid workloads with high variability

Java* JMH* Benchmark

Configuration setting “-f 1 -wi 3 -w 5s -i 2 -r 15s -t 1”

QCon SFO 2019

org.openjdk.bench.java.util.stream.AllMatcher.seq_filter_findFirst 1.0x Run 1

org.openjdk.bench.java.util.stream.AllMatcher.seq_filter_findFirst 1.5x Run 2

org.openjdk.bench.vm.lambda.invoke.Function1.mref_bndLL_IL 1.0x Run 1

org.openjdk.bench.vm.lambda.invoke.Function1.mref_bndLL_IL 1.5x Run 2

* All trademarks are the property of their respective owners

Page 10: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Avoid heap allocation variability

Significant impact can result from variable heap allocation

For larger than 20GB heaps

System in use for long time

Transparent large pages in use

QCon SFO 2019

0.00

0.20

0.40

0.60

0.80

1.00

1.20

1.40

1.60SPECjvm2008 components (Heap size impact JDK 11) jdk11_20G jdk11_60G

* All trademarks are the property of their respective owners

Page 11: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Performance: Throughput

JDK 8 LTS vs. 11 LTS vs. 12 vs. 13 compare

Page 12: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

SPECjvm2008: compute + memory

JDK 11 LTS, 12 and 13 > JDK 8 LTS

6 minutes execution time for each worklet (sufficient optimization time)

QCon SFO 2019

0.00

0.20

0.40

0.60

0.80

1.00

1.20

1.40

1.60

1.80

SPECjvm2008 (Normalized to JDK 8) JDK 8 JDK 11 JDK 12 JDK 13

Page 13: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Command line option for SPECjvm2008

RUN_OPTS="-showversion"

${JAVA} ${RUN_OPTS} -jar SPECjvm2008.jar -ict -coe \

startup.helloworld startup.compress startup.crypto.aes startup.crypto.rsa startup.crypto.signverify \

startup.mpegaudio startup.scimark.fft startup.scimark.lu startup.scimark.monte_carlo startup.scimark.sor \

startup.scimark.sparse startup.serial startup.sunflow startup.xml.transform startup.xml.validation \

compress crypto.aes crypto.rsa crypto.signverify derby mpegaudio scimark.fft.large scimark.lu.large \

scimark.sor.large scimark.sparse.large scimark.fft.small scimark.lu.small scimark.sor.small \

scimark.sparse.small scimark.monte_carlo serial sunflow xml.transform xml.validation

Page 14: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Performance, Responsiveness, and Variability

JDK 8 LTS vs. 11 LTS vs. 12 vs. 13 compare

Page 15: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

SPECjbb*2015: quick summary

Rough estimation of

high bound settled

performance

QCon SFO 2019

max-jOPS

(Full system capacity)

critical-jOPS

(Responsiveness)

* All trademarks are the property of their respective owners

Page 16: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

SPECjbb2015: JDK 8 LTS → JDK 11 LTS

QCon SFO 2019

0.00

0.25

0.50

0.75

1.00

1.25

1.50

JDK 8 LTS JDK 11 LTS JDK 12 JDK 13

SPECjbb2015 Full System Capacity Responsiveness

Full system capacity improved up to ~5%

Responsiveness improved up to ~35%

"-Xmx150g –Xms150g -Xmn130g"

* All trademarks are the property of their respective owners

Page 17: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Variability: JDK 8 LTS → JDK 11 LTS

QCon SFO 2019

JDK 11 LTS significantly less variability than JDK 8 LTS for responsiveness

0.00

0.20

0.40

0.60

0.80

1.00

1.20

Run 1 Run 2 Run 3 Run 4 Run 5 Run 6 Run 7

SPECjbb2015

JDK 8 LTSFull System Capacity Responsiveness

0.00

0.20

0.40

0.60

0.80

1.00

1.20

Run 1 Run 2 Run 3 Run 4 Run 5 Run 6 Run 7

SPECjbb2015

JDK 11 LTS

Full System Capacity Responsiveness

0

5

10

15

JDK 8 LTS JDK 11 LTS

% STD Dev Full System Capacity Responsiveness

* All trademarks are the property of their respective owners

Page 18: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

DaCapo micro-benchmark: FaaS

QCon SFO 2019

Several components

execution time as small as

500ms

Startup is similar

Execution time with

JDK 11 LTS > JDK 8 LTS

(G1GC ?) 0.00

0.50

1.00

1.50

2.00

JDK 11 LTS / JDK 8 LTS (execution time) Warmup Measurement

0

5000

10000

15000

20000

25000

30000

One iteration time (in ms) JDK 8 LTS JK 11 LTS

Better

* All trademarks are the property of their respective owners

Page 19: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

GC Groundwork

Page 20: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Heap Layout

Heap

Z GC

Shenandoah GC

Young GenerationG1 GC

Old Generation

Page 21: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

G1 Heap Regions

Page 22: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Occupied and Free Regions

O O O O O O O O O O

O O O O O O O O O O

O O O O O O O O O O

O O O O

O O O O

O O O O

• List of free regions

• In case of generational heap (like G1), the occupied regions could be young, old or humongous

Page 23: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

GC Commonalities

From To

Page 24: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

HeapFrom Space To Space

O O O O O O O O O O

O O O O O O O O O O

O O O O O O O O O O

GC ROOTS

THREAD

1 STACK

THREAD

N STACK

STATICVARIABLES

ANY JNI REFERENCES

Copying Collector aka Compacting Collector aka Evacuation

Page 25: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

O O O O O O O O O O

O O O O O O O O O O

O O O O O O O O O O

GC ROOTS

THREAD

1 STACK

THREAD

N STACK

O O

O O

O

STATICVARIABLES

ANY JNI REFERENCES

OO

OO

O

O O O O O O O O O O

O O O O O O O O O O

O O O O O O O O O O

Copying Collector aka Compacting Collector aka Evacuation

Page 26: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Copying Collector aka Compacting Collector aka Evacuation

O O O O O O O O

O O O O O O O

O O O O O O O

O O O

O O O

O O

Page 27: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

GC Differences

Page 28: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

GCs

Garbage Collectors Parallel GC G1 GC Shenandoah GC Z GC

Regionalized? No Yes Yes Yes

Generational? Yes Yes No No

Compaction? Yes, STW,

Forwarding

address in header

Yes, STW,

Forwarding

address in header

Yes, Concurrent,

Forwarding

Pointer

Yes, Concurrent,

Colored

Pointers

Target Pause Times? Throughput

driven

200ms 10ms 10ms

Concurrent Marking

Algorithm?

No SATB SATB Striped

Page 29: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Performance!

Page 30: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

GC PerformanceThroughput and Responsiveness – Higher is Better

100%96%

135%132%

122% 122%119%

91% 93%

124%120%

116% 116% 114%

48%

56%52% 54%

49% 47% 48%

0%

20%

40%

60%

80%

100%

120%

140%

160%

shenandoah z parallel, base+ng parallel, base+xmng1, base+ng+pauseg1, base+ng+pausesg1, base+ng+pause

Max Throughput Throughput under response time constraints Responsiveness

Page 31: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

AOT Groundwork

Page 32: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

OpenJDK JIT Compilation (prior to Tiered Compilation)

Page 33: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Tiered Compilation without AOT

https://devblogs.microsoft.com/java/aot-compilation-in-hotspot-introduction/

Page 34: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Tiered Compilation with AOT

https://devblogs.microsoft.com/java/aot-compilation-in-hotspot-introduction/

Page 35: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Performance!

Page 36: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

AOT PerformanceJVM 2008 – Higher is Better

85%

90%

95%

100%

105%

110%

115%

wo AOT AOT AOT with tiered

Page 37: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

G1 GC and Humongous Objects

Page 38: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

What Constitutes a Humongous Object?

Page 39: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

What Constitutes a Humongous Region?

Page 40: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

Humongous Objects

Page 41: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

DaCapo Performance Issue

Page 42: JDK 8 LTS to the latest Performance and Responsiveness … · 2020-03-17 · Java Team JDK 8 LTS to the latest Performance and Responsiveness Prospective Anil Kumar Datacenter Performance

© Copyright Microsoft Corporation. All rights reserved.