-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cold start times for KotlinCompile/KotlinKapt workers #1179
Comments
@smocherla-brex Bazel is able to persist your workers between builds negating the performance overhead of having to spin them up for each build or even each action. Are you by chance killing your workers after each build?
Multiplex workers are gated by this flag: rules_kotlin/kotlin/internal/toolchains.bzl Lines 215 to 218 in 7dcb7f9
I haven't tried building There are also some other features that we'd like to test out like incremental Kotlin compilation (similar to Gradle) which is something we can only realistically do if we have a persistent worker that can define the shared disk cache for the Kotlin compiler. We'd definitely be open to evaluating a |
We actually do have to enable this sadly in CI (with
Thanks for the pointer - somehow missed it, I will try this out and check.
I was looking at the Kotlin builder code and see how we could plug in incremental compilation based on this, but it seemed a bigger effort managing a cache that Bazel is unaware of (mostly concerned about non-reproducibility issues we could run into, but I'm also not a kotlin expert :)). Good to know it's on the radar though.
Good to know, and also thanks for sharing your experience with rules_graalvm. I'll try out some experiments on our end and will follow-up with an update if I can get it compiling. |
Even for local builds I do notice this without
|
kotlinc has been an interesting performer with remote execution -- as a persistent worker it's slightly slower than javac. But, well, the first compilation is slooooooow until the first gc pass. I suspect it leans very heavily on the JIT. We've found that too much ram can be as problematic as too little, and it's happiest with 2-3 cpus. I haven't had as much time as I'd like to try and tune it, of course. I suggest tuning the gc/allocations for the worker until you see improvement. K2 will, of course, change the whole game. |
I observed that cold start on the persistent workers can play a part in slow builds. An example with Kapt (using
--define kt_timings=1
)and with a warm persistent worker
Around half the time. Also an example with
KotlinCompile
cold start
and warm start
I guess multiplex workers would help with this problem (If I remember it was enabled but reverted due to some corruption issues?). I was also wondering if using GraalVM native image binaries for these workers instead of raw Java binaries would help. Recently Bazel/rules_java has adopted it bazelbuild/rules_java#151 with some benefits. We're looking to try with GraalVM binaries for the compiler workers but was wondering if that's a direction you'd be open to accepting (if it actually brings the benefits with cold start).
The text was updated successfully, but these errors were encountered: