[QCon 2019] Maximizing Performance with GraalVM

Thomas Wuerthinger 

For other QCon blog posts, see QCon live blog table of contents

Tradeoff between what factors optimized

  • Startup time
  • Peak throughput
  • Memory footprint
  • Maximizing request latency
  • Packaging size (matters for mobile)
  • Can usually optimize a few (but not all) of these


  • Supports JVM languages, Rubby, Python, C, Rust, R etc
  • Can embed in node js, oracle database
  • Standalone binary
  • Community Edition and Enterprise Edition
  • Can run with Open JDK using Graal JIT compiler or AOT (ahead of time compiling)


  • To use, create new binary with pre-compiled code
  • Package classes from app, libraries used and part of the VM
  • Iterate adding things until know what need. Then create native executable.
  • Uses an order of magnitude less memory than JIT. Saving memory helps when running on AWS Lambda
  • CPU usage a lot less up front. Small peak at startup
  • JIT compiler has profiling feedback so can do better in the long run. AOT has PGO (profile guided optimizations) to deal with this
  • Working on improving – collecting profiles up front, low latency GC option and tracing agent to facilitate configuration


  • Startup time (from start until first request can be served). Two orders of magnitude faster with AOT
  • Starting up in less than 50 milliseconds allows spinning up new process upon request
  • Hard to measure. Can be lucky/unlucky when get data.
  • JIT has an advantage for peak performance. It has profiling data and can make optimistic assumptions. If the assumption not true, can de-optimize/bail out of optimization.


  • Benchmarks are good. Should have more
  • Optimizing on too few benchmarks is like overfitting on machine learning
  • http://renaissance.dev/ – benchmark suite. Includes Scala and less commonly tested


  • GraalVM JIT – when need peak throughput, max latency and no config
  • GraalVM AOT – use when need fast startup time, small memory footprint and small packaging size

Recommends reading top 10 things to do with GraalVM


  • Have you considered using Epsilon in benchmark? Not yet. Makes sense since doesn’t do any GC
  • Why not use parallel GC? Not sure if it would make a difference. Kirk noted would avoid allocation hit over G1.
  • Does AOT make sense for large heaps? Can make sure don’t have disadvantage at least.

My impressions

I had heard about Graal and forgotten a lot. I re-learned much. I like the list of steps slides and the diagram. I feel like it will be more memorable this time. I also liked the comparison at the end on impact of the dimensions covered up front.

JavaOne – you got your browser in my virual machine

“You got your Browser in my virtual mchine! Leveraging sophisticated browser programming modes in your Java applicaion”

Speaker: Ean Schuseller

For more blog posts from JavaOne, see the table of contents

He started by showing a video of the Sophia (and Einstein) robots. They look surpisingly humanoid. Not the video but this is the robot. Relevant in that we need better interfaces than have now. Future: “that was the best customer service person; very patient and immune to me getting angry”

Web Extensions

  • Plugin for browser
  • Needed to use C in the past
  • Browser agnostic APIs
  • Write in JavaScript
  • Have access to browser components like history and open pages
  • Works on Firefox, Chrome, Opera and Edge. Works a bit different on Edge” [not safari yet]
  • Contains manifest.json, html and javascript code for UI, background js (runs when browser opens and state stays until close browser) and content js (what see)

Isomorphic Apps

  • Code that can run on both client and server
  • Ex: Validation logic, business logic

JavaScript in your server
Nashorn is faster in Java 9
[glad I wrote the “throwaway” chapter on Nashorn for our book. Learned a lot]


  • WebWorkers –
    Don’t want intensive logic in main UI thread. WebWorker runs message/task in background.
  • indexedDB transactional persistent data store

It takes a lot to get users to install an app because of trust. Web/online mobile “apps” continue to grow as get more powerful. Will need to have reall good reason to have an app. [irony wih the JavaOne conference app?]

Evolution in JavaScript
Frameworks, immutables reactive, functional programming, etc. Lots of ibraries. Now that more mature, Java can cherry pick from JavaScript.


    React – UI model from Facebook. Very data intensive programming
  • Reducers – Virtual DOM is rerendered based on state change and then diffed against real DOM
  • Redux – extends to single immmutable state. reducer functions “modify” state
  • Helps debugging/testing because can replay actions from older state. Also helps with undo because can just go back a few states

Filter Bubble

  • Cognitive bias from friends, reading, etc. Disagreeable facts never reach us
  • Social networks and search enginges feed us information they think we will like. Not even concious of the bias. Disparity – they know more than you about what you see
  • You trust your spam filter – it controls whether you see a message
  • Filter Bubble web extension – determines where you spend time so you know too. Uses word frequency analysis

My take: Nice to see Oracle is open minded about having JavaScript content at JavaOne. There was even a bit of Java in this talk. Good first session. A mix of things that I didn’t know, things that I knew at one point and forgot. Plus some things I know. Happy to start the day with learning!

running chromium os on the mac on virtualbox

Now that the Chromebook is out and I’ve speculated about the target audience, I wanted to give running the Google OS a shot.  The closest I know that you can get is running Chronium OS which is the open source version.

The VM

This is the first time I needed a virtual machine on my mac.  I decided to start with VirtualBox since it is free for personal use.  It met my needs, so I’m done.  I should try Fusion at some point, but I didn’t need it for this.  I started by downloading the 82MB download for VirtualBox.

Setting up the VM

Since the “versioned” copy only provides a VM Ware and USB stick image, I tried following the instructions to convert the USB image to a vgi virtualbox file.  (The USB download is 324 MB.)  Launching the VM that way just gave me a black screen.

Next I tried getting the nightly snapshot build for VirtualBox from the “vanilla” site.  That worked well and I got the Chromium login screen.

I created the VM both times. using 512 MB RAM and Linux Ubuntu 32 bit.

Taking a screenshot

The only thing that that wasn’t obvious in VirtualBox was how to take a screenshot.   Thanks to this Techmix post, I learned you need to press left command to return the keyboard to the host mac and then use the right command key (with shift + 4) to grab a screenshot and have it sent to the desktop of the host mac.  And you have to do this every time because the keyboard focus returns to the VM every time you command+tab back to it.