Slide 1

Slide 1 text

Holly Cummins Senior Principal Software Engineer, Quarkus Devoxx UK May 9, 2025 Efficient Software: A Developer’s Manual for Saving The World

Slide 2

Slide 2 text

@holly_cummins #RedHat software that does less efficient software?

Slide 3

Slide 3 text

@holly_cummins #RedHat

Slide 4

Slide 4 text

@holly_cummins #RedHat software that does what you need needed with fewer resources efficient software:

Slide 5

Slide 5 text

@holly_cummins #RedHat software that does less of what you don’t need

Slide 6

Slide 6 text

@holly_cummins #RedHat “Half the money I spend on advertising is wasted; the trouble is I don't know which half.” – John Wanamaker (1838-1922)

Slide 7

Slide 7 text

@holly_cummins #RedHat half the CPU cycles of our apps are wasted; the trouble is we don’t know which half.

Slide 8

Slide 8 text

@holly_cummins #RedHat half the footprint of our apps is wasted; the trouble is we don’t know which half.

Slide 9

Slide 9 text

@holly_cummins #RedHat no compromise improved efficiency

Slide 10

Slide 10 text

@holly_cummins #RedHat no regrets improved efficiency

Slide 11

Slide 11 text

@holly_cummins #RedHat intel mac vs arm mac example

Slide 12

Slide 12 text

@holly_cummins #RedHat memory cpu network time hardware mone carbon

Slide 13

Slide 13 text

#RedHat @hollycummins.com cost benefits of efficiency user experience saving the world

Slide 14

Slide 14 text

#RedHat @hollycummins.com 100 ms latency on page load 7% lower conversion rate

Slide 15

Slide 15 text

@holly_cummins #RedHat https://blog.linkedin.com/2017/august/3/making-linkedin-more-accessible-via-linkedin-lite modern web is so inefficient it is useless for part of its audience “my heart sank … our new feature failed to load because of poor internet connectivity” Nashik

Slide 16

Slide 16 text

#RedHat @hollycummins.com €12,000 saved by one script for shutting down a school’s computers overnight

Slide 17

Slide 17 text

#RedHat @hollycummins.com ⅔ fewer cloud instances by switching to quarkus

Slide 18

Slide 18 text

#RedHat @hollycummins.com

Slide 19

Slide 19 text

@holly_cummins #RedHat Sources: https://www.greenit.fr/wp-content/uploads/2019/11/GREENIT_EENM_etude_EN_accessible.pdf https://ourworldindata.org/ghg-emissions-by-sector the digital world creates more carbon emissions than aviation

Slide 20

Slide 20 text

@holly_cummins #RedHat Lighter area represents high and low estimates, where available. Sources: https://www.iea.org/fuels-and-technologies/data-centres-networks https://ourworldindata.org/grapher/electricity-demand?tab=table&country=USA~GBR~FRA~DEU~IND~BRA data centres use as much electricity as a medium country

Slide 21

Slide 21 text

#RedHat @hollycummins.com

Slide 22

Slide 22 text

#RedHat @hollycummins.com it’s not just electricity it’s water it’s e-waste it’s embodied carbon

Slide 23

Slide 23 text

#RedHat @hollycummins.com why not fix all this?

Slide 24

Slide 24 text

#RedHat @hollycummins.com yes plz, how?

Slide 25

Slide 25 text

@holly_cummins #RedHat performance engineering finops code ops how it’s used

Slide 26

Slide 26 text

@holly_cummins #RedHat stack code zombies ops algorithms elasticity + provisioning

Slide 27

Slide 27 text

@holly_cummins #RedHat stack code zombies ops algorithms elasticity + provisioning

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

@holly_cummins #RedHat

Slide 30

Slide 30 text

energy efficiency of programming languages

Slide 31

Slide 31 text

@holly_cummins rust is hard no compromise

Slide 32

Slide 32 text

quarkus no compromise

Slide 33

Slide 33 text

@holly_cummins #RedHat java application frameworks needed dynamic dependencies the distant past

Slide 34

Slide 34 text

@holly_cummins #RedHat cloud apps are immutable now

Slide 35

Slide 35 text

@holly_cummins #RedHat a highly dynamic runtime in a container is pointless

Slide 36

Slide 36 text

@holly_cummins Java dynamism @ @ packaging (maven, gradle…) build time runtime ready to do work! load and parse • config files • properties • yaml • xml • etc. • classpath scanning and annotation discovery • attempt to load class to enable/disable features build a metamodel of the world start • thread pools • I/O • etc.

Slide 37

Slide 37 text

@holly_cummins what if we start the application more than once? @ @ @ @ @ @ @ @ so much work gets redone every time

Slide 38

Slide 38 text

@holly_cummins Hibernate speed example: JTA auto-wiring Class.forName(“LikelyJTAImplementation”); Class.forName(“APossibleJTAImplementation”); Class.forName(“AnotherJTAImplementation”); Class.forName(“NicheJTAImplementation”); Class.forName(“VeryNicheJTAImplementation”); … ~129 auto-wiring attempts every single start. ClassNotFoundException

Slide 39

Slide 39 text

@holly_cummins unused implementation the one we want interface megamorphic call slow dispatching unused implementation unused implementation the true cost of loaded classes isn’t just memory + start time method dispatching:

Slide 40

Slide 40 text

@holly_cummins the true cost of loaded classes isn’t just memory + start time the one we want monomorphic call fast dispatching interface

Slide 41

Slide 41 text

@holly_cummins how do we fix all this?

Slide 42

Slide 42 text

@holly_cummins @ @ build time runtime ready to do work! start • thread pools • I/O • etc. what if we initialize at build time?

Slide 43

Slide 43 text

@holly_cummins @ @ repeated starts are now efficient less wasted work

Slide 44

Slide 44 text

@holly_cummins #RedHat https://medium.com/arconsis/spring-boot-vs-quarkus-part-2-jvm-runtime-performance-af45d0db116e spring boot quarkus response time 1901 ms 294 ms throughput 523 req/s 3374 req/s

Slide 45

Slide 45 text

@holly_cummins #RedHat density 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 46

Slide 46 text

@holly_cummins #RedHat stack code zombies ops algorithms elasticity + provisioning

Slide 47

Slide 47 text

@holly_cummins #RedHat measure, don’t guess. first step of performance optimisation

Slide 48

Slide 48 text

@holly_cummins #RedHat but measuring can be expensive - measure more often - measure proxies (with caution)

Slide 49

Slide 49 text

@holly_cummins #RedHat but measuring can be scary - make sure you’re measuring the right thing - be cautious with micro-benchmarks

Slide 50

Slide 50 text

@holly-cummins.bsky.social make sure to measure the big picture before micro-optimizing the small picture

Slide 51

Slide 51 text

@holly_cummins #RedHat wrong measurement de-optimising doing nothing

Slide 52

Slide 52 text

@holly_cummins #RedHat monitor profile analyze tune + apply source: Monica Beckwith

Slide 53

Slide 53 text

@holly-cummins.bsky.social profile shave shave profile shave profile shave profile shave profile shave profile

Slide 54

Slide 54 text

#Quarkus @holly_cummins method profiler GC analysis heap analysis APM distributed tracing Mission Control flame graphs GCMV New Relic* AppDynamics* Micrometer OpenTelemetry 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)

Slide 55

Slide 55 text

#Quarkus @holly_cummins is there a shortcut?

Slide 56

Slide 56 text

@holly_cummins #RedHat

Slide 57

Slide 57 text

@holly_cummins #RedHat

Slide 58

Slide 58 text

@holly_cummins the vrroooom model but what about saving the world?

Slide 59

Slide 59 text

@holly_cummins naming is the hardest problem in computer science invented by Dr. Vroom (really!)

Slide 60

Slide 60 text

@holly_cummins naming is the hardest problem in computer science

Slide 61

Slide 61 text

@holly_cummins my vrroooom model

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

@holly_cummins #RedHat these two columns are almost the same

Slide 64

Slide 64 text

@holly_cummins #RedHat Energy 1 10 100 Time 1 10 100 the trend line is more or less straight energy efficiency across programming languages Python Rust Java Go

Slide 65

Slide 65 text

case study quarkus

Slide 66

Slide 66 text

@holly_cummins #RedHat Setup: • REST + CRUD • large heap • RAPL energy measurement • multiple instances to support high load Assumptions: • US energy mix Source: John O’Hara climate impact as a function of load wait, what?

Slide 67

Slide 67 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

Slide 68

Slide 68 text

@holly_cummins #RedHat stack code zombies ops algorithms elasticity + provisioning

Slide 69

Slide 69 text

#RedHat @hollycummins.com all the —opses

Slide 70

Slide 70 text

#RedHat @hollycummins.com GreenOps greenops is a mid-sized trilobite (really)

Slide 71

Slide 71 text

#RedHat @hollycummins.com FinOps figuring out who in your company forgot to turn off their cloud

Slide 72

Slide 72 text

@holly_cummins #RedHat application utilisation high utilisation good case over-utilisation very bad case under-utilisation wasteful case

Slide 73

Slide 73 text

@holly_cummins #RedHat application elasticity high utilisation good case scale-up good utilisation scale-down good utilisation @holly_cummins

Slide 74

Slide 74 text

#RedHat @hollycummins.com 29% of servers active <5% of the time https://www.anthesisgroup.com/wp-content/uploads/2019/11/Comatose-Servers-Redux-2017.pdf

Slide 75

Slide 75 text

#RedHat @hollycummins.com the average server: 12 - 18% of capacity 30 - 60 % of maximum power https://www.nrdc.org/sites/default/files/data-center-efficiency-assessment-IB.pdf

Slide 76

Slide 76 text

#RedHat @hollycummins.com backstage.io •cost insights plugin •cloud carbon footprint plugin image credit: RedMonk

Slide 77

Slide 77 text

@holly_cummins #RedHat stack code zombies ops algorithms elasticity + provisioning

Slide 78

Slide 78 text

#RedHat @hollycummins.com Hey boss, I created a Kubernetes cluster. I forgot it for 2 months. … and it’s €1000 a month. 2018

Slide 79

Slide 79 text

#RedHat @hollycummins.com

Slide 80

Slide 80 text

#RedHat @hollycummins.com 30% of servers doing no useful work

Slide 81

Slide 81 text

#RedHat @hollycummins.com zombie “they haven't delivered any information or computing services for six months or more”

Slide 82

Slide 82 text

#RedHat @hollycummins.com “we run this as a batch job on weekends, but the servers stay up all week” “

Slide 83

Slide 83 text

#RedHat @hollycummins.com “we only use this system in UK working hours, but we leave it running 24/7 ” “

Slide 84

Slide 84 text

#RedHat @hollycummins.com $26.6 billion wasted by always-on cloud instances https://www.business2community.com/cloud-computing/overprovisioning-always-on-resources-lead-to-26-6-billion-in-public-cloud-waste-expected-in-2021-02381033 2021 study

Slide 85

Slide 85 text

@hollycummins.com #RedHat ultimate elasticity

Slide 86

Slide 86 text

#RedHat @hollycummins.com we don’t switch the light off because we’re not sure if it will come back on never happens

Slide 87

Slide 87 text

#RedHat @hollycummins.com we don’t switch the server off because we’re not sure if it will come back on happens all the time

Slide 88

Slide 88 text

#RedHat @hollycummins.com we don’t switch the server off because it would be too much work to recreate it happens all the time

Slide 89

Slide 89 text

@hollycummins.com #RedHat turning it off and on again must • be fast • actually work • idempotency • resiliency

Slide 90

Slide 90 text

@hollycummins.com #RedHat LightSwitchOps making turning servers off as safe and easy as turning lights off

Slide 91

Slide 91 text

@hollycummins.com #RedHat step 1: no more scary state

Slide 92

Slide 92 text

#RedHat @hollycummins.com GitOps (infrastructure as code)

Slide 93

Slide 93 text

#RedHat @hollycummins.com kubectl apply -f all-my-cluster/ ansible-playbook stuff.yml spin it down spin it up

Slide 94

Slide 94 text

@hollycummins.com #RedHat step 1: no more scary state step 2: automate, automate

Slide 95

Slide 95 text

zombie reduction does not need to be fancy

Slide 96

Slide 96 text

#RedHat @hollycummins.com scream test

Slide 97

Slide 97 text

#RedHat @hollycummins.com “eco-monkey”

Slide 98

Slide 98 text

@hollycummins.com #RedHat the scream is real this internal server doesn’t seem to have a purpose uh … why did the backbone of a client’s network just vanish? let’s turn it off! oops.

Slide 99

Slide 99 text

#RedHat @hollycummins.com large UK bank, 2013 50% reduction in CPUs with a lease system self-destructing instances

Slide 100

Slide 100 text

@hollycummins.com #RedHat timed shutoff we used to leave our applications running all the time when we scripted turning them off at night, we reduced our cloud bill by 30% @darkandnerdy, Chicago DevOpsDays

Slide 101

Slide 101 text

@hollycummins.com #RedHat fancier scripts … with a frontend and a backend

Slide 102

Slide 102 text

@hollycummins.com #RedHat quarkus

Slide 103

Slide 103 text

@holly_cummins #RedHat what problem are we trying to solve?

Slide 104

Slide 104 text

@holly_cummins #RedHat define SLA performance engineering basics define success

Slide 105

Slide 105 text

@holly_cummins #RedHat resources are always limited we all have too much to do

Slide 106

Slide 106 text

@holly_cummins #RedHat - 99% of requests under 100ms - can run on t2.micro instance - cost per transaction < £0.02 - save the world example SLAs ?

Slide 107

Slide 107 text

@holly_cummins #RedHat diminishing returns effort amount of world-saving low-hanging fruit wringing performance out of a stone hard work stop here?

Slide 108

Slide 108 text

@holly_cummins #RedHat return on investment time money saved by the fix less money spent on the fix winning financial ruin stop here?

Slide 109

Slide 109 text

@holly_cummins #RedHat tl;dpa (too long; didn’t pay attention) efficient code is good for users, good for business, and good for the world choose an efficient stack (such as quarkus!) measure, profile, and optimise your code to get rid of waste think about how you provision: is it elastic? have you got zombies? flamethrower them!

Slide 110

Slide 110 text

slides @hollycummins.com