SlideShare a Scribd company logo
1 of 20
Download to read offline
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 FeaturesSimon Ritter
 
JDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondJDK 9, 10, 11 and Beyond
JDK 9, 10, 11 and BeyondSimon Ritter
 
Moving Towards JDK 12
Moving Towards JDK 12Moving Towards JDK 12
Moving Towards JDK 12Simon 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 PlatformThomas Wuerthinger
 
JMC/JFR: Kotlin spezial
JMC/JFR: Kotlin spezialJMC/JFR: Kotlin spezial
JMC/JFR: Kotlin spezialMiro Wengner
 
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 BenchmarkDror 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 CoreC4Media
 
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 & TriumphsDavid Delabassee
 
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 TriumphsDavid Delabassee
 
20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVM20191119 Cloud Native Java : GraalVM
20191119 Cloud Native Java : GraalVMTaewan 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 fasterTim 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 StreamLuís Soares
 
Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgpmichaelisvy
 
Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Serverless Java: JJUG CCC 2019
Serverless Java: JJUG CCC 2019Shaun 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 microservicesLuram Archanjo
 
TechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTechEvent Graal(VM) Performance Interoperability
TechEvent Graal(VM) Performance InteroperabilityTrivadis
 
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
 
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
 

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
 
Pitch v2.2
Pitch v2.2Pitch v2.2
Pitch v2.2
 
クラウドのコストを大幅削減!事例から見るクラウド間移行の効果(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
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

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 ;-)