#Quarkus @[email protected]
why optimise?
0.5s extra search
page time
Slide 5
Slide 5 text
#Quarkus @[email protected]
why optimise?
0.5s extra search
page time
20% drop in
traffic
Slide 6
Slide 6 text
#Quarkus @[email protected]
why optimise?
0.5s extra search
page time
20% drop in
traffic
100 ms latency on page
load
Slide 7
Slide 7 text
#Quarkus @[email protected]
why optimise?
0.5s extra search
page time
20% drop in
traffic
100 ms latency on page
load
7% lower
conversion rate
Slide 8
Slide 8 text
#Quarkus @[email protected]
why optimise?
0.5s extra search
page time
20% drop in
traffic
100 ms latency on page
load
7% lower
conversion rate
Slide 9
Slide 9 text
#Quarkus @[email protected]
why optimise?
0.5s extra search
page time
20% drop in
traffic
10 ms delay in trading
platform
100 ms latency on page
load
7% lower
conversion rate
Slide 10
Slide 10 text
#Quarkus @[email protected]
why optimise?
0.5s extra search
page time
20% drop in
traffic
10 ms delay in trading
platform
10% drop in
revenue
100 ms latency on page
load
7% lower
conversion rate
Slide 11
Slide 11 text
#Quarkus @holly_cummins
what is optimising?
Slide 12
Slide 12 text
#Quarkus @[email protected]
for whom?
when?
doing what?
“make it go faster”
Slide 13
Slide 13 text
#Quarkus @holly_cummins
Slide 14
Slide 14 text
#Quarkus @holly_cummins
performance can be:
Slide 15
Slide 15 text
#Quarkus @holly_cummins
performance can be:
throughput
Slide 16
Slide 16 text
#Quarkus @holly_cummins
performance can be:
throughput
transactions
per second
Slide 17
Slide 17 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
transactions
per second
Slide 18
Slide 18 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
transactions
per second
start-up
time
Slide 19
Slide 19 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
transactions
per second
response
time
start-up
time
Slide 20
Slide 20 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
ramp-up
time
transactions
per second
response
time
start-up
time
Slide 21
Slide 21 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
capacity
ramp-up
time
transactions
per second
response
time
start-up
time
Slide 22
Slide 22 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
capacity
ramp-up
time
transactions
per second
response
time
start-up
time
bandwidth
Slide 23
Slide 23 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
capacity
ramp-up
time
transactions
per second
response
time
start-up
time
footprint
bandwidth
Slide 24
Slide 24 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
capacity
ramp-up
time
transactions
per second
response
time
start-up
time
CPU usage
footprint
bandwidth
Slide 25
Slide 25 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
capacity
utilisation
ramp-up
time
transactions
per second
response
time
start-up
time
CPU usage
footprint
bandwidth
Slide 26
Slide 26 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
capacity
utilisation
…
ramp-up
time
transactions
per second
response
time
start-up
time
CPU usage
footprint
bandwidth
Slide 27
Slide 27 text
#Quarkus @holly_cummins
performance can be:
throughput
latency
capacity
utilisation
…
ramp-up
time
transactions
per second
response
time
start-up
time
CPU usage
footprint
bandwidth
Slide 28
Slide 28 text
#Quarkus @[email protected]
Never underestimate the bandwidth [throughput] of a
station wagon full of tapes hurtling down the highway.
–Andrew Tanenbaum, 1981
Slide 29
Slide 29 text
#Quarkus @[email protected]
Never underestimate the bandwidth [throughput] of a
station wagon full of tapes hurtling down the highway.
–Andrew Tanenbaum, 1981
but the latency is terrible …
#Quarkus @[email protected]
quarkus + graalvm
trading-off flexibility + throughput
against startup speed and footprint
Slide 43
Slide 43 text
#Quarkus @[email protected]
quarkus + graalvm
trading-off flexibility + throughput
against startup speed and footprint
uhh … are you supposed
to shut down applications
after using them?
#Quarkus @[email protected]
aside: quarkus + jvm
better startup time
better footprint
better throughput
better developer experience
there is no tradeoff
Slide 51
Slide 51 text
#Quarkus @[email protected]
aside: quarkus + jvm
better startup time
better footprint
better throughput
better developer experience
there is no tradeoff
(only elimination of waste)
Slide 52
Slide 52 text
#Quarkus @[email protected]
aside: quarkus + jvm
better startup time
better footprint
better throughput
better developer experience
there is no tradeoff
(only elimination of waste)
ok, there is a tradeoff: not optimising for dynamism nobody needs in the cloud
Slide 53
Slide 53 text
#Quarkus @[email protected]
“waste”
a trade-off where only one side has value
Slide 54
Slide 54 text
#Quarkus @holly_cummins
recap:
which is “faster?”
Slide 55
Slide 55 text
#Quarkus @holly_cummins
GraalVM
Quarkus
Application
recap:
which is “faster?”
Slide 56
Slide 56 text
#Quarkus @holly_cummins
OpenJDK GraalVM
Quarkus Quarkus
Application Application
recap:
which is “faster?”
Slide 57
Slide 57 text
#Quarkus @holly_cummins
ephemeral or serverless
OpenJDK GraalVM
Quarkus Quarkus
Application Application
recap:
which is “faster?”
Slide 58
Slide 58 text
#Quarkus @holly_cummins
ephemeral or serverless
OpenJDK GraalVM
Quarkus Quarkus
Application Application
running your application
for a long time
recap:
which is “faster?”
Slide 59
Slide 59 text
#Quarkus @holly_cummins
ephemeral or serverless
OpenJDK GraalVM
Quarkus Quarkus
Application Application
running your application
for a long time
recap:
which is “faster?”
Slide 60
Slide 60 text
@holly_cummins
requirements aren’t
what we think they are
#Quarkus @[email protected]
leading indicators
we care about them
lagging indicators
Slide 78
Slide 78 text
#Quarkus @[email protected]
leading indicators
we care about them
easy to measure
lagging indicators
Slide 79
Slide 79 text
#Quarkus @[email protected]
leading indicators
we care about them
easy to measure
hard to change
lagging indicators
Slide 80
Slide 80 text
#Quarkus @[email protected]
leading indicators
we care about them
easy to measure
hard to change
lagging indicators
easy to change
Slide 81
Slide 81 text
#Quarkus @[email protected]
leading indicators
we care about them
easy to measure
hard to change
lagging indicators
predictive of a thing we care about
easy to change
Slide 82
Slide 82 text
#Quarkus @[email protected]
leading indicators
we care about them
easy to measure
hard to change
lagging indicators
predictive of a thing we care about
hard to identify
easy to change
Slide 83
Slide 83 text
#Quarkus @[email protected]
leading indicators
we care about them
easy to measure
hard to change
lagging indicators
predictive of a thing we care about
hard to identify
easy to change
Slide 84
Slide 84 text
#Quarkus @[email protected]
caution:
performance experiments for entertainment purposes only.
do not try these at home.
#Quarkus @[email protected]
-verbose:gc
-Xverbosegclog:gclog.xml
-Xgcpolicy:optthruput
-Xmx300m
-Xms300m
-Xcompactgc
why does the
performance stay exactly the
same no matter what gc
settings I choose?
Slide 99
Slide 99 text
#Quarkus @[email protected]
by the way, this is cheating.
(remember the ‘bad science’?)
#Quarkus @[email protected]
-verbose:gc
-Xverbosegclog:gclog.xml
-Xgcpolicy:optthruput
total GC time: 21.6s
4.1% of time in GC pause
tool: GCMV
Slide 104
Slide 104 text
#Quarkus @[email protected]
-verbose:gc
-Xverbosegclog:gclog.xml
-Xgcpolicy:optthruput
total GC time: 21.6s
4.1% of time in GC pause
total GC time: 12.0s
tool: GCMV
Slide 105
Slide 105 text
#Quarkus @[email protected]
-verbose:gc
-Xverbosegclog:gclog.xml
-Xgcpolicy:optthruput
total GC time: 21.6s
4.1% of time in GC pause
total GC time: 12.0s
3.6% of time in GC pause
tool: GCMV
Slide 106
Slide 106 text
#Quarkus @[email protected]
-verbose:gc
-Xverbosegclog:gclog.xml
-Xgcpolicy:optthruput
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
tool: GCMV
Slide 107
Slide 107 text
#Quarkus @[email protected]
-verbose:gc
-Xverbosegclog:gclog.xml
-Xgcpolicy:optthruput
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
493 transactions/s
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
260 transactions/s
tool: GCMV
Slide 108
Slide 108 text
#Quarkus @[email protected]
-verbose:gc
-Xverbosegclog:gclog.xml
-Xgcpolicy:optthruput
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
493 transactions/s
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
260 transactions/s
tool: GCMV
Slide 109
Slide 109 text
#Quarkus @[email protected]
-verbose:gc
-Xverbosegclog:gclog.xml
-Xgcpolicy:optthruput
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
493 transactions/s
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
260 transactions/s
tool: GCMV
Slide 110
Slide 110 text
#Quarkus @holly_cummins
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
493 transactions/s
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
260 transactions/s
Slide 111
Slide 111 text
#Quarkus @holly_cummins
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
493 transactions/s
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
260 transactions/s
Slide 112
Slide 112 text
#Quarkus @holly_cummins
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
493 transactions/s
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
260 transactions/s
leading indicator
Slide 113
Slide 113 text
#Quarkus @holly_cummins
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
493 transactions/s
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
260 transactions/s
leading indicator
Slide 114
Slide 114 text
#Quarkus @holly_cummins
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
493 transactions/s
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
260 transactions/s
leading indicator
lagging indicator
Slide 115
Slide 115 text
#Quarkus @holly_cummins
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
493 transactions/s
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
260 transactions/s
leading indicator
lagging indicator
?
Slide 116
Slide 116 text
#Quarkus @holly_cummins
total GC time: 21.6s
4.1% of time in GC pause
23.9 GB garbage collected
493 transactions/s
total GC time: 12.0s
3.6% of time in GC pause
13.0 GB garbage collected
260 transactions/s
leading indicator
lagging indicator
?
?
Slide 117
Slide 117 text
#Quarkus @[email protected]
so wait, what changed to make the app faster?
running jmeter on the same machine as the app gives a big speedup!
Slide 118
Slide 118 text
#Quarkus @[email protected]
“Any improvements made anywhere
besides the bottleneck are an illusion.”
– Gene Kim
Slide 119
Slide 119 text
#Quarkus @[email protected]
time kills all performance advice
(even mine)
#Quarkus @[email protected]
zgc Brian Goetz, yesterday
tradeoff: throughput
is ~2% lower
Slide 125
Slide 125 text
#Quarkus @[email protected]
zgc Brian Goetz, yesterday
tradeoff: throughput
is ~2% lower
tradeoff: memory is
higher
Slide 126
Slide 126 text
#Quarkus @[email protected]
zgc Brian Goetz, yesterday
tradeoff: throughput
is ~2% lower
tradeoff: memory is
higher
java 21 adds generational zgc
reduces zgc footprint by 75%
Slide 127
Slide 127 text
#Quarkus @[email protected]
the takeaways:
gc can improve performance by rearranging the heap
find the bottleneck
validate advice independently
optimise the right thing … for you
#Quarkus @[email protected]
static string beSlow()
{
string result = "";
for (int i = 0; i < 314159; i++)
{
result += getStringData(i);
}
return result;
}
Slide 148
Slide 148 text
#Quarkus @[email protected]
static string beSlow()
{
string result = “”;
result += getStringData(1);
result += getStringData(2);
result += getStringData(3);
return result;
}
Slide 149
Slide 149 text
#Quarkus @[email protected]
static string beSlow()
{
string result = “”;
result += getStringData(1);
result += getStringData(2);
result += getStringData(3);
return result;
}
this is fine
Slide 150
Slide 150 text
#Quarkus @[email protected]
the JVM writers have far more time for optimising than you do
clean, typical, code runs best
#Quarkus @[email protected]
loom
very good at waiting
not so good at cpu-bound
tasks
Slide 159
Slide 159 text
#Quarkus @[email protected]
loom
very good at waiting
not so good at cpu-bound
tasks
can interact badly with libraries
Slide 160
Slide 160 text
#Quarkus @[email protected]
loom
very good at waiting
not so good at cpu-bound
tasks
can interact badly with libraries
if a virtual thread gets pinned or
does a long cpu process all its
friends grind to a halt
Slide 161
Slide 161 text
#Quarkus @[email protected]
is thread management
really your bottleneck?
loom is not a magic “faster thread”
#Quarkus @[email protected]
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
Slide 172
Slide 172 text
#Quarkus @[email protected]
method profiler
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
Slide 173
Slide 173 text
#Quarkus @[email protected]
method profiler
VisualVM
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
Slide 174
Slide 174 text
#Quarkus @[email protected]
method profiler
Mission Control
VisualVM
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
Slide 175
Slide 175 text
#Quarkus @[email protected]
method profiler
Mission Control
VisualVM
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
IntelliJ Profiler
Slide 176
Slide 176 text
#Quarkus @[email protected]
method profiler
Mission Control
VisualVM
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 177
Slide 177 text
#Quarkus @[email protected]
method profiler
Mission Control
flame graphs
VisualVM
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 178
Slide 178 text
#Quarkus @[email protected]
method profiler
GC analysis
Mission Control
flame graphs
VisualVM
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 179
Slide 179 text
#Quarkus @[email protected]
method profiler
GC analysis
Mission Control
flame graphs
GCMV
VisualVM
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 180
Slide 180 text
#Quarkus @[email protected]
method profiler
GC analysis
heap analysis
Mission Control
flame graphs
GCMV
VisualVM
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 181
Slide 181 text
#Quarkus @[email protected]
method profiler
GC analysis
heap analysis
Mission Control
flame graphs
GCMV
VisualVM
Eclipse MAT
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 182
Slide 182 text
#Quarkus @[email protected]
method profiler
GC analysis
heap analysis
APM
Mission Control
flame graphs
GCMV
VisualVM
Eclipse MAT
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 183
Slide 183 text
#Quarkus @[email protected]
method profiler
GC analysis
heap analysis
APM
Mission Control
flame graphs
GCMV
VisualVM
Eclipse MAT
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
GlowRoot
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 184
Slide 184 text
#Quarkus @[email protected]
method profiler
GC analysis
heap analysis
APM
Mission Control
flame graphs
GCMV
New Relic*
VisualVM
Eclipse MAT
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
GlowRoot
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 185
Slide 185 text
#Quarkus @[email protected]
method profiler
GC analysis
heap analysis
APM
Mission Control
flame graphs
GCMV
New Relic*
AppDynamics*
VisualVM
Eclipse MAT
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
GlowRoot
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 186
Slide 186 text
#Quarkus @[email protected]
method profiler
GC analysis
heap analysis
APM
Mission Control
flame graphs
GCMV
New Relic*
AppDynamics*
VisualVM
Dynatrace*
Eclipse MAT
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
GlowRoot
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
Slide 187
Slide 187 text
#Quarkus @[email protected]
method profiler
GC analysis
heap analysis
APM
Mission Control
flame graphs
GCMV
New Relic*
AppDynamics*
VisualVM
Dynatrace*
Eclipse MAT
* not free
this is an incomplete list, because there are a lot of tools out there, and many cost money
GlowRoot
IBM Health Center
(for OpenJ9)
IntelliJ Profiler
@holly_cummins
you may need to know the whole system
context to know what to optimise
Slide 194
Slide 194 text
#Quarkus @[email protected]
“Nines don’t matter if your
users aren’t happy.”
– Charity Majors
Slide 195
Slide 195 text
#Quarkus @[email protected]
don’t forget the edges
queueing theory helps us understand
where the disasters happen
Slide 196
Slide 196 text
#Quarkus @[email protected]
“When it comes to IT performance, amateurs look
at averages. Professionals look at distributions.”
– Avishai Ish-Shalom
Slide 197
Slide 197 text
#Quarkus @[email protected]
slow performance can turn into big cloud bills
make cloud costs visible to engineers
Slide 198
Slide 198 text
#Quarkus @holly_cummins
ok, but you promised bears
Slide 199
Slide 199 text
#Quarkus @[email protected]
if you leave the TV on when
you’re not using it, you’re a
polar bear murderer
Slide 200
Slide 200 text
#Quarkus @[email protected]
data centres use 1-2% of
the world’s electricity
Slide 201
Slide 201 text
#Quarkus @[email protected]
performance optimisation is carbon optimisation
Slide 202
Slide 202 text
#Quarkus @[email protected]
cost: leading indicator for carbon
performance: leading indicator for carbon
Slide 203
Slide 203 text
#Quarkus @[email protected]
example:
what our quarkus experiments showed
Slide 204
Slide 204 text
@holly_cummins #RedHat
Source: Clement Escoffier
cost impact of framework choice
Setup:
• 800 requests/second, over 20 days
• SLA > 99%
• AWS instances
Assumptions:
• Costs are for us-east-1 data centre
Slide 205
Slide 205 text
@holly_cummins #RedHat
Setup:
• 800 requests/second, over 20 days
• SLA > 99%
Assumptions:
• 50% load
• us-east-1 data centre
• Teads dataset
Source: Clement Escoffier x Teads
cloud carbon impact of framework choice
carbon impact of framework choice
Slide 206
Slide 206 text
@holly_cummins #RedHat
Setup:
• 800 requests/second, over 20 days
• SLA > 99%
Assumptions:
• 50% load
• us-east-1 data centre
• Teads dataset
Source: Clement Escoffier x Teads
cloud carbon impact of framework choice
carbon impact of framework choice
economic model in action:
the cost and carbon metrics are
(roughly) the same
Slide 207
Slide 207 text
@holly_cummins #RedHat
capacity
Source: John O’Hara
Setup:
• REST + CRUD
• large heap
• RAPL energy measurement
Assumptions:
• US energy mix
climate impact of framework choice
Slide 208
Slide 208 text
@holly_cummins #RedHat
capacity
Source: John O’Hara
Setup:
• REST + CRUD
• large heap
• RAPL energy measurement
Assumptions:
• US energy mix
climate impact of framework choice
shorter line means
lower max throughput
Slide 209
Slide 209 text
@holly_cummins #RedHat
capacity
Source: John O’Hara
Setup:
• REST + CRUD
• large heap
• RAPL energy measurement
Assumptions:
• US energy mix
climate impact of framework choice
shorter line means
lower max throughput
higher line means worse
carbon footprint
Slide 210
Slide 210 text
@holly_cummins #RedHat
capacity
Source: John O’Hara
Setup:
• REST + CRUD
• large heap
• RAPL energy measurement
Assumptions:
• US energy mix
climate impact of framework choice
vrrrooom model in action:
quarkus on JVM has the smallest footprint …
because it has the highest throughput
shorter line means
lower max throughput
higher line means worse
carbon footprint