cloudstateio / cloudstate

Distributed State Management for Serverless
https://cloudstate.io
Apache License 2.0
763 stars 97 forks source link

Proxy core native image build optimization #451

Open jroper opened 3 years ago

jroper commented 3 years ago

The three docker images built from the proxy core project (no-store, in-memory and dev-mode) are identical apart from the command that gets executed. Yet, when we build them now, the native image gets recompiled. Docker does support incremental builds, it will only re-execute a build stage if the files have changed. The files that are changing are the jars we produce - the contents of the jars are identical but the timestamps of the files in them are different, which changes the jar files. I haven't worked out which timestamps are different and/or why incremental building isn't working for the jar files.

It would be ideal if this didn't happened. There are three possible solutions that I see:

I'm not sure which is the best option.

pvlugter commented 3 years ago

We could look at using https://github.com/raboof/sbt-reproducible-builds, which will strip the timestamps from jars.

Also wonder if it's worthwhile going even further and seeing what it would be like to have one native image which has all the persistence backends and can be switched into different modes.

jroper commented 3 years ago

Would just need to consider image sizes for that. And yeah we don't necessarily need different images, we could switch entirely using config.

jroper commented 3 years ago

But certainly, for the core build, we could switch to specifying the mode using arguments passed via Kubernetes, rather than in Docker. I think that might be simpler than our current setup.