Live data from Hacker News

How Netflix uses Java

infoq.com

41–50 of 205 posts

Re: How Netflix uses Java

#41
post #9

>Netflix observed a 20% increase of CPU usage on JDK 17 compared to JDK 8. This was mostly due to the improvements in the G1 garbage collector. Help me here, why do GC improvements cause CPU increase?

I think this is a 20% improved utilization of CPU, earlier app was memory-bound or/and GC was consuming CPU. Now app has 20% more CPU available. It should be doing correspondingly more work. This could definitely be written clearly.

[deleted]

Re: How Netflix uses Java

#42

>Netflix observed a 20% increase of CPU usage on JDK 17 compared to JDK 8. This was mostly due to the improvements in the G1 garbage collector. Help me here, why do GC improvements cause CPU increase?

> Help me here, why do GC improvements cause CPU increase?

In Java 8 (afaik) there were pretty much no generational or concurrent garbage collectors, so garbage collector would happen in a stop-the-world manner: all work gets put on a halt, garbage collection happens, then the work can resume.

If you have a better GC, you have shorter and less frequent needs to do a stop the world pause.

Hence the code can run on cpu for more time, getting you higher cpu usage.

Higher cpu usage is often actually good in situations like this: it means you're getting more work done with the same cpu/memory configuration.

Re: How Netflix uses Java

#43
post #17

Spring Boot and Spring cloud for backend & graphql for the win. ;-)

No, just no. Performance and debugging are just plain horrible. The spring team loves to force you into their automagic shit and this bean stuff is so annoying. You almost got no compile time safety in this stack. It's the bane of my existence. I'd like to know that a compiled program will run. That seems virtually impossible with java/spring boot.

It's not quite as good as compile-time or type-based guarantees, but IME configuration errors with Spring are almost always flagged up immediately on application startup. As long as you have at least one test that initializes the application context (I.e. @SpringBootTest) then this should be caught easily

Re: How Netflix uses Java

#44

Earlier quoted context omitted.

Most modern GCs trade off CPU usage and latency. Less latency means the CPU has to do more work on e.g. a separate thread to figure out what can be garbage collected. JDK 8 wouldn't have had the G1 collector (I think, or at least a really old version of that) and they would have probably been using one of the now deprecated garbage collectors that would be collecting less often but have a more open ended stop the wor…

The figure is about the overall improvement , not sure why that reads increase. On JDK 8 we are using G1 for our modern application stack, and we saw a reduction in CPU utilisation with the upgrade with few exceptions (saw what I believe is our first regression today: a busy wait in ForkJoinPool with parallel streams; fixed in 19 and later it seems). G1 has seen the greatest improvement from 8 to 17 compared to its c…

> G1 has seen the greatest improvement from 8 to 17

Yep. G1 in newer JDKs is very different from G1 in JDK 8, but Parallel GC has also seen very significant improvements: https://kstefanj.github.io/2021/11/24/gc-progress-8-17.html

Re: How Netflix uses Java

#45
post #27

Earlier quoted context omitted.

It's constantly sending requests from BE to FE - checking IP, checking watch time etc.

That’s entirely unrelated to the backend language (and mostly unrelated to CPU usage for that matter).

do you know javascript? it can eat CPU

Re: How Netflix uses Java

#46
post #17

Spring Boot and Spring cloud for backend & graphql for the win. ;-)

No, just no. Performance and debugging are just plain horrible. The spring team loves to force you into their automagic shit and this bean stuff is so annoying. You almost got no compile time safety in this stack. It's the bane of my existence. I'd like to know that a compiled program will run. That seems virtually impossible with java/spring boot.

Spring is basically a standard in itself and it is easier to hire people in it. It also normalizes large pieces of the backend application so even though they are written by different people they are similar.

Once you learn the annotation based configuration it also saves a lot of time.

The performance is valid but it will only keep improving.

Re: How Netflix uses Java

#47
post #27

Earlier quoted context omitted.

It's constantly sending requests from BE to FE - checking IP, checking watch time etc.

That shouldn't take that much CPU tbh, but if it does, it sounds like they have some optimization to do. I wonder if it's like DRM in video games, causing a lot of overhead.

Maybe.

I watch streams on youtube, twitch etc and everything is fine.

However whole CPU is flying to the moon if I will watch something on netflix.

Btw Chrome was pure a nightmare for CPU but Brave is better.

Re: How Netflix uses Java

#49
post #17

Spring Boot and Spring cloud for backend & graphql for the win. ;-)

No, just no. Performance and debugging are just plain horrible. The spring team loves to force you into their automagic shit and this bean stuff is so annoying. You almost got no compile time safety in this stack. It's the bane of my existence. I'd like to know that a compiled program will run. That seems virtually impossible with java/spring boot.

It's funny to see this perspective! I used to work in a few companies locally who had adopted the early java-ee style for their applications and my experience is exactly the opposite. When going to spring I'm usually diagnosing issues on the application layer (ie: business issues, not framework issues), while on the java-ee applications I was often having to fix issues down at the custom persistence layer each company had, etc.. I see where you come from having looked at the "old" spring stack (non -boot), and I can see people getting mad over the configuration hell and how stuff is hidden behind xml.. Much like how java-ee is!

Re: How Netflix uses Java

#50
post #17

Spring Boot and Spring cloud for backend & graphql for the win. ;-)

No, just no. Performance and debugging are just plain horrible. The spring team loves to force you into their automagic shit and this bean stuff is so annoying. You almost got no compile time safety in this stack. It's the bane of my existence. I'd like to know that a compiled program will run. That seems virtually impossible with java/spring boot.

We've adopted Quarkus and it's been a breath of fresh air. Excellent all around, DX, performance, features, it's all been good.
Post reply on HN