4 ms·
I don't think I'd start "any" server-side project with Java; I think it's a question of whether you really want the JVM or not. The JVM is awesome but smaller p
by thehardsphere 9y ago
I don't think I'd start "any" server-side project with Java; I think it's a question of whether you really want the JVM or not. The JVM is awesome but smaller projects might find it too heavy for their use/deployment case.
But yeah, Java is great. Definitely seems underrated in the popularity department.
- djhworld 9y agoA lighter weight alternative to Spring Boot for small projects is Spark Java. http://sparkjava.com/ http://sparkjava.com/ It just works, if a little unfortunately named, but you can get a nice little application up and running quite quickly.
- vthallam 9y agoIt looks cool. But I don't see any information about database connectivity or ORM. can you like use JPA or Hibernate along with Spark?
- thehardsphere 9y agoOh, that looks nice, but I was speaking less about the language and more about the JVM itself. I mean, if you're in that small scale range where you're running project off of a small server or VPS that may not have that much RAM to play with, the JVM I think starts to make less sense. You don't need the super-scaling performance of the JVM because you won’t have the load, and the RAM that would be spent on the JVM heap is better spent in that case on other things (e.g. database caching, if you are so small and cheap that your DB runs on the same machine as the http/app server).
- slackingoff2017 9y agoJava using a large amount of ram is a myth. Let me explain the difference between JVM and other GC'ed languages that makes this appear to be the case. So almost all "web" languages use garbage collection. This reason Java appears to use more ram is, paradoxically because it has a better garbage collector. The best time to do garbage collection is never. Even if you do it concurrently it uses CPU time. Java is very good about avoiding collecting garbage until the heap is huge. Other languages (by default) use less ram because they run garbage collection a lot more often. So why do they run GC so much more other than Java? Because their garbage collectors are slower and not as concurrent. Almost all garbage collectors pause execution and even the ones that don't still affect performance. You don't want pauses more than some tens of milliseconds really ever. Garbage collection time depends on how much garbage you have, so languages with inferior collectors need to keep the heap small to avoid long collection times. Since Java's GC is so fast the heap can be allowed to build to many gigabytes before garbage collection times are an issue. Turning down the heap size will make Java GC more often and behave more like other languages. Compared to dynamic languages Java itself is very memory efficient. It's just the longer GC interval that makes this appear otherwise.
- slackingoff2017 9y agoI don't see why people view the JVM as "heavy". It's no different from the JavaScript/C#/Python runtime. The only popular languages that don't need a runtime installed are c/c++ and golang.
- thehardsphere 9y agoI don’t know about C#, but the JVM usually has steeper recommended memory requirements than Python or other scripting languages. It may not be a fair rap, but you can see where it comes from if you imagine that lots of people had their introduction to webapps in the form of LAMP shared hosting stacks.
- tootie 9y agoJVM is essentially a container. If you go Java all the way down, it obviates the need for Docker.