Intro
Christmas is a time of tradition, and I’m delighted to continue the one we started last year. On this very same date and blog, we unveiled the development of Chicory: Chicory: WebAssembly on the JVM.
WebAssembly continues to grow steadily and strongly, much like we’ve come to expect from web technologies (link to this year Edoardo’s blog). While it’s not perfect yet, the ecosystem is expanding. For instance, CPython 3.13 is now officially released for WASI, and SQLite has added official support for WebAssembly builds using Emscripten.
This year, I’m thrilled to share an exciting announcement: Chicory, the pure Java WebAssembly runtime, has reached its first stable release: 1.0.0!
Last year, we unpacked a toolbox. This year, we’re unwrapping a heartfelt photo album, showcasing the magical journey that brought us to this incredible milestone.
The Cover
Let’s start with the cover!
Chicory now has a brand-new official website: chicory.dev. We’re continuously improving and updating it. A curious detail for the most attentive visitors: the documentation is tested continuously in CI using a clever combination of Jest + Approval Tests powered by JBang. This ensures that every code snippet displayed in the docs can be successfully compiled by users.
At the forefront of this release is the prominent 1.0.0, marking Chicory’s first stable release. But what does that really mean? Over the past 12 months, we’ve been rapidly developing the engine, and early adopters likely noticed significant changes to the public API. There were several reasons for this:
- We learned a lot about WebAssembly along the way.
- We improved the API, making it more intuitive for those familiar with other runtimes.
- We introduced additional modules, ensuring they integrate seamlessly.
- We focused on performance, eliminating bottlenecks from the public API.
What to expect?
With 1.0.0
, we’re committing to maintaining compatibility with this API. It’s time to dive in confidently, knowing that the code you write won’t become outdated early.
Beyond the public API, we’re proud to say Chicory is now stable and useful to start providing active support for it.
The Family Picture
When you open the cover, the first thing you see is a traditional, unmissable family photo.
Here are the key members of our Chicory family:
- The basic building block:
wasm
This is the core module, responsible for handling the nitty-gritty details of the WebAssembly specification. It provides idiomatic Java APIs for working with arbitrary binary Wasm modules. - The main character:
runtime
At its core, this is the interpreter we introduced last year. Now, it supports the full V1 WASM specification (except simd) along with some additional proposals. While it’s slow compared to other options, it’s extremely reliable and portable. We take pride in its readability, making it a pleasure to hack on! - The system interface layer:
wasi
This module provides an implementation of Wasi Preview 1, still a widely supported compilation target for languages like Go, Rust, and C++. In our experience, it enables Chicory to run various real-world Wasm modules effectively. While there are limitations, you’re encouraged to roll your own implementation when the provided one doesn’t suffice. - The mandatory:
log
This module allows (when necessary) decoupling from the Java Platform Logging (JEP 264), which isn’t available on Android devices. - The cool kid: wabtExternal tools like
wat2wasm
(for converting WebAssembly Text format.wat
files to binary) andwast2json
(for parsing.wast
files and emitting.wasm
files and.json
assertion descriptions) are essential for building Chicory. These incredibly valuable tools officially ship as Wasm modules. We bundle a pure Java executable version (through Chicory, of course) to make them easily consumable as Jar artifacts. - Finally, the: bomThis module keeps all the others aligned and smiling for the camera.
The Newborns
Turning the first page reveals a collection of little creatures, freshly born and still in need of nurturing before they fully join the family. These modules are released with the -experimental
suffix and placed in the relevant experimental
namespace to indicate they’re not yet fully mature.
We encourage you to try them out and explore their potential, but keep in mind that they may not yet offer full stability as they grow towards maturity.
- The one eager to start walking:
aot-experimental
AoT stands for “Ahead Of Time.” This module translates Wasm to Java Bytecode (at the right distance, they look surprisingly similar!), generating pure Java artifacts from Wasm modules. Compiling and running modules dynamically requires some reflection, and this module depends on ASM. While it’s incredibly fast, there are still some rough edges to refine. - The lightweight companion to the first one:
aot-maven-plugin-experimental
This lightweight Maven plugin makes it easy to use the AoT translator at compile time. The resulting artifacts are persisted to disk, eliminating the need for external dependencies or runtime reflection. However, this approach sacrifices dynamic module loading. - The quiet one that flies under the radar:
cli-experimental
This CLI allows you to quickly evaluate Chicory directly in the comfort of your terminal. - The twins:
host-module-annotations-experimental
&host-module-processor-experimental
These consist of annotations and the corresponding annotation processor, making it easier to integrate Chicory through a higher-level, fully Java-idiomatic, generated API.
The Travel Memories
Turning another page takes us through a colorful spread of memories, showcasing the countless places where Wasm has made its mark across the software world. These moments are as diverse as they are inspiring, reminding us that WebAssembly is truly everywhere! Here’s a glimpse, in no particular order:
- Through a refracted spectrum:With our great friends at JRuby, we got Prism running as a pure Java artifact, enabling the bootstrapping of JRuby without any native dependencies.
- From the deserts:A Wasm Camel found its way into a low-level integration.
- Large highways:Kafka Connect and Apache Pulsar opened up the road to polyglot data transformations built on message queues.
- A river capturing every ripple:Debezium uses Wasm plugins to track Change Data Capture events as they flow through your data streams.
- The wrought iron gate:Keycloak stands tall, demonstrating pluggable Policy Providers in languages beyond Java.
- From the shallow waters of a river:A Kafka Proxy (Kroxy) opens its jaws, providing unprecedented extensibility.
- A friendly agent:OPA (Open Policy Agent) policy issues fees on our virtual dashboard. Thankfully, we avoided the speed trap by removing the network!
- Comfortably eating data on the Java train:SQLite offers a tasty and safer option for data consumption.
- In the middle of a gray sky of clouds:A Spark lights up Big Data processing in new ecosystems.
- Timeless snapshots:Rusty gems like Ocrs, Photon, and others are the must-have selfies of this journey.
The Parties
Exploring the software world is always a thrill, but the most valuable part of the journey is meeting, chatting, and spending time with others who share your passions.
We’ve been fortunate to be accepted at various events, proudly taking the stage to showcase our juggling skills with compilers, runtimes, and integrations.
If you’d like to experience our journey firsthand, here are a few highlights you can watch:
- Wasm I/O 2024:The ultimate destination for anyone building with WebAssembly. A small but top-notch gathering of experts pushing the boundaries of this technology. Check out our talk: Chicory: Creating a Language-Native Wasm Runtime by Benjamin Eckel / Andrea Peruffo.
- Dylibso Insiders:A comprehensive and approachable retelling of Chicory’s journey. Dive into the full story with: Chicory, a JVM Native WebAssembly Runtime by Benjamin Eckel.
- Devoxx BE 2024:The largest Java conference in Europe and a pivotal moment for Chicory. We connected with new and old friends, paving the way for the future. Watch our talk: Meet Chicory, exploit the power of WebAssembly on the server side! by Andrea Peruffo.
The Race Day
This year, GraalWASM by Oracle was announced as “production ready,” and we’ve had the pleasure of chatting with the incredible team behind the project.
Picture an adrenaline-filled drag race: vehicles lined up at the starting line, tires burning, and engines roaring. Naturally, you’re curious about how they perform when the rubber meets the road.
These benchmarks are preliminary, and more work is needed before drawing any definitive conclusions. However, we’d like to share the results of running this suite on a dedicated machine, encouraging you to take a closer look and explore further.
Removing the outliers of the interpreters, a close-up look at the Photon benchmark:
The results highlight the distinct design choices of each project:
- Chicory’s pure interpreter:Its focus on simplicity and portability comes with a trade-off: slower performance.
- GraalWASM:GraalWasm delivers great performance using Graal JIT, when available, to compile WASM directly to machine code.
- Chicory’s AoT translator:Produces pure bytecode artifacts that achieve competitive performance on any standard JVM.
The Road Ahead
We’ve already bought our tickets for the next leg of this journey, and the adventure has only just begun. We’re eager to explore wilder and uncharted territories, confident that exciting times lie ahead.
Here’s what we’re looking forward to:
- Integrations and usage of ChicoryExpanding its availability in major frameworks and products.
- Spec Proposals complianceAchieving full compliance with WebAssembly standards, including Exception Handling, Garbage Collection, and full support for SIMD.
- Maturity and stability of
-experimental
modulesRefining these modules by removing limitations, fixing bugs, and ironing out their APIs. - SpeedWe have not spent much time on performance, and it’s time to take a serious stab at it.
We’re excited to connect with the community along the way, whether at local JUGs, conferences, or meetups. If you’re curious about WebAssembly and its growing impact on development, don’t hesitate to reach out—we’d love to hear from you!
The Back Cover
None of this would have been possible without the help of incredible contributors. On the back cover, you’ll find the names of some of the key authors who made this journey possible:
- David Philips:Outstanding work on Wasi and the AoT translator.
- Edoardo Vacchi:His mark is visible in the Store and public API as he joined the brawl.
- Daniel Perano:Instrumental in contributing the first steps of the AoT compiler.
- Ben Eckel:Shaped the initial foundation of the project.
- The Team at Dylibso:For their continuous support and collaboration throughout this journey.
As we close this chapter, we hope these snapshots have entertained and inspired you during the festivities. The journey doesn’t end here—come along and join us!
Author: Andrea Peruffo
With nearly two decades of coding experience, I’m fueled by passion as I continue to type away daily.
As a Principal Software Engineer at Red Hat, I actively contribute to diverse Open Source projects, driven by both personal fulfillment and professional advancement. My not-so-secret passion lies in programming languages, developer tools, compilers, and beyond. Come and spot me on a project near you!