graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
ballpark 2021-04-15T13:58:25.104700Z

I would like to run Clojure in an AWS Lambda with minimal startup time. It seems that would be a good use for GraalVM's native-image. Any disagreements there? Any experience reports? Any good docs or instructions you've found on doing that? Thanks!

Ben Sless 2021-04-18T12:12:01.109200Z

How would you define minimal startup time? Have you tested how much you can cut from startup time by using direct linking, AOT, removing metadata, etc?

ballpark 2021-04-23T16:30:16.126500Z

@ben.sless I have not tested those things. I only have the impression that Graal makes things fast. However, building with Graal does not seem to be trivial, so I may revert to Java

Ben Sless 2021-04-23T17:45:58.126700Z

Building with a Native Image does significantly reduce start up time, however, the generated binary, by the Community Edition at least, performs worse than a JVM run would after the JIT has warmed up, so you need to consider the run time of the application itself. If it's under a few seconds a native image would probably be better. From minutes upwards a JVM would be better. Building a native image used to be harder but the Clojure community has figured out the big parts, so unless you're doing something weird or radical, it should be simple. Maybe just a bit resource intensive.

lukasz 2021-04-15T13:59:00.105100Z

That's a recurring topic in #babashka channel, as it fits the bill perfectly in most cases

👍 2
Tomas Brejla 2021-04-15T14:04:35.105200Z

But even using clojure itself and compiling it via graalvm might be a good way. Depending on the tasks you need to do (and libraries you want to use), using clj+ graalvm might give you lower footprint and probably better performance if it's important for you. But at a cost of rather slow build times, as native-image compilation is waaay slow. What's nice about babashka is that it already comes in natively-compiled form.

👍 1
ballpark 2021-04-15T14:05:49.105500Z

Ahh, cool, I will see if babashka will meet my needs, thanks!

Tomas Brejla 2021-04-15T14:06:42.105900Z

check this thread from yesterday, started by lukasz 🙂 https://clojurians.slack.com/archives/CLX41ASCS/p1618416923161500

Karol Wójcik 2021-04-15T14:08:50.106700Z

@ballpark you may want to check https://github.com/FieryCod/holy-lambda

👍 2
Karol Wójcik 2021-04-15T14:14:03.107Z

It supports both java runtime and native one. This month I'm adding support for interceptor chain & GraalVM EE. Docs are lacking tbh, but @ekoontz is working on it. 🙂

Karol Wójcik 2021-04-15T14:16:25.107400Z

You can find examples in /examples folder. If you need some help with starting out then let me know :)