graalvm

borkdude 2022-07-27T09:40:11.625959Z

https://twitter.com/borkdude/status/1552227144549408769

3
Karol Wójcik 2022-07-27T11:09:35.382219Z

Has the image size also reduced?

borkdude 2022-07-27T11:18:55.780759Z

Yes, it seems so :) With 5mb, now 72mb in total

Karol Wójcik 2022-07-27T11:22:17.559479Z

Wow, cool!

borkdude 2022-07-27T11:23:19.763459Z

Yeah, it's amazing, it seems to shrink now every time, unlike before where the image size grew every time ;)

👍 1
ericdallo 2022-07-27T11:41:09.837429Z

Interesting: https://github.com/oracle/graalvm-reachability-metadata

Karol Wójcik 2022-07-27T12:10:28.292089Z

Yeah, i stopped investing in this after I spoken with few guys from Oracle and they told me about having plans of publishing repository of GraalVM metadata of popular open source libraries.

👍 1
ericdallo 2022-07-27T12:14:15.471889Z

we should probably open PRs with the libs we have on graal-config?

Karol Wójcik 2022-07-27T12:16:10.391429Z

I’m not sure yet. I thought that they will distribute it in a way it’s accessible by all Clojure build tools, but it doesn’t seem so.

😢 1
ericdallo 2022-07-27T11:41:46.599799Z

It's like we did on https://github.com/clj-easy/graal-config :)

ericdallo 2022-07-27T11:54:14.089569Z

> • Improved many internal data structures of the native-image generator to reduce the memory footprint. This makes Native Image builds more robust when running on memory-constraint environments like cloud-based build services, https://github.com/marketplace/actions/github-action-for-graalvm, or in https://www.graalvm.org/downloads/. Many larger application now build successfully with 2 GByte of Java heap size available for the native-image generator. 🙏

bocaj 2022-07-27T15:15:31.461829Z

I’m using graal v 22.1 with microsoft sql; this in the deps.edn:

com.github.clj-easy/graal-config-next {:git/url   ""
                                                :git/sha   "0dc2862e1b1c9871eef4c306ef77da3610a2bd93"
                                                :deps/root "config/com.github.seancorfield/next.jdbc"}

borkdude 2022-07-27T15:16:45.556269Z

@bocaj I'm assuming you're going to post a question after this, right? Check out https://github.com/babashka/babashka-sql-pods which has configs for that. Perhaps we can move them to graal-config.

👍 1
bocaj 2022-07-27T15:17:16.420289Z

I’m terrible at formatting messages 🙂

bocaj 2022-07-27T15:17:23.572439Z

"-H:IncludeResourceBundles=com.microsoft.sqlserver.jdbc.SQLServerResource"
                             (str "--initialize-at-run-time="
                               ",com.microsoft.sqlserver.jdbc.SQLServerFMTQuery"
                               ",com.microsoft.sqlserver.jdbc.SQLServerFMTQuery"
                               ",com.microsoft.sqlserver.jdbc.SQLServerBouncyCastleLoader"
                               ",com.microsoft.sqlserver.jdbc.SQLServerBulkCSVFileRecord"
                               ",com.microsoft.sqlserver.jdbc.SQLServerBulkCopyOptions"
                               ",com.microsoft.sqlserver.jdbc.SQLServerBulkCopy"
                               ",com.microsoft.sqlserver.jdbc.SQLServerResource"
                               ",com.microsoft.sqlserver.jdbc.SQLServerMSAL4JUtils"
                               )

bocaj 2022-07-27T15:17:55.294079Z

The question is about this error:

com.microsoft.sqlserver.jdbc.SQLServerResource the class was requested to be initialized at run time (from command line with 'com.microsoft.sqlserver.jdbc.SQLServerResource'). To see why com.microsoft.sqlserver.jdbc.SQLServerResource got initialized use --trace-class-initialization=com.microsoft.sqlserver.jdbc.SQLServerResource

bocaj 2022-07-27T15:18:02.811799Z

Failed generating ' --trace-class-initialization=com.microsoft.sqlserver.jdbc.SQLServerResource' after 49.9s.

bocaj 2022-07-27T15:18:27.117209Z

I see this is working well with clj-easy, which reports

Registering packages for build time initialization: clojure, com.github.ztellman, next, camel_snake_kebab, dbloader, com.climate, charred, tech.v3, babashka, taoensso, clj_easy, hyperfiddle

bocaj 2022-07-27T15:19:30.408189Z

so I’m curious if next.jdbc is initializing sql server resources at build time, but I need to somehow force portions of the next dependencies to initialize at run time so that the sql server driver works

bocaj 2022-07-27T15:23:51.009309Z

Got it, thanks! I like that idea

borkdude 2022-07-27T15:24:05.061379Z

@bocaj It depends. It could also be in your own program, something which is initialising stuff on the top level

borkdude 2022-07-27T15:25:22.041399Z

@bocaj This is the only thing for mssql that the bb pod has, I think: https://github.com/babashka/babashka-sql-pods/blob/7fd0d1a78b19f0fab3ecc5babada88f41194de7b/script/compile.clj#L65-L68

borkdude 2022-07-27T15:27:07.723399Z

ah right

bocaj 2022-07-27T15:28:04.397209Z

Have you built the sql server pod with graal 22?

bocaj 2022-07-27T15:28:29.898189Z

I think this might be the issue, as well. I’ll start with 21 and work forward. Thank you!

borkdude 2022-07-27T15:31:25.346639Z

not sure

borkdude 2022-07-27T15:31:49.969679Z

I've seen an issue in bb where I had to initialize-at-build-time= another yaml class this morning with 22.2