Recent Posts
Archives

Posts Tagged ‘Netflix’

PostHeaderIcon [AWSReInvent2025] How Netflix Connects Product Experiments to its AWS Bill

Lecturer

Chris Jantz is a Senior Data Scientist at Netflix, where he has spent over twelve years spearheading initiatives in data science, experimentation, and infrastructure optimization. His work focuses on leveraging large-scale data to drive product innovation while maintaining operational efficiency. Tushar Rao is a Senior Data Engineer at Netflix, specializing in building robust data pipelines and cloud infrastructure that bridge the gap between engineering metrics and business value. Together, Chris and Tushar have developed frameworks that allow one of the world’s largest streaming services to treat cloud costs not as a back-office concern, but as a critical design constraint for product development.

Abstract

In the highly competitive landscape of digital streaming, Netflix relies on a culture of continuous A/B testing to refine its user interface, recommendation algorithms, and content delivery. However, a significant challenge arises when a “winning” experiment—one that improves member engagement—inadvertently triggers a massive increase in cloud infrastructure costs that may outweigh its business value. This article explores the innovative framework developed by Netflix to connect product experiments directly to their AWS bill. By integrating granular infrastructure telemetry with experimental metadata, the organization has shifted from reactive cost management to a proactive model where cost is a primary design constraint. The discussion covers the methodology for identifying experimental impacts on cloud systems, the translation of technical metrics into financial projections, and the democratization of this data to empower decentralized decision-making across engineering teams.

The Culture of Continuous Experimentation and its Financial Shadow

Netflix has long been celebrated for its decentralized, “freedom and responsibility” culture, which empowers individual product teams to innovate rapidly. At the heart of this innovation is a sophisticated A/B testing platform that handles thousands of concurrent experiments. Every change, from the color of a “Play” button to the complexity of a machine learning model for artwork personalization, is subjected to rigorous testing to measure its impact on member retention and satisfaction. While this methodology has been instrumental in Netflix’s global success, it historically operated in a silo separated from the infrastructure costs required to support these changes.

Chris explains that when a product team launches a new feature, they typically focus on “North Star” metrics such as streaming hours or subscription renewals. However, every new feature exerts pressure on the underlying AWS infrastructure. A more accurate recommendation model might require higher compute power (Amazon EC2), or a high-fidelity UI component might increase data transfer costs across the Content Delivery Network (CDN). Without a direct link between the experiment and the AWS bill, the organization often discovered the financial implications of a successful test only after it had been rolled out globally, leading to unexpected surges in infrastructure spend. This “financial shadow” created a disconnect where a product win could potentially result in a net loss for the business.

Bridging the Gap: A Framework for Granular Cost Attribution

To address this challenge, Tushar and the engineering team developed a multi-layered framework designed to attribute infrastructure costs to specific experimental variants. The technical hurdle was significant: standard AWS billing data provides costs at the account or service level, but it does not naturally distinguish between traffic generated by “Cell A” (the control group) and “Cell B” (the experimental group) of an A/B test.

The methodology involves several key stages:

  1. Metadata Injection: Every request within the Netflix ecosystem is tagged with experimental metadata. This ensures that as a user interacts with the service, the logs generated by various microservices—whether they are calling a database, a cache, or a compute cluster—carry the identity of the specific test cell.
  2. Telemetry Aggregation: Using Amazon EMR and Apache Spark, Netflix aggregates these logs at massive scale. They correlate the experimental tags with resource utilization metrics, such as CPU cycles, memory usage, and I/O operations.
  3. Cost Translation: The team applies the specific AWS pricing models (Reserved Instances, Savings Plans, and On-Demand rates) to the utilization data. This allows them to calculate a “delta cost”—the difference in infrastructure spend between the control and the experimental groups.

{
  "experiment_id": "exp_ui_revamp_2025",
  "cell": "variant_b_high_res",
  "metrics": {
    "compute_utilization_ms": 4500,
    "data_transfer_gb": 0.015,
    "database_queries": 12
  },
  "projected_cost_per_user_annually": 0.12
}

By quantifying these metrics, Chris notes that teams can now see exactly how much an experimental change “costs” per member. This level of granularity transforms an abstract infrastructure bill into a tangible product metric.

From Reactive to Proactive: Cost as a Design Constraint

The ultimate goal of this framework is to move away from “policing” cloud spend and toward a culture where cost awareness is baked into the design process. Tushar emphasizes that once the data is available, it must be democratized. Netflix integrates these cost projections directly into its internal experimentation dashboard. When a product manager views the results of a test, they see not only the increase in user engagement but also the projected annual impact on the AWS bill if the feature is rolled out to the entire 280+ million member base.

This transparency allows for more nuanced trade-offs. For example, a new feature might increase engagement by 0.5% but also increase infrastructure costs by $10 million annually. Conversely, an engineering optimization might reduce engagement by a statistically insignificant amount while saving $20 million. In the past, the latter might have been viewed as a failure; today, it is recognized as a strategic efficiency gain.

Furthermore, this framework enables “early-warning” systems. If an experiment in its initial rollout phase (e.g., to 1% of users) shows a disproportionate spike in costs, the system can alert the owners before the test scales further. This proactive approach prevents the “surprise bill” phenomenon and encourages engineers to optimize their code and architecture during the development phase rather than as a post-hoc fix.

Conclusion: Balancing Innovation and Efficiency at Scale

The integration of product experiments with AWS billing represents a maturation of the DevOps and FinOps philosophies at Netflix. By treating cost as a primary design constraint, the company has successfully balanced its relentless drive for innovation with the economic realities of operating at extreme scale. Chris concludes that the value of this system lies not just in saving money, but in enabling smarter, faster decisions. When teams understand the full “all-in” cost of their decisions, they are empowered to build better, more efficient products that deliver maximum value to both the member and the business. This framework serves as a blueprint for any large-scale enterprise seeking to align its engineering velocity with its financial objectives in a cloud-native world.

Links:

PostHeaderIcon [MiamiJUG] How Scala Modernized the Java Ecosystem: A Functional Retrospective

Lecturer

Joan Goyeau is a Senior Playback Data Engineer at Netflix, where he specializes in building high-scale distributed systems using functional programming paradigms. He is a prolific contributor to the open-source community, with notable involvement in projects such as the Mill build tool, the Kubernetes Java/Scala Client, Cats, Apache Spark, and Avro4s. Joan’s expertise lies in leveraging the grammatical simplicity of Scala to manage complex data architectures in enterprise environments.

Abstract

This article explores the historical and technical relationship between Scala and Java, framing Scala as a primary driver of innovation for the Java Virtual Machine (JVM). By tracing the lineage of modern Java features—such as generics, lambdas, and records—to their origins in the Pizza and Scala languages, the analysis demonstrates how functional concepts have systematically transitioned into mainstream enterprise development. Furthermore, the study examines the practical advantages of Scala’s minimalist grammar and multi-platform compilation capabilities, specifically within the context of data engineering at scale.

The Evolutionary Lineage: From Pizza to Java 21

The modernization of the Java language is deeply rooted in experiments conducted over two decades ago. In 2001, the “Pizza” language emerged as a superset of Java 1.4, introducing a proof-of-concept for generics, lambdas, and pattern matching. While the Java ecosystem initially only adopted generics, the broader suite of functional features found a permanent home in Scala upon its release in 2004.

In the years following, a “trickle-down” effect occurred where Scala features were progressively integrated into the Java language specification. Java 8 introduced lambdas through the Stream API, Java 14 implemented record classes (conceptually identical to Scala’s case classes), and recent versions have refined pattern matching through switch expressions. This history identifies Scala not just as a standalone language, but as a vanguard for JVM innovation that tests “unknown lands” before they are deemed safe for Java’s more conservative adoption cycle.

Grammatical Simplicity and Language Complexity

A significant technical advantage of Scala is its relatively small formal grammar compared to other modern languages. Analysis of language grammar sizes reveals that while Java and C# have grown in complexity to accommodate specific use cases, Scala maintains a core simplicity that allows for high expressiveness through library definitions rather than language keywords. This design philosophy ensures that the cognitive load remains manageable even as the developer leverages powerful functional features. Notably, newer languages like Kotlin have already surpassed Scala in grammatical size, illustrating the efficiency of Scala’s architectural choices.

Multi-Platform Versatility and Modern Tooling

Beyond its influence on Java, Scala has evolved into a versatile language capable of targeting multiple execution environments. Using the Scala CLI—a streamlined alternative to heavy build tools—developers can manage dependencies and package applications with minimal boilerplate. A single Scala codebase can target:

  • The JVM: For traditional high-performance backend services.
  • Native: For low-latency binaries that run directly on hardware.
  • JavaScript (Scala.js): For front-end web development.

In the context of web development, libraries like Laminar allow developers to build reactive interfaces using type-safe functional structures. By replacing string-heavy HTML/JavaScript interactions with Scala’s rigorous type system, engineers can catch errors at compile-time that would typically manifest as runtime bugs in a traditional JavaScript stack.

Links:

PostHeaderIcon [KotlinConf2025] Closing Panel

The concluding panel of KotlinConf2025 offered a vibrant and candid discussion, serving as the capstone to the conference. The diverse group of experts from JetBrains, Netflix, and Google engaged in a wide-ranging dialogue, reflecting on the state of Kotlin, its evolution, and the path forward. They provided a unique blend of perspectives, from language design and backend development to mobile application architecture and developer experience. The conversation was an unfiltered look into the challenges and opportunities facing the Kotlin community, touching on everything from compiler performance to the future of multiplatform development.

The Language and its Future

A central theme of the discussion was the ongoing development of the Kotlin language itself. The panel members, including Simon from the K2 compiler team and Michael from language design, shared insights into the rigorous process of evolving Kotlin. They addressed questions about new language features and the careful balance between adding functionality and maintaining simplicity. A notable point of contention and discussion was the topic of coroutines and the broader asynchronous programming landscape. The experts debated the best practices for managing concurrency and how Kotlin’s native features are designed to simplify these complex tasks. There was a consensus that while new features are exciting, the primary focus remains on stability, performance, and enhancing the developer experience.

The State of Multiplatform Development

The conversation naturally shifted to Kotlin Multiplatform (KMP), which has become a cornerstone of the Kotlin ecosystem. The panelists explored the challenges and successes of building applications that run seamlessly across different platforms. Representatives from companies like Netflix and AWS, who are using KMP for large-scale projects, shared their experiences. They discussed the complexities of managing shared codebases, ensuring consistent performance, and maintaining a robust build system. The experts emphasized that while KMP offers immense benefits in terms of code reuse, it also requires a thoughtful approach to architecture and toolchain management. The panel concluded that KMP is a powerful tool, but its success depends on careful planning and a deep understanding of the underlying platforms.

Community and Ecosystem

Beyond the technical discussions, the panel also reflected on the health and vibrancy of the Kotlin community. A developer advocate, SA, and others spoke about the importance of fostering an inclusive environment and the role of the community in shaping the language. They highlighted the value of feedback from developers and the critical role it plays in guiding the direction of the language and its tooling. The discussion also touched upon the broader ecosystem, including the various libraries and frameworks that have emerged to support Kotlin development. The panel’s enthusiasm for the community was palpable, and they expressed optimism about Kotlin’s continued growth and adoption in the years to come.

Links:

PostHeaderIcon [DevoxxFR2014] Reactive Programming with RxJava: Building Responsive Applications

Lecturer

Ben Christensen works as a software engineer at Netflix. He leads the development of reactive libraries for the JVM. Ben serves as a core contributor to RxJava. He possesses extensive experience in constructing resilient, low-latency systems for streaming platforms. His expertise centers on applying functional reactive programming principles to microservices architectures.

Abstract

This article provides an in-depth exploration of RxJava, Netflix’s implementation of Reactive Extensions for the JVM. It analyzes the Observable pattern as a foundation for composing asynchronous and event-driven programs. The discussion covers essential operators for data transformation and composition, schedulers for concurrency management, and advanced error handling strategies. Through concrete Netflix use cases, the article demonstrates how RxJava enables non-blocking, resilient applications and contrasts this approach with traditional callback-based paradigms.

The Observable Pattern and Push vs. Pull Models

RxJava revolves around the Observable, which functions as a push-based, composable iterator. Unlike the traditional pull-based Iterable, Observables emit items asynchronously to subscribers. This fundamental duality enables uniform treatment of synchronous and asynchronous data sources:

Observable<String> greeting = Observable.just("Hello", "RxJava");
greeting.subscribe(System.out::println);

The Observer interface defines three callbacks: onNext for data emission, onError for exceptions, and onCompleted for stream termination. RxJava enforces strict contracts for backpressure—ensuring producers respect consumer consumption rates—and cancellation through unsubscribe operations.

Operator Composition and Declarative Programming

RxJava provides over 100 operators that transform, filter, and combine Observables in a declarative manner. These operators form a functional composition pipeline:

Observable.range(1, 10)
          .filter(n -> n % 2 == 0)
          .map(n -> n * n)
          .subscribe(square -> System.out.println("Square: " + square));

The flatMap operator proves particularly powerful for concurrent operations, such as parallel API calls:

Observable<User> users = getUserIds();
users.flatMap(userId -> userService.getDetails(userId), 5)
     .subscribe(user -> process(user));

This approach eliminates callback nesting (callback hell) while maintaining readability and composability. Marble diagrams visually represent operator behavior, illustrating timing, concurrency, and error propagation.

Concurrency Control with Schedulers

RxJava decouples computation from threading through Schedulers, which abstract thread pools:

Observable.just(1, 2, 3)
          .subscribeOn(Schedulers.io())
          .observeOn(Schedulers.computation())
          .map(this::cpuIntensiveTask)
          .subscribe(result -> display(result));

Common schedulers include:
– Schedulers.io() for I/O-bound operations (network, disk).
– Schedulers.computation() for CPU-bound tasks.
– Schedulers.newThread() for fire-and-forget operations.

This abstraction enables non-blocking I/O without manual thread management or blocking queues.

Error Handling and Resilience Patterns

RxJava treats errors as first-class citizens in the data stream:

Observable risky = Observable.create(subscriber -> {
    subscriber.onNext(computeRiskyValue());
    subscriber.onError(new RuntimeException("Failed"));
});
risky.onErrorResumeNext(throwable -> Observable.just("Default"))
     .subscribe(value -> System.out.println(value));

Operators like retry, retryWhen, and onErrorReturn implement resilience patterns such as exponential backoff and circuit breakers—critical for microservices in failure-prone networks.

Netflix Production Use Cases

Netflix employs RxJava across its entire stack. The UI layer composes multiple backend API calls for personalized homepages:

Observable<Recommendation> recs = userIdObservable
    .flatMap(this::fetchUserProfile)
    .flatMap(profile -> Observable.zip(
        fetchTopMovies(profile),
        fetchSimilarUsers(profile),
        this::combineRecommendations));

The API gateway uses RxJava for timeout handling, fallbacks, and request collapsing. Backend services leverage it for event processing and data aggregation.

Broader Impact on Software Architecture

RxJava embodies the Reactive Manifesto principles: responsive, resilient, elastic, and message-driven. It eliminates common concurrency bugs like race conditions and deadlocks. For JVM developers, RxJava offers a functional, declarative alternative to imperative threading models, enabling cleaner, more maintainable asynchronous code.

Links: