Fork me on GitHub
#graalvm
<
2023-09-07
>
emilaasa06:09:15

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

borkdude06:09:58

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

Colin (fosskers)07:09:47

How about web servers?

borkdude07:09:16

Httpkit works well with GraalVM

borkdude07:09:22

Babashka uses it for server

Colin (fosskers)08:09:36

Oh nice, it has no dependencies

Colin (fosskers)08:09:07

nginx recommended for https eh

Ingy döt Net13:09:36

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

borkdude13:09:06

The smallest SCI binary is like 10m or so

borkdude13:09:25

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

borkdude13:09:39

compiling with -O1 might get you smaller binaries than otherwise

Ingy döt Net13:09:27

yeah I should check. thanks for the tips

borkdude13:09:06

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

2
Ingy döt Net15:09:34

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

borkdude17:09:18

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).

borkdude17:09:50

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

borkdude17:09:05

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

borkdude17:09:48

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.

borkdude17:09:49

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