News for hackers. Stuff that matters.
Re:How we built Uber Engineering's highest query-per-second ... by matt2000 on Thursday November 14, 2019 @09:28AM (#21535581)
My sense is that most people moving to Go are coming from Node and that explains their excitement about the performance. Not many upsides when you’re already on Java.
Re:How we built Uber Engineering's highest query-per-second ... by dashwav on Thursday November 14, 2019 @09:42AM (#21535695)
I mean there is a definite performance gain from Java to Go, although I would agree most people probably wouldn't hit it - but if its just as easy to write, might as well use the better language. On top of that Go makes concurrency so much easier to factor in and program with, which in the backend server space is a very important asset over Java.

As an interesting addendum, I found this to be a really interesting resource when comparing languages at a very base level, as it is very well written and you can actually look at the source code/ thesis papers for all of the implementations: https://github.com/ixy-languages/ixy-languages

Re:How we built Uber Engineering's highest query-per-second ... by matt2000 on Thursday November 14, 2019 @10:47AM (#21536294)
I hadn't seen the network driver comparison before, interesting. Go does really well here, maybe because this is the kind of job is was designed for originally? I'm not sure. For the kinds of things I generally write, this is usually a good way to compare something approximating real world performance: https://www.techempower.com/benchmarks/#section=data-r18&hw=...

C, Java, C# and Go all appear at the top there so it's basically a wash, +/-5%. I still think the main perception of Go as "the fastest option" on places like HN is because people are coming from some of the slower languages (Javascript, Ruby, etc).

Footnote: I don't think there's anything wrong with using a slower language, a lot of them have higher productivity overall. I also just happen to prefer programming in Java, so it's overall the best choice for most jobs for me.

Re:How we built Uber Engineering's highest query-per-second ... by MrBuddyCasino on Thursday November 14, 2019 @10:21AM (#21536047)
> I mean there is a definite performance gain from Java to Go

I don't think thats true.

Re:How we built Uber Engineering's highest query-per-second ... by CamouflagedKiwi on Thursday November 14, 2019 @01:36PM (#21538014)
There are dramatic memory and startup time improvements. Much less so for CPU once everything is up and running.
Re:How we built Uber Engineering's highest query-per-second ... by stefano on Thursday November 14, 2019 @02:34PM (#21538561)
Is that still true after tuning the JVM GC for a low memory footprint? I'm genuinely asking, I'd like to see an article on the subject. I've read in the past that the default settings are geared towards long-running processes and trade off memory usage for higher throughput, as in general there's no free lunch with GCs. Better memory usage always implies worse performance (and viceversa), just like a higher throughput increases pause times. If Go has lower memory usage and lower pause times, I'd expect it to have lower throughput than the JVM GC.
Re:How we built Uber Engineering's highest query-per-second ... by CamouflagedKiwi on Friday November 15, 2019 @08:47AM (#21544692)
Yes.

Every object in Java has something like three words of overhead; also since it doesn't have value semantics (yet) objects are typically allocated out-of-line, so an ArrayList makes a linear number of allocations, whereas a Go slice makes a constant number. Plus the binary sizes are typically much smaller; not really an expert but our observataion at work is non-trivial Java services allocate a lot of memory through classloading / JITing whereas a Go binary will typically be very small.

Basically, agreed on the GC tradeoff, but the higher memory footprint of Java mostly comes from other areas.

> Better memory usage always implies worse performance

That isn't really true. Better memory usage implies better cache-friendliness (and possibly better locality too).

Re:How we built Uber Engineering's highest query-per-second ... by DuskStar on Thursday November 14, 2019 @08:58PM (#21541604)
There's two more variables you're missing here, besides "memory" and "pause times" - how well matched to GC the language is, and how advanced/good the GC is. Some languages might just be fundamentally easier to garbage collect than others - a simple example might be that of a language with no references and no threading, where the GC is going to be extremely simple. And GC quality is certainly a thing, since I doubt major companies would spend tens/hundreds of millions of dollars producing GC 'advancements' that just move a slider back and forth.
Re:How we built Uber Engineering's highest query-per-second ... by erik_seaberg on Thursday November 14, 2019 @11:31AM (#21536748)
The GC isn't very good yet, but brute-force sequential code can keep more state on the stack where it doesn't matter. (Just please codegen that instead of expecting everyone to read it.)
Re:How we built Uber Engineering's highest query-per-second ... by marsdepinski on Thursday November 14, 2019 @01:51PM (#21538169)
Go's GC is better than most of the Java GCs except the new ZGC and Azul's proprietary one. JIT makes some Java code faster. Ultimately, it's more about programmer expertise in a language rather than the actual language.
Re:How we built Uber Engineering's highest query-per-second ... by daxfohl on Thursday November 14, 2019 @02:34PM (#21538560)
It's all relative. Go is optimized for pause times and beats all other mainstream runtimes for that. JVM GC is very configurable and can be optimized for throughput, pause times, heap size, fragmentation, or whatever you want, and can beat Go's for pretty much all of them except pause times. Both have very smart people working on them and the techniques are well established, so it's about tradeoffs. (An oldish post but I think still relevant: https://blog.plan99.net/modern-garbage-collection-911ef4f8bd...)

That said, Go's focus may be the right one for many use cases. On a high throughput service where you would assume you want to optimize for throughput, 100 ms pause times can wreak havoc because they're unpredictable and can cause work queues to explode and such. This isn't easily mitigated by load balancing. Whereas "less efficient" GC is at least predictable and you can just add a server to balance that extra work.

Re:How we built Uber Engineering's highest query-per-second ... by erik_seaberg on Thursday November 14, 2019 @11:10AM (#21536557)
Go has a little syntactic sugar for the same green threads other languages have, but it's missing a lot of immutable and thread-safe data structures.
Re:How we built Uber Engineering's highest query-per-second ... by apta on Thursday November 14, 2019 @10:04PM (#21541896)
> might as well use the better language

Which would be Java in this case.

Re:How we built Uber Engineering's highest query-per-second ... by overcast on Thursday November 14, 2019 @11:53AM (#21536949)
Why is it that every Java application I've encountered in my 20 years of corporate IT, has been a performance pig? Is it just a case of bad developers, making shit code? Is it difficult to make Java perform well, but when it does, it shines? I can't have accidentally interacted with ONLY the crappiest Java apps in my tenure.
Re:How we built Uber Engineering's highest query-per-second ... by geodel on Thursday November 14, 2019 @01:32PM (#21537972)
I have exactly similar experience. At this point I feel Java programmer/developer is misnomer. Most of the time they are 'framework' fiddlers. Be it J2EE, Spring, Spring Boot (nowadays) Vert.x and so on. When I talk about an http server, the only frame of reference in their mind is Weblogic, Websphere, JBoss, Tomcat etc. The stuff they work with is 80% auto generated and they are quite proud if it.

So few application I own have about 200 LOC of business logic and 10K LOC Spring Boot fluff along with some 60 jar files which I am not sure what they really do.

Re:How we built Uber Engineering's highest query-per-second ... by asdfman123 on Thursday November 14, 2019 @02:37PM (#21538585)
It's possible to make bloated crap in any language.

But enterprise programmers making internal software have little incentive to make their programs sleek and fast because they 1) have a captive user base who are forced to use their bad UIs, and 2) there aren't many users so you don't really need to optimize for minimal server use.

From the eyes of management, a good enterprise programmer can take a request from start to beginning and fulfill a business requirement in a reasonable amount of time. Architecture, UI, future maintainability, speed, security... that's not really on their radar at all.

There are plenty of managers who do not understand or respect feature creep and technical debt, so spending time refactoring is useless and opaque to them. Developers have no incentive to write good code, and bad developers who can talk a good game get hired on, so the codebase spirals into an unmaintainable sea of crap.

According to management, if you solve business problems, you're valuable to them. So if you care about good code, it's an uphill battle fighting for it against the other entrenched developers who really don't give a shit.

These programs usually happen to be written in Java because there are tons of Java developers out there, which is great if you don't live in a tech hub.

Re:How we built Uber Engineering's highest query-per-second ... by overcast on Friday November 15, 2019 @07:48AM (#21544346)
This isn't even internal stuff, all paid commercial applications. Oracle is notorious for it, but most recently dealing with SysAid(Helpdesk software).