SlideShare a Scribd company logo
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Startingupganaii
Non-lethal bathwater removal for a snappier JDK
Claes Redestad
Java SE Performance
Oracle
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product directon. It is intended for
informaton purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functonality, and should not be relied upon
in making purchasing decisions. The development, release, and tming of any features or
functonality described for Oracle’s products remains at the sole discreton of Oracle.
4
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Startup challenges - at a glance...
● Intrinsic trade-of between startup and other concerns
such as peak performance and footprint
Startup ofen draws the shortest straw
● Death by a thousand cuts
Inefciencies - many of which individually escape
detecton - accumulate over tme
● New language features tend towards dynamic setup
Generatng code lazily (lambdas, indifed string
concatenaton, etc..) help performance at a startup cost
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
JDK startup optmizaton... why bother?
● Broadens the range of applicatons the JVM can be a good ft for
CLI tools, functon-as-a-service ...
● Consolidate eforts targetng embedded systems
● Fight the misconcepton that "Java is slow"
● Improved quality of life
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Startup optmizaton techniques
● CDS
● HotSpot AOT (jaotc)
● jlink
● GraalVM natve-image
Gains possible from removing modules
Imposes no limits on applicatons
"Natve" startup tmes; several limitatons
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
But let's start from the beginning...
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
Wiiier
BestgStartup
Beichmark
1995
Let's ignore that running a program like this from start to fnish includes
more than "startup" for now...
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Hello World: JDK 9
● While the Java module system
enables certain speed-ups, it does
come with some inital overhead
● Regressions also due:
● making G1 default
● segmentng the code cache
● adding JVMCI
● implementng VM fag constraint
checks(!)
● etc...
● Numerous startup optmizatons
sofened the blow
8 9
0
20
40
60
80
100
120
Hello World
time(ms)
Unless otherwise stated: -Xshare:auto -Xmx32m
Intel(R) Xeon(R) E5-2630 v3 @ 2.40GHz
Ubuntu 16.04.3 LTS
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Hello World: JDK 10
Turning the tde...
● Optmized module resoluton
● Numerous small library and runtme
optmizatons
● G1 startup and footprint
improvements
● CDS support for pre-resolving constant
pool entries (e.g. String literals) 8 9 10
0
20
40
60
80
100
120
Hello World
time(ms)
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Hello World: JDK 11
Even faster...
● Removal of Java EE and Java FX
modules from the JDK brings a
leaner standard image, which
means less work needed to
bootstrap modules
● Library optmizatons contnued
8 9 10 11
0
20
40
60
80
100
120
Hello World
time(ms)
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Hello World: JDK 12(?)
Early stage of development, but
startup is already set to improve:
● Using CDS to serialize the default
module graph (and more) allows a
large cut in startup
● Dialing up the strictness of module
encapsulaton (--illegal-
access=deny) is being
considered, which would cut of
another 2-3ms 8 9 10 11 12
0
20
40
60
80
100
120
Hello World
time(ms)
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Hello World: Bytecodes executed
● Bootstrapping the module system
(JDK 9) caused a ~9x increase in the
number of "raw" bytecodes executed
(-Xint)
● ... but allowed us to do less work
before JIT threads can be actvated
(System.initPhase1), meaning JIT kick
in earlier
● ... which means we quickly shif from
the interpreter to more optmized
code (mainly C1 at this early stage)
8 9 10 11 12
0
500000
1000000
1500000
2000000
2500000
3000000
3500000
4000000
4500000
5000000
-Xint
OOTB
#bytecodesexecuted
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Hello form factors
● The shif to execute more logic in
java during bootstrap means a
higher dependency on our
system's ability to quickly JIT of-
used methods
● On a dual-core laptop[1] we might
struggle to break even with JDK 8
[1] Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz
8 9 10 11 12
0
20
40
60
80
100
120
140
Laptop
Workstation
time(ms)
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Hello Lambda
import java.util.function.Consumer;
public class HelloLambda {
public static void main(String[] args) {
Consumer<String> println = System.out::println;
println.accept("Hello World!");
}
}
Will the following program run as fast as HelloWorld?
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
8
0
20
40
60
80
100
120
140
160
180
200
Hello World
Hello Lambda
time(ms)
Hello Lambda: JDK 8
On JDK 8, the cost of initalizing a single
lambda is almost 90ms on my
workstaton (8u172).
So during JDK 9 development, we
started seeing similar startup
regressions in various benchmarks, and
every so ofen nice improvements had
to be backed out...
"Let's try to do beter!" we exclaimed
in unison. Probably.
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Hello Lambda: JDK 9
An efort to address this was initated,
JDK-8086045:
● Made the implementaton lazier
● Micro-optmized a lot...
● Implemented jlink plugin to generate
many of the dynamically generated
classes needed by typical uses of
java.lang.invoke at link-tme
A bit over 50% of overheads removed.
8 9
0
20
40
60
80
100
120
140
160
180
200
Hello World
Hello Lambda
time(ms)
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Hello Lambda: JDK 10
JDK 10 saw only a few incremental
improvements as engineering tme was
mainly spent on other things...
(6 months go by so quickly!)
8 9 10
0
20
40
60
80
100
120
140
160
180
200
Hello World
Hello Lambda
time(ms)
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Hello Lambda: JDK 11
Unexpected breakthrough cut costs by 75%
This came from special-casing the lambda
bootstrap method to be invoked exactly.
Doing so removes the need to dynamically
type-check arguments: JDK-8198418
More than twice as fast as Java 8. Mission
accomplished?! 8 9 10 11
0
20
40
60
80
100
120
140
160
180
200
Hello World
Hello Lambda
time(ms)
Copyright © 2018, Oracle and/or its afliates. All rights reserved. |
Current challenges
Improve and make existng tools that improve startup easier to use (CDS, AOT)...
Diminishing returns on regular JDK startup tmes as we're getng rid of small
inefciencies
Runtme code generaton is here to stay, so let's make it even beter...
... while not making things harder for the eforts to compile Java to natve ;-)

More Related Content

What's hot

JDK 9: 55 New Features
JDK 9: 55 New FeaturesJDK 9: 55 New Features
JDK 9: 55 New Features
Simon Ritter
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
Simon Ritter
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12
Simon Ritter
 
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Thomas Wuerthinger
 
Graal Tutorial at CGO 2015 by Christian Wimmer
Graal Tutorial at CGO 2015 by Christian WimmerGraal Tutorial at CGO 2015 by Christian Wimmer
Graal Tutorial at CGO 2015 by Christian WimmerThomas Wuerthinger
 
Graal VM: Multi-Language Execution Platform
Graal VM: Multi-Language Execution PlatformGraal VM: Multi-Language Execution Platform
Graal VM: Multi-Language Execution Platform
Thomas Wuerthinger
 
JMC/JFR: Kotlin spezial
JMC/JFR: Kotlin spezialJMC/JFR: Kotlin spezial
JMC/JFR: Kotlin spezial
Miro Wengner
 
JVM++: The Graal VM
JVM++: The Graal VMJVM++: The Graal VM
JVM++: The Graal VM
Martin Toshev
 
So You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkSo You Want To Write Your Own Benchmark
So You Want To Write Your Own Benchmark
Dror Bereznitsky
 

What's hot (9)

JDK 9: 55 New Features
JDK 9: 55 New FeaturesJDK 9: 55 New Features
JDK 9: 55 New Features
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and Beyond
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12
 
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
Graal and Truffle: Modularity and Separation of Concerns as Cornerstones for ...
 
Graal Tutorial at CGO 2015 by Christian Wimmer
Graal Tutorial at CGO 2015 by Christian WimmerGraal Tutorial at CGO 2015 by Christian Wimmer
Graal Tutorial at CGO 2015 by Christian Wimmer
 
Graal VM: Multi-Language Execution Platform
Graal VM: Multi-Language Execution PlatformGraal VM: Multi-Language Execution Platform
Graal VM: Multi-Language Execution Platform
 
JMC/JFR: Kotlin spezial
JMC/JFR: Kotlin spezialJMC/JFR: Kotlin spezial
JMC/JFR: Kotlin spezial
 
JVM++: The Graal VM
JVM++: The Graal VMJVM++: The Graal VM
JVM++: The Graal VM
 
So You Want To Write Your Own Benchmark
So You Want To Write Your Own BenchmarkSo You Want To Write Your Own Benchmark
So You Want To Write Your Own Benchmark
 

Similar to Java and Serverless - A Match Made In Heaven, Part 2

“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the Core“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the Core
C4Media
 
Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by...
Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by...Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by...
Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by...
scalaconfjp
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
David Delabassee
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
CodeOps Technologies LLP
 
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...Geir Høydalsvik
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and Triumphs
David Delabassee
 
20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM
Taewan Kim
 
クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)
クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)
クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)
オラクルエンジニア通信
 
Compile ahead of time. It's fine?
Compile ahead of time. It's fine?Compile ahead of time. It's fine?
Compile ahead of time. It's fine?
Dmitry Chuyko
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark faster
Tim Ellison
 
Using The Mysql Binary Log As A Change Stream
Using The Mysql Binary Log As A Change StreamUsing The Mysql Binary Log As A Change Stream
Using The Mysql Binary Log As A Change Stream
Luís Soares
 
Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgp
michaelisvy
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019
Shaun Smith
 
Micronaut: A new way to build microservices
Micronaut: A new way to build microservicesMicronaut: A new way to build microservices
Micronaut: A new way to build microservices
Luram Archanjo
 
TechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance Interoperability
Trivadis
 
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
Istanbul Tech Talks
 
Hotspot & AOT
Hotspot & AOTHotspot & AOT
Hotspot & AOT
Dmitry Chuyko
 
Ebs performance tuning session feb 13 2013---Presented by Oracle
Ebs performance tuning session  feb 13 2013---Presented by OracleEbs performance tuning session  feb 13 2013---Presented by Oracle
Ebs performance tuning session feb 13 2013---Presented by OracleAkash Pramanik
 
Java mission control and java flight recorder
Java mission control and java flight recorderJava mission control and java flight recorder
Java mission control and java flight recorder
Wolfgang Weigend
 

Similar to Java and Serverless - A Match Made In Heaven, Part 2 (20)

“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the Core“Quantum” Performance Effects: beyond the Core
“Quantum” Performance Effects: beyond the Core
 
Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by...
Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by...Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by...
Run Scala Faster with GraalVM on any Platform / GraalVMで、どこでもScalaを高速実行しよう by...
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
 
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
The State of the Dolphin, MySQL Keynote at Percona Live Europe 2019, Amsterda...
 
Serverless Java - Challenges and Triumphs
Serverless Java - Challenges and TriumphsServerless Java - Challenges and Triumphs
Serverless Java - Challenges and Triumphs
 
20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM
 
クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)
クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)
クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(Oracle Cloudウェビナーシリーズ: 2020年7月8日)
 
Compile ahead of time. It's fine?
Compile ahead of time. It's fine?Compile ahead of time. It's fine?
Compile ahead of time. It's fine?
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark faster
 
Using The Mysql Binary Log As A Change Stream
Using The Mysql Binary Log As A Change StreamUsing The Mysql Binary Log As A Change Stream
Using The Mysql Binary Log As A Change Stream
 
Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgp
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019
 
Micronaut: A new way to build microservices
Micronaut: A new way to build microservicesMicronaut: A new way to build microservices
Micronaut: A new way to build microservices
 
TechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance Interoperability
 
JavaMicroBenchmarkpptm
JavaMicroBenchmarkpptmJavaMicroBenchmarkpptm
JavaMicroBenchmarkpptm
 
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
ITT 2015 - Kirk Pepperdine - The (not so) Dark Art of Performance Tuning, fro...
 
Hotspot & AOT
Hotspot & AOTHotspot & AOT
Hotspot & AOT
 
Ebs performance tuning session feb 13 2013---Presented by Oracle
Ebs performance tuning session  feb 13 2013---Presented by OracleEbs performance tuning session  feb 13 2013---Presented by Oracle
Ebs performance tuning session feb 13 2013---Presented by Oracle
 
Java mission control and java flight recorder
Java mission control and java flight recorderJava mission control and java flight recorder
Java mission control and java flight recorder
 

Recently uploaded

UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
Globus
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 

Recently uploaded (20)

UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
Enhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZEnhancing Performance with Globus and the Science DMZ
Enhancing Performance with Globus and the Science DMZ
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 

Java and Serverless - A Match Made In Heaven, Part 2

  • 1.
  • 2.
  • 3. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Startingupganaii Non-lethal bathwater removal for a snappier JDK Claes Redestad Java SE Performance Oracle
  • 4. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product directon. It is intended for informaton purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functonality, and should not be relied upon in making purchasing decisions. The development, release, and tming of any features or functonality described for Oracle’s products remains at the sole discreton of Oracle. 4
  • 5. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Startup challenges - at a glance... ● Intrinsic trade-of between startup and other concerns such as peak performance and footprint Startup ofen draws the shortest straw ● Death by a thousand cuts Inefciencies - many of which individually escape detecton - accumulate over tme ● New language features tend towards dynamic setup Generatng code lazily (lambdas, indifed string concatenaton, etc..) help performance at a startup cost
  • 6. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | JDK startup optmizaton... why bother? ● Broadens the range of applicatons the JVM can be a good ft for CLI tools, functon-as-a-service ... ● Consolidate eforts targetng embedded systems ● Fight the misconcepton that "Java is slow" ● Improved quality of life
  • 7. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Startup optmizaton techniques ● CDS ● HotSpot AOT (jaotc) ● jlink ● GraalVM natve-image Gains possible from removing modules Imposes no limits on applicatons "Natve" startup tmes; several limitatons
  • 8. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | But let's start from the beginning... public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } Wiiier BestgStartup Beichmark 1995 Let's ignore that running a program like this from start to fnish includes more than "startup" for now...
  • 9. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Hello World: JDK 9 ● While the Java module system enables certain speed-ups, it does come with some inital overhead ● Regressions also due: ● making G1 default ● segmentng the code cache ● adding JVMCI ● implementng VM fag constraint checks(!) ● etc... ● Numerous startup optmizatons sofened the blow 8 9 0 20 40 60 80 100 120 Hello World time(ms) Unless otherwise stated: -Xshare:auto -Xmx32m Intel(R) Xeon(R) E5-2630 v3 @ 2.40GHz Ubuntu 16.04.3 LTS
  • 10. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Hello World: JDK 10 Turning the tde... ● Optmized module resoluton ● Numerous small library and runtme optmizatons ● G1 startup and footprint improvements ● CDS support for pre-resolving constant pool entries (e.g. String literals) 8 9 10 0 20 40 60 80 100 120 Hello World time(ms)
  • 11. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Hello World: JDK 11 Even faster... ● Removal of Java EE and Java FX modules from the JDK brings a leaner standard image, which means less work needed to bootstrap modules ● Library optmizatons contnued 8 9 10 11 0 20 40 60 80 100 120 Hello World time(ms)
  • 12. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Hello World: JDK 12(?) Early stage of development, but startup is already set to improve: ● Using CDS to serialize the default module graph (and more) allows a large cut in startup ● Dialing up the strictness of module encapsulaton (--illegal- access=deny) is being considered, which would cut of another 2-3ms 8 9 10 11 12 0 20 40 60 80 100 120 Hello World time(ms)
  • 13. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Hello World: Bytecodes executed ● Bootstrapping the module system (JDK 9) caused a ~9x increase in the number of "raw" bytecodes executed (-Xint) ● ... but allowed us to do less work before JIT threads can be actvated (System.initPhase1), meaning JIT kick in earlier ● ... which means we quickly shif from the interpreter to more optmized code (mainly C1 at this early stage) 8 9 10 11 12 0 500000 1000000 1500000 2000000 2500000 3000000 3500000 4000000 4500000 5000000 -Xint OOTB #bytecodesexecuted
  • 14. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Hello form factors ● The shif to execute more logic in java during bootstrap means a higher dependency on our system's ability to quickly JIT of- used methods ● On a dual-core laptop[1] we might struggle to break even with JDK 8 [1] Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz 8 9 10 11 12 0 20 40 60 80 100 120 140 Laptop Workstation time(ms)
  • 15. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Hello Lambda import java.util.function.Consumer; public class HelloLambda { public static void main(String[] args) { Consumer<String> println = System.out::println; println.accept("Hello World!"); } } Will the following program run as fast as HelloWorld?
  • 16. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | 8 0 20 40 60 80 100 120 140 160 180 200 Hello World Hello Lambda time(ms) Hello Lambda: JDK 8 On JDK 8, the cost of initalizing a single lambda is almost 90ms on my workstaton (8u172). So during JDK 9 development, we started seeing similar startup regressions in various benchmarks, and every so ofen nice improvements had to be backed out... "Let's try to do beter!" we exclaimed in unison. Probably.
  • 17. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Hello Lambda: JDK 9 An efort to address this was initated, JDK-8086045: ● Made the implementaton lazier ● Micro-optmized a lot... ● Implemented jlink plugin to generate many of the dynamically generated classes needed by typical uses of java.lang.invoke at link-tme A bit over 50% of overheads removed. 8 9 0 20 40 60 80 100 120 140 160 180 200 Hello World Hello Lambda time(ms)
  • 18. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Hello Lambda: JDK 10 JDK 10 saw only a few incremental improvements as engineering tme was mainly spent on other things... (6 months go by so quickly!) 8 9 10 0 20 40 60 80 100 120 140 160 180 200 Hello World Hello Lambda time(ms)
  • 19. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Hello Lambda: JDK 11 Unexpected breakthrough cut costs by 75% This came from special-casing the lambda bootstrap method to be invoked exactly. Doing so removes the need to dynamically type-check arguments: JDK-8198418 More than twice as fast as Java 8. Mission accomplished?! 8 9 10 11 0 20 40 60 80 100 120 140 160 180 200 Hello World Hello Lambda time(ms)
  • 20. Copyright © 2018, Oracle and/or its afliates. All rights reserved. | Current challenges Improve and make existng tools that improve startup easier to use (CDS, AOT)... Diminishing returns on regular JDK startup tmes as we're getng rid of small inefciencies Runtme code generaton is here to stay, so let's make it even beter... ... while not making things harder for the eforts to compile Java to natve ;-)