graalvm

emilaasa 2023-09-07T06:44:15.647079Z

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

borkdude 2023-09-07T06:54:58.339839Z

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

Colin (fosskers) 2023-09-07T07:46:47.259489Z

How about web servers?

borkdude 2023-09-07T07:55:16.267089Z

Httpkit works well with GraalVM

borkdude 2023-09-07T07:55:22.286539Z

Babashka uses it for server

Colin (fosskers) 2023-09-07T08:00:36.256369Z

Oh nice, it has no dependencies

Colin (fosskers) 2023-09-07T08:06:07.335319Z

nginx recommended for https eh

emilaasa 2023-09-07T08:15:00.269259Z

Thanks @borkdude

Ingy döt Net 2023-09-07T13:10:36.252049Z

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

borkdude 2023-09-07T13:12:06.828709Z

The smallest SCI binary is like 10m or so

borkdude 2023-09-07T13:12:25.909419Z

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

borkdude 2023-09-07T13:12:39.002679Z

compiling with -O1 might get you smaller binaries than otherwise

Ingy döt Net 2023-09-07T13:13:27.899389Z

yeah I should check. thanks for the tips

borkdude 2023-09-07T13:23:06.259379Z

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

✅ 1
Ingy döt Net 2023-09-07T15:42:34.445389Z

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

borkdude 2023-09-07T17:10:18.545709Z

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

borkdude 2023-09-07T17:10:50.842179Z

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

borkdude 2023-09-07T17:11:05.133309Z

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

borkdude 2023-09-07T17:11:48.701629Z

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.

borkdude 2023-09-07T17:12:49.743549Z

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