graalvm

2024-06-20T00:44:47.964109Z

I just started looking into graalvm and I’m curious what are people’s experience using it in production for ring projects. What are the limitations and what are the benefits?

lread 2024-06-20T16:05:15.362059Z

Never tried this myself, but interested to hear if others have. In general with native-image, you'll spend more time working on your build, sometimes mysteries take a bit of effort to solve. If you use GraalVM Oracle (as opposed to the Community Edition), and use its optimizations and profile guide optimizations, you might just end up with something as snappy as (or even snappier than?) JVM/JIT. And because your binary will not JIT at runtime, all that overhead goes away and you'll use less RAM. I'll link to your original question because it has interesting answers: https://clojurians.slack.com/archives/C03S1KBA2/p1718843336066649

2024-06-20T19:55:34.715289Z

I've been using native-image for a project that uses ring for a while now, for the following benefits: • it can build a single binary with no dependencies apart from the base OS/architecture (for example x86 Linux). this saves any headache of coordinating Java, libc, etc. versions in different environments • low startup times make everything better. for example starting/stopping a service, and even building CLI tools into the same binary so you can share code with the web server these days configuring the native image is basically automated using https://github.com/clj-easy/graal-build-time and https://github.com/luontola/clojure-native-image-agent and if you already have eliminated all reflection calls in your project you will have a head start the main downside is compile time. it adds ~3mins to the prod build

👍 1
🆒 1
lread 2024-06-20T20:06:51.384239Z

Has anybody taken a shot a using native-image on a https://pedestal.io/ app? One of my many todos is to try this out on cljdoc, which is a pedestal-based server.