Aspiring Speakers Lightning Talk: "Why Is Java in the Cloud So Expensive – And How Can I Make It Cheaper?"
Summary
- Java was expensive: it used more RAM & CPU time than JavaScript or Go.
- That mattered to you because JavaScript & Python were competition.
- You could make Java cheaper with Class Sharing, CRaC, and GraalVM Native Image.
My slides showed why I came to this conclusion.
Talk
The Aspiring Speakers regularly hosted online lightning talks. I gave a talk there on Tuesday, September 5, 2023, about “Why Is Java in the Cloud So Expensive – And How Can I Make It Cheaper?”.
Slides
The slides were available as a PDF (202 KB):
Historical note (as of September 2023): Back then, the slides were also available in their original Keynote format (3.5 MB) — with less text, but animated; that file is no longer available today.
Get Started With Native Java
My guide to getting started with native Java explained how to install the tools for Spring Boot 3 and Quarkus, how to build native executables, and went into more detail on how Java and GraalVM worked.
Historical note (as of September 2023): The guide was slightly out of date at the time because it didn’t yet cover the latest GraalVM release. My InfoQ news item about the GraalVM release current at the time — including an interview with Alina Yurenko, developer advocate for GraalVM at Oracle Labs — filled that gap.
Additional Talk Information
Class Sharing
Class Sharing for OpenJDK 17 was documented here. It came down to three steps:
- Create class list: You created a class list with
-Xshare:offand-XX:DumpLoadedClassList=hello.classlist. This did not run your program, it just created the list.
java -Xshare:off -XX:DumpLoadedClassList=hello.classlist -cp hello.jar
- Create static archive: You then turned the class list into a static class archive.
java -Xshare:dump -XX:SharedArchiveFile=hello.jsa -XX:SharedClassListFile=hello.classlist -cp hello.jar
- Run with static archive: Your application could then use the static archive at runtime.
java -XX:SharedArchiveFile=hello.jsa -cp hello.jar
CRaC
My InfoQ news item about CRaC — with an interview with Simon Ritter, the driving force behind CRaC — explained how to get started.
GraalVM Native Image
I measured the GraalVM Native Image improvements in startup time and memory consumption with a demo app I wrote. The demo application converted images to PDFs. It was available for Spring Boot 2 & 3, Quarkus, and Go.