How Netflix Really Uses Java

How Netflix Really Uses Java

Netflix's Java Architecture

  • Netflix heavily relies on Java, with almost all back-end applications written in Java.
  • Netflix has evolved its architecture and is moving away from the Groovy era, with a focus on using Java more effectively and exploring new technologies.
  • Netflix uses Java 17 and Zulu OpenJDK for its Java applications and libraries, with a build system based on Gradle and Nebula.
  • Upgraded from Java 8 to Java 17, resulting in a 20% improvement in CPU usage.
  • The G1 garbage collector is the best choice for most workloads, while Shenandoah is used for low pause time requirements.
  • Java 21 introduces virtual threads, which can significantly improve scalability for thread-per-request style applications.
  • Leveraging virtual threads requires changes to the framework library and application code.
  • Spring Boot is the most popular Java framework and is well-maintained.
  • Spring Boot 3 unblocks the Java ecosystem by requiring Java 17 and supporting Jakarta EE.
  • Spring Boot Netflix is a set of modules built on top of Spring Boot that provides integration with Netflix and other infrastructure.
  • Moving to Spring Boot 3 is not trivial, but tooling is available to make the process easier.

GraphQL Federation

  • GraphQL Federation is an architecture that allows for combining multiple GraphQL services into a single API, eliminating the need for API duplication and service-side development for UI engineers.
  • With GraphQL Federation, there is no need for reactive programming or client libraries in Java, as the Federated Gateway handles communication with different services.
  • Microservices in a GraphQL Federation architecture can be large and complex and should be split based on team size rather than functionality.
  • Netflix created the DGS framework for building GraphQL services in Java.
  • Netflix and the Spring team have been working on full integration between DGS and Spring GraphQL, allowing developers to combine their programming models and features in the same app.

Platform Team and Tooling

  • Securing time to experiment with new technologies and upgrades is made possible by having a platform team that can allocate resources for such activities.
  • Investing more in developer tooling, such as intelligent plugins and automated tooling based on Gradle, can simplify version upgrades for Spring and other frameworks.
  • Supporting multiple languages, even within the same IDE like IntelliJ, increases the workload for platform teams due to the need for separate inspections and configurations.

Kotlin at Netflix

  • The percentage of Kotlin usage at Netflix is fairly low.
  • The only downside encountered with Kotlin was the lack of tooling and ecosystem maturity compared to Java.
  • Kotlin has proven to be a great language with many benefits.

Overwhelmed by Endless Content?