Author: Karsten Silz
Sep 3, 2023   |  updated Oct 4, 2023 7 min read

Permalink: https://betterprojectsfaster.com/learn/talks-jax-london-2023-native-java-worthwhile/

JAX London 2023: "When Is Native Java With GraalVM Worthwhile for Me?"

JAX London logo

Summary

  • For most users, native Java is not worthwhile right now.
  • Java is more expensive because Tuned for Long-Lived big applications.
  • Java’s new competition is Javascript & Python.
  • We can make Java cheaper: with CDS, CRaC, and GraalVM.
  • GraalVM gives us faster start, less memory, smaller Files, and better security.
  • In my sample application, going from Spring Boot 2.7 to Quarkus 3 reduced the startup time from 589 ms to 10.4 ms and the initial memory allocation from 107 MB to 5.6 MB.
  • I only recommend GraalVM for microservices, not for monoliths or serverless.

Please see my slides for why I came to this conclusion.

Information additional to the slides is below.

And here’s how to get started with native Java:

Table Of Contents

Logistics

Conference

JAX Londond 2023 is the second-largest Java conference in the UK and a hybrid conference. It will run October 2-5, 2023.

You can buy a ticket here:

Talk

My talk will be on October 4, 2023, at 11:45.

Abstract

Many Java apps are migrating to the cloud. Yet, on the cloud, Java is frequently more expensive than alternatives such as Go. Native Java using the static GraalVM Native Image AOT (Ahead-of-Time) compiler reduces the cost of Java. Native Java became popular because frameworks such as Quarkus and Micronaut, and Spring Boot 3.0 provided it a significant boost. Do I have to learn a new framework, such as Quarkus or Micronaut? How does native Java function? And when will it be worthwhile for me to learn native Java? These are the topics of my presentation.

Who Made Me the Expert?

In the spring of 2022, I was the editor of a highly popular, six-part article series about native Java on InfoQ. I have data to back up my claims. And Java experts helped me.

Unlike some other talks which are either pro or against GraalVM Native Image, I’m neutral on it. I’m the Switzerland of GraalVM talks! Which is quite fitting, as my current project is in Switzerland! 😃 I’m not selling books or training courses, and I’m not a developer advocate. I share my experiences and my knowledge so you can do get better projects faster!




Java Tech Popularity Index Q4/2023:
Developer job ads dipped 30% in 2023. Monthly Stack Overflow questions dropped 42% since ChatGPT, with JavaScript at -56% and Python at -59%. Since June 22, Udemy's first-time Python course purchases have outpaced Java's 7.1 million to 2 million. Job ads for Quarkus and Micronaut continue to rebound.

See All Issues & Subscribe



Slides

Here are the slides as PDF. They have more content and more text than my talking slides. They are just 1.3 MB:

You can also get the slides in their original Keynote format. “Keynote” is Apple’s presentation application. Why would you do that? My slides have less text than the PDF version, so you can see what I cut. I also animated the slides, so they are more pleasant to watch. Or maybe you want to peek under the hood to see how I achieved specific effects. The slides also have fewer words than the PDF ones - it’s a talk, not a read! But they do have speaker notes. These slides are a whoppin’ 36.7 MB.

Get Started With Native Java

Here’s my page for getting started with native Java.

  • It tells you how to install the tools for Spring Boot 3 and Quarkus and how to build native executables.
  • It explains in more detail how Java works and how GraalVM works.

Additional Talk Information

Popularity of JavaScript & Python

My “Java Tech Popularity Index Q3/2023” includes popularity data for JVM languages and its competitors. The data for job ads and Udemy purchases is from there. Here are the Google Searches and Stack Overflow questions.

Google Searches

Google Trends demonstrates the initial interest in a technology over time (chart link). “More searches = better” to me. The percentage behind the current value is the drop-off from the peak value, marked with a circle.

Here are searches for the languages that compete with the JVM (chart link):

Google Trends for C#, Go, Java, JavaScript, and Python
Google Trends for C#, Go, Java, JavaScript, and Python

Here are the same JVM competitors over the last three years:

Google Trends for Clojure, Groovy, Kotlin, Scala
Google Trends for Clojure, Groovy, Kotlin, Scala

This link produces the chart above.

Python wins, JavaScript is second, Java is third, C# is fourth, and Go is fifth. All languages have declined since early to mid-2022. Python has grown about 18% over the last three years but only leads JavaScript 1.4:1. After being neck-to-neck with Java, JavaScript is now slightly ahead. C# has only 37% of JavaScript’s search volume and hasn’t gained share in the last three years. Go gained slightly against C#.

Stack Overflow Questions

Monthly Questions at Stack Overflow

We can run database queries against the questions, answers, and comments at Stack Overflow with the StackExchange Data Explorer. The number of monthly questions is a proxy for using a technology during evaluation and productive use. “More questions = better” to me. The percentage behind the current value is the drop-off from the peak value, marked with a circle.

Here are the shares of questions for the languages that compete with the JVM:

Questions at Stack Overflow for C#, Go, Java, JavaScript, Python, and TypeScript
Questions at Stack Overflow for C#, Go, Java, JavaScript, Python, and TypeScript

Python wins, JavaScript is second, Java third, C# is fourth, TypeScript fifth, and Go is sixth. This is a chart of significant decline: Python, JavaScript, and Java have declined massively and in sync since early 2020. Python still leads JavaScript 1.5:1 but has only 39% of its peak value from early 2020. It has lost 49% since November 2022. At 33% of its 2016 peak, JavaScript leads Java 1.7:1. It also lost 49%, but since August 2022. C# has gained on Java since 2022 and has 83% of Java’s questions. TypeScript’s seven-year rise ended mid-2022, leaving it at two-thirds of Java’s questions. Go has been low and steady for about seven years, leading only to 11% of Java’s numbers.

Please note that the overall monthly number of Stack Overflow questions is down 42% since ChatGPT appeared (November 2022 vs. August 2023):

Monthly Questions at Stack Overflow
Monthly Questions at Stack Overflow

You can run the queries below at the StackExchange Data Explorer. I used two queries to get the number of monthly questions for the JVM competitors because putting all in one query timed out.

(Click to expand) Query: Java, JavaScript, and TypeScript
DECLARE @StartDate DATE = '2009-01-01';
DECLARE @EndDate DATE = '2023-06-30';

WITH Tagged AS (
  SELECT
    Id,
    CreationDate,
    CASE WHEN CHARINDEX('<java>', Tags) > 0 THEN 1 ELSE 0 END AS JavaTag,
    CASE WHEN CHARINDEX('<javascript>', Tags) > 0 THEN 1 ELSE 0 END AS JavascriptTag,
    CASE WHEN CHARINDEX('<typescript>', Tags) > 0 THEN 1 ELSE 0 END AS TypeScriptTag

  FROM Posts
  WHERE
    PostTypeId = 1 AND -- 1 for 
    CreationDate >= @StartDate AND
    CreationDate <= @EndDate
),
MonthlyCounts AS (
  SELECT
    DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS Month,
    SUM(JavaTag) AS Java,
    SUM(JavascriptTag) AS Javascript,
    SUM(TypeScriptTag) AS TypeScript
  FROM Tagged
  GROUP BY DATEADD(month, DATEDIFF(month, 0, CreationDate), 0)
)
SELECT
  Month,
  Java,
  Javascript,
  TypeScript
FROM MonthlyCounts
ORDER BY Month;
(Click to expand) Query: C#, Go, and Python
DECLARE @StartDate DATE = '2009-01-01';
DECLARE @EndDate DATE = '2023-06-30';

WITH Tagged AS (
  SELECT
    Id,
    CreationDate,
    CASE WHEN CHARINDEX('<c#>', Tags) > 0 THEN 1 ELSE 0 END AS CsharpTag,
    CASE WHEN CHARINDEX('<go>', Tags) > 0 THEN 1 ELSE 0 END AS GoLangTag,
    CASE WHEN CHARINDEX('<python>', Tags) > 0 THEN 1 ELSE 0 END AS PythonTag

  FROM Posts
  WHERE
    PostTypeId = 1 AND -- 1 for 
    CreationDate >= @StartDate AND
    CreationDate <= @EndDate
),
MonthlyCounts AS (
  SELECT
    DATEADD(month, DATEDIFF(month, 0, CreationDate), 0) AS Month,
    SUM(CsharpTag) AS Csharp,
    SUM(GoLangTag) AS GoLang,
    SUM(PythonTag) AS Python
  FROM Tagged
  GROUP BY DATEADD(month, DATEDIFF(month, 0, CreationDate), 0)
)
SELECT
  Month,
  Csharp,
  GoLang,
  Python
FROM MonthlyCounts
ORDER BY Month;

CDS

Please see the section below for details on starting with Class Data Sharing.

CRaC

My InfoQ news item has details on CRaC and an interview with Simon Ritter from Azul, the driving force behind CRaC. Please also see the section below for details on CRaC.

GraalVM

Here is the announcement of Oracle GraalVM for Java 21. The release was September 19, 2023, the same day that Java 21 got released.

Demo Application

The demo application converts images to PDFs. It’s available for Spring Boot 2 & 3, Quarkus, and Go. Check it out below.

Java in Serverless

Here’s Holly Cummins during her Devoxx UK 2023 keynote, citing the serverless market share statistics:


Part 25 of 25 in the Conference Talks series.
JAX 2023: "When Is Native Java With GraalVM Worthwhile for Me?" » | Start: Java Forum Stuttgart 2019: "When Using the Application Generator Jhipster Is Worth It - and When Not"

Java Tech Popularity Index Q4/2023:
Developer job ads dipped 30% in 2023. Monthly Stack Overflow questions dropped 42% since ChatGPT, with JavaScript at -56% and Python at -59%. Since June 22, Udemy's first-time Python course purchases have outpaced Java's 7.1 million to 2 million. Job ads for Quarkus and Micronaut continue to rebound.

Read my newsletter


comments powered by Disqus