Miroslav Wengner
Green Masterplan
Application development
Miroslav Wengner
•Husband, Father, Software Engineer, Author, Blogger, Technology Enthusiast
•Book Author: Practical Design Patterns for Java Developers [Packt]
•OpenJDK Committer, OpenSource projects contributor, Ex JCP Executive Committee
•Co-Author of Robo4J Project (Duke Award)
•Java Champion, JavaOne RockStar
•Principal Engineer at OpenValue
Safe Harbor Statement
All what you will hear can be different, this presentation is for
motivational purposes …
Agenda
•History and Evolution
•Industrial Revolution
•Green Initiatives and Energy
•Energy Consumption in action
•Conclusion
•Q/A
Mechanical
The ability to make tools
became commonplace
Electrical
Source: https://en.wikipedia.org/
Mechanical
may have a Similar Dominators
Electrical
Source: https://en.wikipedia.org/
effective resources
usage per unit
Data Centers
Software
How did we got there ?
Industrial Revolution: timeline
?
Source: https://en.wikipedia.org/
Phase 1.
Steam Engines
Factories
Textile Machinery
small spot
18th 19th 20th 21st
Phase 2.
Logical Systems
Electrification
Assembly lines
Bigger Scale
expanding spots
Phase 3.
Transistor
Optical Amplifier
Computers
Internet
Digital information at the large scale
Internet of Things
Cloud Computing
Artificial Intelligence
Machine to Machine communication
connecting spots
Industrial Revolution
?
impact ?
Industrial Revolution
?
Source: https://en.wikipedia.org/
Sea level has risen about 250 mm
Annual Surface temperature has risen about 1,5 Celsius
…Past is knocking
Industrial Revolution: connected spots
Laptops, Desktops, IoT Devices, Cars, Smart Houses, AI
Servers, Virtual Machines, Clouds Provides
Energy resources for SOFTWARE ware taken as granted ?
taken out of the equation ?
SEEMS POSITIVE
Energy: Data Centers
•Globally, by 2025, they are projected to consume 20% of global electricity
and emit up to 5.5% of the world's carbon emissions.
•significant part of the energy consumed is transformed into:
•heat may reduce a system reliability
•life expectancy of devices
•escalation in cooling requirements
•Virtual Machines may run Idle (maybe 40->80%)
Initiatives: Green Software Foundation
Software Carbon Intensity
E: Energy consumed by software in kWh
I: Carbon emitted by kWh of energy,
M: Carbon emitted through the hardware
R: Scaling factor
what about the real emissions ?
Energy: Software industry impact
Scope 1+2 : own operations
Scope 3: broader value chain contains customers, suppliers
Green Initiatives: take aways
1.Carbon Efficiency implies cost reductions (not surprise)
2.Green Software Development helps introduce coding best practices (?)
different understanding business vs. nature
3.Shape demand for application development - better forecasting
4.Reduce carbon emissions
5.Increase lifecycle and usefulness of hardware and servers
Sustainability
Green Initiatives: take aways
1. Software Industry should take a RESPONSIBILITY and accept challenges
Only One Planet to Sustain
Energy as a good PROXY to emissions footprints
Energy Consumption: how to …
1.precisely define a task constrains
2.select tools
3.fairly measure
4.design process
5.undestand a data
Task
Watt
Measurement
Time t_x
Performed action
Execution Time T_ex
Energy_Time T_en
Driving Idea
Energy Consumption: selecting tools
?
for i in range(range_max):
if is_prime(i) :
found_primes += 1
Python
for (int i = 2; i < range_max; i++) {
if(is_prime(i)){
found_primes++;
};
}
C
for (var i = 0; i < range_max; i++) {
if(isPrime(i)){
foundPrimes++;
}
}
JavaScript
for (int j = interval.start; j < interval.stop ; j++) {
if (isPrime(j)) {
foundPrimes.incrementAndGet();
}
}
Java
How to Repeat ?
Execution TOOLS:
•shell script - PID
•Tinytuya framework
?
… AUTOMATION …
Energy Consumption: fair measurements
?
Energy Consumption: measure fairly
Energy Consumption: measure fairly
Simple ideas could become complicated … AUTOMATION… rock it !
Measure IDLE state to normalize results
Energy Consumption: action
Selected Platforms
1.Java: OpenJDK, Zulu ver17, 21
2.C: gcc 12
3.Node 20
4.Python 3.11
Hardware
1.Raspberry PI 4 : 4c
2.Linux Intel i7 : 4c
3.MBP i7 : 4c and 6c
4.MBP : M1 Max, M2 Max
Calculated: Mean Value (MV), Standard Deviation (SD), Standard Error of Mean (SEM)
Energy Consumption: data
?
Task: Find Prime Numbers
Range: from 0 to 200 000 000, repeat 15 times
Watt Measurement: Idle State, Automatically calculated time window ( probes )
Java code is design with minimal heap usage
Task Duration varies
Some languages show significant energy consumption increment
Energy Consumption: kWatt/Task
?
Energy Consumption: kWatt/Task
?
Energy Consumption Standard Error of Mean (SEM) = 2,95 %
Energy Consumption: understanding data
?
MacBookPro 2019, Intel i7, 6 cores
MacBookPro M2 Max
best execution cca. 5 times slower
cca. 24 times lower Energy consumption
Energy Consumption: understanding data
?
Difference between ARM and Intel architecture
Conclusion
?
•Who: Software Companies
•Managers, Devs, Ops
•What: should take a responsibility
•Why: CO2 footprint
Conclusion
?
•contribution to Green Masterplan:
•platform selection
•application design
•each executed instruction may contributes to CO2 emission
•extended tooling
•coding style and patterns
Book Author: Practical Design Patterns for Java Developers [Packt]
•controlled, not overused parallelism matters
•hardware may be good enough => usefulness
Thank YOU !
twitter: @miragemiko
github:@mirage22
email: [email protected]
Resources
•Energy-efficiency and sustainability in new generation cloud computing:
A vision and directions for integrated management of data centre
resources and workloads : https://doi.org/10.1002/spe.3248
•TechMonitor: https://techmonitor.ai/focus/tech-industry-carbon-emissions-
progress
•Climate Change: Atmospheric Carbon Dioxide: https://www.climate.gov/
•Green Software Foundation: https://greensoftware.foundation/
•Energy Efficiency of Programming Languages on Arm and Intel: https://
openvalue.blog
?