News for hackers. Stuff that matters.
Re:Should I Learn Java in 2018 by base698 on Friday July 13, 2018 @08:13AM (#17522209)
Hmm. Just checked memory use on some services we run on Go, Node, and Java. I'm not part of the Java team but results:

Go: 40M Node: 64M Java: 4GB

Any Java service I've seen in production has similar numbers. Coupled with the incredible startup time it's hard for me to see why you'd pick it in 2018.

Re:Should I Learn Java in 2018 by akerro on Friday July 13, 2018 @08:19AM (#17522251)
>Go: 40M Node: 64M Java: 4GB

This benchmark is completely useless unless you have 3 identical servers with identical algorithms using identical API and models with identical work load. so... why would you waste time writing them?

Also, these [1] benchmarks which are more reliable, because we know what servers they're run on and we can inspect source code, unless, of source, you can prove your statement.

[1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Re:Should I Learn Java in 2018 by levosmetalo on Friday July 13, 2018 @08:16AM (#17522231)
If you tell your Java application server "here you have 4GB, use it as you wish" it will happily comply and trade memory for performance.

In most of the cases it's just a matter of setting a few Java runtime startup parameters.

Re:Should I Learn Java in 2018 by sirk390 on Friday July 13, 2018 @08:28AM (#17522318)
It's disrespectful to take 4GB if you don't need it. This should never be the default...
Re:Should I Learn Java in 2018 by bloomthrowaway on Friday July 13, 2018 @08:45AM (#17522436)
It's the default because in any garbage collected language you can delay taking out the trash as long as you want... as long as you have memory. The most efficient thing to do is never run the collector at all.

JS does frequent GC cycles because its unacceptable to let a webpage eat all the ram. Not sure why Go collects so frequently. Java's default IMO is the most reasonable of the three. If you have a server with 4gb the best choice is to let the garbage collector use all of it

Re:Should I Learn Java in 2018 by boobsbr on Friday July 13, 2018 @08:35AM (#17522366)
Read the comment again:

> If you tell your Java application server "here you have 4GB, use it as you wish"

Re:Should I Learn Java in 2018 by fastbmk on Friday July 13, 2018 @08:16AM (#17522236)
JVM uses as much memory as you allow. Use `-Xmx39m` to beat Golang.
Re:Should I Learn Java in 2018 by sheeshkebab on Friday July 13, 2018 @08:31AM (#17522343)
My guess is that it won’t work with less than 1GB bc of spring boot, hibernate and all the rest of Java enterprise “microservice” goodness.
Re:Should I Learn Java in 2018 by bloomthrowaway on Friday July 13, 2018 @08:48AM (#17522458)
IMO almost nobody is writing microservices with spring boot because its so gigantic. Hibernate isn't bad on memory use on its own.

There's a raft of more sane choices these days like Play, Dropwizard, Vert.X etc.. They all use far less resources. Spring Boot is huge because it has to support a decade of obsolete junk, its far more than just a REST app framework.

Checkout TechEmpower's framework benchmarks https://www.techempower.com/benchmarks/#section=data-r16&hw=...

(I added filters to limit to Java+Go+JS+Python and limited DB to Postgres and Mysql)

Java and Golang lead the pack, with JS a distant second and most Python frameworks hanging out near the bottom

Re:Should I Learn Java in 2018 by ardfie on Friday July 13, 2018 @09:02AM (#17522551)
>IMO almost nobody is writing microservices with spring boot because its so gigantic.

I've encountered plenty of spring boot microservices in my work and, from what I hear of other companies, it's not particularly rare.

Most of the time, if you have a team that's productive in Spring, a manager or lead will be happy to spend some extra memory and get more features shipped.

Re:Should I Learn Java in 2018 by boobsbr on Friday July 13, 2018 @08:38AM (#17522390)
> My guess

So you actually haven't tried to run an application with those libraries, and you don't even know what libraries that particular application is using, and here you are speculating about something you don't know and/or understand.

Re:Should I Learn Java in 2018 by bloomthrowaway on Friday July 13, 2018 @09:11AM (#17522613)
I've used Spring and he's probably right :) . But there's better choices these days. Any Spring micro-services out there are probably by a team that knew Spring well and didn't want to learn a more suitable framework
Re:Should I Learn Java in 2018 by jackpeterfletch on Friday July 13, 2018 @08:48AM (#17522456)
Whats different about the equivalent libraries in other languages?
Re:Should I Learn Java in 2018 by bloomthrowaway on Friday July 13, 2018 @09:18AM (#17522664)
Spring is huge... The closest competitor might be Rails
Re:Should I Learn Java in 2018 by base698 on Friday July 13, 2018 @08:20AM (#17522252)
Yeah, but they all seem to need high mem amounts or they OOMException.
Re:Should I Learn Java in 2018 by fastbmk on Friday July 13, 2018 @08:23AM (#17522284)
Well, it may also be a bad code written by amateurs which use memory inefficiently.