JavaLand 2024: Application Development Green Masterplan

miragemiko 148 views 33 slides Jun 16, 2024
Slide 1
Slide 1 of 33
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33

About This Presentation

My presentation slides I used at JavaLand 2024


Slide Content

Source: marvel
In 2008 Tony Stark introduced…
ARC fusion reactor
Affordable
Robust
Compact
MIT continues research

https://www.hippopx.com/en/download/85850-3840x2160-900aaa051012883e7e1d77b1964e206c

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
?