5 ms·
i just read "java is slow" as "java is slow to startup" and that helps. Java is slow(er) to to startup, but once it's going, it's pretty good.
by johnny22 4y ago
i just read "java is slow" as "java is slow to startup" and that helps.
Java is slow(er) to to startup, but once it's going, it's pretty good.
- maleldil 4y agoThat doesn't matter if you're writing a REST api. If you're writing a CLI app, then I agree that's a problem.
- dboreham 4y agoSometimes matters, e.g. when you deploy new code.
- oauea 4y agoNot really, just do a rolling deployment like you should be doing anyway. No one cares if the new version takes 1 millisecond to start up or 3 seconds because they literally won't notice.
- imtringued 4y agoBut 3 seconds isn't on the table. It is more like 20-30 seconds on a medium sized app and 8 seconds for a small one.
- bzzzt 4y agoIf your Java app takes half a minute to initialise it's the app's problem, not Java. Modern Java frameworks have moved from a dynamic deployment model to statically compiled and can start in milliseconds. (for example, see the benchmarks on https://quarkus.io/blog/runtime-performance/ https://quarkus.io/blog/runtime-performance/)
- dboreham 4y agoRolling deployment is a hack imho. Adds complexity and hence yet more potential failure modes.
- oauea 4y agoHardly, it's a fantastic guardrail when combined with health checks. You can say "you don't need it", but everyone makes mistakes sometimes. Make those mistakes not matter. You also take backups, right? Same idea.
- dboreham 4y agoIt has a non-zero cost though, which is why I don't like it. Things go wrong with the "roll" for example. You have potentially two versions of your code running against the same DB for some time. Stop -> deploy code -> start is simpler and less likely to go wrong.
- dividedbyzero 4y agoHow would real-world JVM startup times matter in deployments?
- imtringued 4y agoYou reboot and suddenly your CPU is at 100% for 20 minutes starting every web service...
- pgwhalen 4y agoIf your CPU is at 100% for 20 minutes starting every web service, that is definitely your problem, not Java’s problem.
- smolder 4y agoJVM startup times make using it in Lambda or scaling container clusters awkward. Scaling can't happen fast enough for traffic spikes when the startup time and cold start performance is crap.
- dboreham 4y agoYou exec a process expecting it to begin operating, providing some networked service, in a reasonable time. Instead it doesn't do that. It spends tens of seconds, sometimes minutes, running JIT and other sundry startup overhead. You may not have seen this if you haven't used Scala...
- thefaux 4y agoYeah, Scala is absurdly bad for startup time because of poor modularization of the standard library. It's a decent language with a terrible standard library.
- dividedbyzero 4y agoGenuinely curious, what kind of application are you running? Which JVM are you using? Are you aggressively GC tuning? Very low on memory? I've used Scala from 2.8 up to 3.0, for microservice systems, monoliths, data pipelines, machine learning (way back), desktop apps for research using Swing, an Android app (worst idea ever), highly imperative to very functional, and I don't think I've ever seen anything remotely as bad as that even on genuinely big codebases. Hundreds of ms, sure, but minutes just getting the JVM up and running? I can see how that would be problematic.
- galangalalgol 4y agoI meant slow to develop in.
- za3faran 4y agoWith features like records, pattern matching, enums, and many more, I find it much better than the likes of Python or golang.