graalvm 2023-09-07

Is there any special concerns to think about when choosing a clojure http client for a graalvm application?

yes. not all work out of the box or yield a small binary. babashka.http-client and httpkit yield small binaries

How about web servers?

Httpkit works well with GraalVM

Babashka uses it for server

Oh nice, it has no dependencies

nginx recommended for https eh

I have a graalvm compiled shared lib that contains SCI and is 52MB. Wondering how much of that is likely SCI...

The smallest SCI binary is like 10m or so

you can easily check this by only including SCI and no other libraries

compiling with -O1 might get you smaller binaries than otherwise

yeah I should check. thanks for the tips

also leave out your reflect.config, which also contributes to size

✅ 1

SCI seems to account for 38 MB there. Reflection had no noticeable effect (at least not on the MB level)

I adapted the jayfu example to rip out clojure.data json and it only prints an evaluated command line value. I get for GraalVM JDK 19/22.3.0 a binary that is 22mb. For Oracle GraalVM 20 (new version scheme, new vendor name) I get 25mb. For Oracle GraalVM 20 + -O1 I get 19635330 (19.6mb).

I pushed this to the only-sci branch in jayfu if you want to check this yourself.

$ ./jayfu -e '(+ 1 2 3)'
6

Every new GraalVM release can come with some binary size increase when they add more stuff to the runtime, but 38mb seems to come from other stuff than only SCI. E.g. when you have runtime calls to resolve etc this may "bloat" the image. Carefully avoid those if you can.

When I wrote the docs of this project, the size was 17mb: https://github.com/borkdude/dynaload