5 ms·
One of the things that always stops me pushing too far into clojure is memory footprint. Does anyone have any suggestions or resources for how to keep the upfr
by hammerandtongs 10y ago
One of the things that always stops me pushing too far into clojure is memory footprint.
Does anyone have any suggestions or resources for how to keep the upfront memory cost of the jvm to a minimum (and monitor that its still within bounds over time).
128m is not acceptable, for my uses clojure would need to compete with go and rust which I can deliver 10-20m running in memory (and lightning fast).
I don't expect 10-20m but 10x doesn't work for me.
Think of deploying to Sandstorm.io as my goal ie small personal servers.
- yogthos 10y agoI'm working on a port of the Ring stack to Node.js for that exact reason. https://github.com/macchiato-framework/macchiato-core https://github.com/macchiato-framework/macchiato-core I wrote about the motivation for the project in some detail here http://yogthos.net/posts/2016-11-30-Macchiato.html http://yogthos.net/posts/2016-11-30-Macchiato.html You can see some example projects here https://github.com/macchiato-framework/examples https://github.com/macchiato-framework/examples I've already ported some of my JVM services to it, and I've been very happy with the results. There's a Clojurians slack channel #macchiato where project discussions are happening, and others have been using it successfully as well. I don't see Node.js as a replacement for the JVM, but it is a better fit for certain types of applications. Being able to develop Clojure using essentially the same stack on both platforms means being able to choose the right tool for the job.
- hammerandtongs 10y agoI think it's really cool that you are pushing on this. I'll probably pursue the jvm for a little while longer but I can see the attraction to clojurescript for this and will check in down the road.
- pron 10y agoBy default, the JVM will use all the memory you give it. Have you tried simply setting a small maximum heap size? You can use VisualVM to visualize the heap and GC. Deep monitoring is one of the JVM's greatest strengths.
- hammerandtongs 10y agoYes this was my thinking on how to proceed. I'm just kind of surprised and disconcerted how little I could find on the web, specifically for minimizing footprint.
- pron 10y agoThe JVM does not lack in documentation and advice; Clojure is riding on that.
- bheesham 10y agoYou may be able to get there with AOT compilation and slimming down the JAR and JRE.
- juskrey 10y agoWith recent introduction of cheap high-RAM VPS and dedicated boxes like Scaleway, I don't feel this is a problem anymore. Running of Clojure on Java gives excellent multithreading environment - I personally don't want to sacrifice it for smaller memory footprint.