Upgrade to Pro — share decks privately, control downloads, hide ads and more …

These Five Tricks Can Make Your Apps Greener, C...

These Five Tricks Can Make Your Apps Greener, Cheaper, & Nicer

The code we write has a climate impact. But how big is that impact? How do we measure it? How do we reduce it? Is the cloud helping? What’s going on with Virginia? Are we still allowed to do CI/CD? Will native compilation save us? Is Java even a good choice anymore? This talk discusses some of the trade-offs for a modern software developer, and provides a roadmap to figuring out the right thing.

Disclosure: Holly works on Quarkus. Along the way, she will talk about Quarkus sustainability measurements we’ve been doing … but it’s ok, because she promises that the Quarkus carbon data is exciting and interesting.

Holly Cummins

June 21, 2023
Tweet

More Decks by Holly Cummins

Other Decks in Programming

Transcript

  1. Holly Cummins Senior Principal Software Engineer, Quarkus J-Spring June 21,

    2023 @[email protected] these five tricks can make your Java apps greener cheaper & nicer
  2. @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
  3. @holly_cummins #RedHat algorithms carbon awareness green software foundation: principles hardware

    efficiency electricity efficiency where when elasticity utilisation
  4. @holly_cummins #RedHat algorithms stack carbon awareness green software foundation: principles

    hardware efficiency electricity efficiency where when elasticity utilisation
  5. @holly_cummins #RedHat algorithms stack carbon awareness hardware efficiency electricity efficiency

    where when elasticity utilisation green software foundation: principles
  6. @holly_cummins #RedHat step 1: measure power usage wall power measurement

    more complete needs access to the wall RAPL programmatically accessible
  7. @holly_cummins #RedHat step 1: measure power usage wall power measurement

    more complete needs access to the wall RAPL programmatically accessible misses some components
  8. @holly_cummins #RedHat step 1: measure power usage wall power measurement

    more complete needs access to the wall data costs carbon RAPL programmatically accessible misses some components
  9. @holly_cummins #RedHat published energy mixes … but methodologies are not

    open … or consistent (these are made-up energy mixes)
  10. @holly_cummins #RedHat reducing your cloud spend (probably) reducing your carbon

    footprint* hardware spend electricity bill * if you keep other factors the same
  11. @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
  12. @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
  13. @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 economic model in action: the cost and carbon metrics are (roughly) the same
  14. @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
  15. @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 vrrrooom model in action: quarkus on JVM has the smallest footprint … because it has the highest throughput
  16. @holly_cummins #RedHat trick 3: use quarkus quarkus ‘automatically’ saves •

    time • money • carbon (~2x) • … even when Spring compatibility libraries are used (almost no code changes except dependencies and tests)
  17. @holly_cummins #RedHat trick 3: use quarkus quarkus ‘automatically’ saves •

    time • money • carbon (~2x) • … even when Spring compatibility libraries are used (almost no code changes except dependencies and tests)
  18. #RedHat @holly_cummins 2017 server-survey 25% doing no useful work (16,000

    sampled) “perhaps someone forgot to turn them off”
  19. @holly_cummins #RedHat cloud elasticity? 2021: $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
  20. @holly_cummins #RedHat achieving elasticity 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
  21. @holly_cummins #RedHat what if … turning applications off was no

    more scary than turning the lights off? ultimate elasticity
  22. @holly_cummins #RedHat turning it off and on again must •

    be fast • actually work • idempotency
  23. @holly_cummins #RedHat turning it off and on again must •

    be fast • actually work • idempotency • resiliency
  24. @holly_cummins #RedHat algorithms stack carbon awareness hardware efficiency electricity efficiency

    where when elasticity utilisation green software foundation: principles
  25. @holly_cummins #RedHat look at the sustainability information before choosing a

    hosting region choose a cloud provider who make this easy
  26. @holly_cummins #RedHat time of day matters • (most) renewables are

    intermittent • if grid load is high, shortfalls are filled by fossil fuels
  27. @holly_cummins #RedHat remember the zombie servers? what else could we

    do with that $26.6 billion of wasted cloud spend? https://www.business2community.com/cloud-computing/overprovisioning-always-on-resources-lead-to-26-6-billion-in-public-cloud-waste-expected-in-2021-02381033
  28. @holly_cummins #RedHat the double-win renewable electricity is 9x cheaper hosting

    in Montreal: 88% less carbon than the same workload in London
  29. @holly_cummins #RedHat the double-win renewable electricity is 9x cheaper hosting

    in Montreal: 88% less carbon than the same workload in London and it’s 15% cheaper
  30. @holly_cummins #RedHat tl;dpa (too long; didn’t pay attention) trick 1:

    the vrrrooooom model says faster is greener trick 2: the economic model says cheaper is greener trick 3: choose a fast and energy-efficient framework (such as quarkus) trick 4: architect to be able to turn stuff off (LightSwitchOps) trick 5: choose your hosting wisely
  31. slides thank you and don’t forget to vote in the

    J-Spring app, which is running on Quarkus :) @[email protected]