Paul Bakker, Java Platform at Netflix, Java Champion, and co-author of "Java 9 Modularity," presented How Netflix Really Uses Java at the 2023 QCon San Francisco conference.
Bakker put an end to the myth that "Netflix is all RxJava microservices with Hystrix and Spring Cloud and Chaos Monkeys running the show."
Bakker described the original architecture behind the familiar Netflix movie application, accessed via television and other devices, that connects to their Groovy-enabled API server using REST and gRPC connections to their various services.
The first upgrades featured multiple remote calls, parallel computing and fault tolerance implemented with RxJava and Hystrix. However, there were limitations such as: a script required for each endpoint, UI developers who generally don't like Groovy and Java; and the fact that reactive programming is hard.
Bakker then introduced the GraphQL Federation, an architecture model that allows multiple GraphQL services, known as subgraphs or federated services, to be combined into a single schema or API, and the concept behind GraphQL as an alternative to the over-fetching and under-fetching issues inherent in REST.
Their GraphQL Federated Gateway connecting to Domain Graph Services (DGS) essentially replaced the original API server to communicate with the various services via gRPC. Benefits included: no API duplication; no server-side development for the UI developers; a shared GraphQL schema; and no Java client libraries.
Java remains in active development at Netflix. They support Azul Zulu 17, Azul's downstream distribution of OpenJDK, with active testing on JDK 21, running approximately 2800 applications built with approximately 1500 libraries. Gradle along with Nebula, a collection of Gradle plugins built by Netflix, and IntelliJ IDEA are their preferred build tools.
Bakker provided a retrospective of their JDK 17 upgrade that provided performance benefits, especially since they were running JDK 8 as recently as this year. Netflix observed a 20% improvement of CPU usage on JDK 17 compared to JDK 8. This was mostly due to the improvements in the G1 garbage collector.
Netflix is actively testing on JDK 21, and Bakker feels that a subsequent upgrade to JDK 21 will be much easier and faster. The use of Generational ZGC will be a much better fit for a variety of workloads at Netflix and they will ultimately replace their thread pools with virtual threads. But "virtual threads are not a free lunch," Bakker maintained, as he warned that simply adding virtual threads to an application can actually decrease performance if the libraries are CPU intensive.
Netflix also supports Spring Cloud with Spring Cloud Netflix, a subproject that provides Netflix open-source software integrations for Spring Boot apps.