Alibaba Dragonwell JDK: Towards a Java Runtime for Cloud Computing - - PowerPoint PPT Presentation

alibaba dragonwell jdk
SMART_READER_LITE
LIVE PREVIEW

Alibaba Dragonwell JDK: Towards a Java Runtime for Cloud Computing - - PowerPoint PPT Presentation

Alibaba Dragonwell JDK: Towards a Java Runtime for Cloud Computing Xiaoming Gu Alibaba JVM Team 1 System Software (OS / JVM / Virtualization) Resource Scheduling / Cluster Management / Container Database / Storage / Middleware / Computing


slide-1
SLIDE 1

Alibaba Dragonwell JDK:

Towards a Java Runtime for Cloud Computing

Xiaoming Gu Alibaba JVM Team

1

slide-2
SLIDE 2

2019 2019

Alibaba Infrastructure

...

System Software (OS / JVM / Virtualization) Resource Scheduling / Cluster Management / Container Database / Storage / Middleware / Computing Platform

2

slide-3
SLIDE 3

2019 2019

Singles’ Day Shopping Festival

3200 14,000 42,000 80,000 140,000 175,000 325,000 1200 3,850 15,000 38,000 86,000 120,000 256,000

50000 100000 150000 200000 250000 300000 350000

2011 2012 2013 2014 2015 2016 2017

Alibaba cloud platform Alibaba payment service

more than 100x in 7 years

Peak #transactions per second

3

slide-4
SLIDE 4

2019 2019

  • A customized downstream of OpenJDK with free LTS
  • https://github.com/alibaba/dragonwell8
  • Preview now and GA soon
  • Will be the recommended JDK on Alibaba Cloud
  • Plan to update in every 3 months

4

slide-5
SLIDE 5

2019 2019

  • Java Flight Recorder (JFR)
  • Low-overhead profiling framework
  • Backported JFR from OpenJDK 11 to Alibaba Dragonwell 8
  • In progress pushing back to OpenJDK 8
  • JWarmUp
  • Reduce startup time by reusing Just-in-Time (JIT) compilation info from

a previous run

  • In progress pushing back to OpenJDK

Key Customizations in Alibaba Dragonwell JDK

5

slide-6
SLIDE 6

2019 2019

  • A challenge in the cloud
  • CPU utilization is high during JVM startup
  • Caused by excessive JIT compilations

AppAOT

6

slide-7
SLIDE 7

2019 2019

  • Ahead-of-Time (AOT) compilation
  • AOT in OpenJDK
  • jaotc --output libHelloWorld.so HelloWorld.class
  • java -XX:AOTLibrary=./libHelloWorld.so HelloWorld
  • CPU utilization by JIT compilations saved
  • Limitation: AOT code loaded when JVM starts

AppAOT

7

slide-8
SLIDE 8

2019 2019

  • Enhanced from AOT: dynamically load/unload AOT code with the

support of custom class loaders

  • Java API
  • AppAOTController.loadAOTLibraryForLoader(ClassLoader loader,

String library)

  • AppAOTController.unloadAOTLibraryForLoader(ClassLoader

loader)

AppAOT

8

slide-9
SLIDE 9

2019 2019

  • Reduce AOT code size
  • Use static analysis to construct call graph
  • Generate compilation method list from call graph

with unreachable methods removed

  • Do AOT compilations for methods on the

compilation method list only

  • Results from an example app
  • 50% reduction on code size
  • 90% of actually executed methods covered

AppAOT

9

app entry y method fo foo::m ::m1 cal call bar: bar::m1 m1 fo foo::m ::m2

Call graph Method list

slide-10
SLIDE 10

2019 2019

  • Use case

AppAOT

10

Co Commo mmon App Pla latform rm

App App 1 (. (.jar) ar) App App 2 2 (. (.jar) ar) App App 3 3 (. (.jar) ar) App App N N (. (.jar) ar)

…… Normal case (with JIT)

slide-11
SLIDE 11

2019 2019

  • Use case

AppAOT

11

Co Commo mmon App Pla latform rm

AOT’ AOT’ed ed Ap App 1 1 (.so so)

……

AOT’ AOT’ed ed Ap App 2 2 (.so so) AOT’ AOT’ed ed Ap App 3 3 (.so so) AOT’ AOT’ed ed Ap App N N (.so so)

With AppAOT

slide-12
SLIDE 12

2019 2019

  • Results

AppAOT

12

20 20 40 40 60 60 80 80 10 100 12 120

1 5 9 13 13 17 17 21 21 25 25 29 29 33 33 37 37 41 41 45 45 49 49 53 53 57 57 61 61 65 65 69 69 73 73 77 77 81 81 85 85 89 89 93 93 97 97 101 101 105 105 109 109 113 113 117 117 121 121 125 125 129 129 133 133 137 137 141 141 145 145 149 149 153 153 157 157 161 161 165 165 169 169 173 173 177 177 181 181 185 185 189 189 193 193 197 197 201 201 205 205 209 209 213 213 217 217 221 221 225 225 229 229 233 233

CPU utilization CPU utilization

aot_tiered jit

AppAO AppAOT use ses s less ss CPU at app st startup time Peak k performance of AppAO AppAOT is s si similar to JI JIT

—— —— Ap AppAO AOT —— —— JI JIT

slide-13
SLIDE 13

2019 2019

  • Multiple Java applications running on the same host together
  • Memory is a shared resource
  • Memory consumption changes along running
  • Dynamically resize heap on demand

Elastic Heap

13

slide-14
SLIDE 14

2019 2019

  • Garbage collection (GC)
  • Automatic memory management on heap
  • Reclaim the space occupied by dead objects
  • Intuition
  • Increase heap size when GC happens more
  • Decrease heap size with GC happens less

Elastic Heap

14

slide-15
SLIDE 15

2019 2019

  • Use case

Elastic Heap

15

  • nline service with

higher memory pressure

  • ffline service with

lower memory pressure

before midnght

  • nl
  • nline

ne se servi vice

  • f
  • ffline

ne se servi vice

before traffic peak

  • nl
  • nline

ne se servi vice

  • f
  • ffline

ne se servi vice

shortly after traffic peak

slide-16
SLIDE 16

2019 2019

Elastic Heap

16

  • nline service with

lower memory pressure

  • ffline service with

higher memory pressure

before midnght

  • nl
  • nline

ne se servi vice

  • f
  • ffline

ne se servi vice

after traffic peak for a while

  • nl
  • nline

ne se servi vice

  • f
  • ffline

ne se servi vice

shortly after traffic peak

slide-17
SLIDE 17

2019 2019

  • Results from an online service

Elastic Heap

17

CPU utilization Memory usage

traffic peak starts traffic peak ends acquire memory from OS return memory back to OS

time

slide-18
SLIDE 18

2019 2019

  • Both OpenJDK and our solution are based on Garbage-First (G1) GC
  • The solution in OpenJDK is for full GC and concurrent cycle only
  • Young GC is covered in our solution
  • Heap resizing is more prompt because Young GC happens more

frequently

  • Heap resizing is concurrent

Elastic Heap

18

slide-19
SLIDE 19

2019 2019

  • Challenges in the cloud
  • Excessive CPU utilization caused by JIT compilations
  • AppAOT
  • Better memory sharing across JVM instances on the same host
  • Elastic heap

Summary

19

slide-20
SLIDE 20

Q & A

20