Weitere ähnliche Inhalte Kürzlich hochgeladen (20) Maximizing Performance with GraalVM2. InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
graalvm-performance/
3. Presented at QCon New York
www.qconnewyork.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
4. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Maximizing Performance
with
Thomas Wuerthinger (@thomaswue)
Senior Research Director
Oracle Labs
June 25, 2019
5. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, timing, and pricing of any
features or functionality described for Oracle’s products may change and remains at the
sole discretion of Oracle Corporation.
6. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Startup Time Peak Throughput
Memory Footprint Max Latency
Packaging Size
9. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
native-image MyMainClass
./mymainclass
JIT AOT
java MyMainClass
10. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
GraalVM AOT for Native Images
Ahead-of-Time
Compilation
Application
Libraries
JDK
Substrate VM
Points-to Analysis
Run Initializations
Heap Snapshotting
Input:
All classes from application,
libraries, and VM
Iterative analysis until
fixed point is reached
Code in
Text Section
Image Heap in
Data SectionImage Heap
Writing
Output:
Native executable
11. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
AOT vs JIT: Startup Time
• JIT
– Load JVM executable
– Load classes from file system
– Verify bytecodes
– Start interpreting
– Run static initializers
– First tier compilation (C1)
– Gather profiling feedback
– Second tier compilation (GraalVM or C2)
– Finally run with best machine code
• AOT
– Load executable with prepared heap
– Immediately start with best machine code
12. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
AOT vs JIT: Startup Time
940 ms
2101 ms
988 ms
16 ms
37 ms
35 ms
0 ms 500 ms 1000 ms 1500 ms 2000 ms 2500 ms
Quarkus
Micronaut
Helidon
GraalVM AOT GraalVM JIT
13. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Java Flight Recorder Compilation Information
14. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
AOT vs JIT: Memory Footprint
• JIT
– Loaded JVM executable
– Application data
– Loaded bytecodes
– Reflection meta-data
– Code cache
– Profiling data
– JIT compiler data structures
• AOT
– Loaded application executable
– Application data
15. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
121 MB
180 MB
106 MB
17 MB
41 MB
31 MB
0 MB 20 MB 40 MB 60 MB 80 MB 100 MB 120 MB 140 MB 160 MB 180 MB 200 MB
Quarkus
Micronaut
Helidon
GraalVM AOT GraalVM JIT
AOT vs JIT: Memory Footprint
16. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Web Server Startup and Memory Footprint
• JIT 800ms / 350Mb • AOT 8ms / 13Mb
Starting up and serving 2 requests in the first 10s
17. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Which is fastest?
18. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Performance is hard to measure
19. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
AOT vs JIT: Throughput
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
16,000
18,000
1,000 10,000 100,000 1,000,000 10,000,000
Cumulative number of requests sent by ApacheBench
Native Image (CE)
JDK 8, Java HotSpot VM
Handled requests per second
GraalVM AOT
20. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Profile-Guided Optimizations (PGO)
native-image
--pgo-instrument
Instrumented
Binary
native-image --pgo
Optimized
Binary
Profiles (.iprof)
Relevant
Workloads
21. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
AOT vs JIT: Throughput
0
2,000
4,000
6,000
8,000
10,000
12,000
14,000
16,000
18,000
1,000 10,000 100,000 1,000,000 10,000,000
Cumulative number of requests sent by ApacheBench
Native Image (EE with PGO)
Native Image (CE)
JDK 8, Java HotSpot VM
Handled requests per second
GraalVM AOT with PGO
GraalVM AOT
22. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
AOT vs JIT: Peak Performance
• JIT
– Profiling at startup enabled better
optimizations
– Can make optimistic assumptions about
the profile and deoptimize
• AOT
– Needs to handle all cases in machine code
– Profile-guided optimizations help
– Predictable performance
23. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
More Benchmarks…
• Optimizing a compiler for too few benchmarks results in typical
overfitting problems
• Therefore we started together with academic collaborators
https://renaissance.dev
• All benchmark data can be interesting; careful with conclusions though.
24. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Rennaissance.dev
25. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
AOT vs JIT: Max Latency
• JIT
– Many low latency GC options available
• G1
• CMS
• ZGC
• Shenandoah
• AOT
– Only regular stop© collector
– Assumes small heap configuration
– Can quickly restart; could use load
balancer instead of GC
• Peak vs max latency trade-offs:
– Loop safepoints
– Parallel stop-the-world GC
26. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
AOT vs JIT: Packaging Size
• JIT
– Use jlink for smaller package
– Lightweight docker image
(e.g., alpine linux)
• AOT
– Everything in single binary
– Can run on bare metal docker
– Substantially smaller constant overhead
• Peak vs packaging trade-offs:
– Inlining
– Code duplication
27. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Startup TimePeak Throughput
Memory FootprintMax Latency
Packaging Size
GraalVM JIT GraalVM AOT
No Configuration
Can AOT get better?
– Collecting profiles up-front
– Low-latency GC option
– Tracing agent for configuration
28. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
GraalVM can to much more…
29. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Multiplicative Value-Add of GraalVM Ecosystem
Languages GraalVM Embeddings* *
Java
JavaScript
Ruby
R
Python
C/C++. FORTRAN, …
HotSpot JVM
Oracle RDBMS
Node.js
Standalone
Spark
…
Optimizations
Tooling
Interoperability
Security
Add your own language or emedding or language-agnostic tools!
30. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
GraalVM Community
• https://www.graalvm.org
• Open source on GitHub at
https://github.com/oracle/graal
31. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
@thomaswue
Q/A
@graalvm
34. Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
graalvm-performance/