EP107: Top 9 Architectural Patterns for Data and Communication Flow

This week’s system de sign refresher:


Register for POST/CON 24 | Save 20% Off (Sponsored)

Postman’s annual user conference will be one of 2024’s biggest developer events and it features a great mix of high-level talks from tech executives and hands-on training from some of the best developers in the world.

Use code PCBYTEBYTEGO20 and save 20% off your ticket!

Register Now


Top 9 Architectural Patterns for Data and Communication Flow

graphical user interface

Latest articles

If you’re not a paid subscriber, here’s what you missed.

  1. Embracing Chaos to Improve System Resilience: Chaos Engineering

  2. A Crash Course in CI/CD

  3. A Crash Course in IPv4 Addressing

  4. A Brief History of Scaling Netflix

  5. 15 Open-Source Projects That Changed the World

To receive all the full articles and support ByteByteGo, consider subscribing:

Subscribe now


How Netflix Really Uses Java?

Netflix is predominantly a Java shop.

Every backend application (including internal apps, streaming, and movie production apps) at Netflix is a Java application.

However, the Java stack is not static and has gone through multiple iterations over the years.

No alt text provided for this image

Here are the details of those iterations:

  1. API Gateway
    Netflix follows a microservices architecture. Every piece of functionality and data is owned by a microservice built using Java (initially version 8)

    This means that rendering one screen (such as the List of List of Movies or LOLOMO) involved fetching data from 10s of microservices. But making all these calls from the client created a performance problem.

    Netflix initially used the API Gateway pattern using Zuul to handle the orchestration.

  2. BFFs with Groovy & RxJava
    Using a single gateway for multiple clients was a problem for Netflix because each client (such as TV, mobile apps, or web browser) had subtle differences.

    To handle this, Netflix used the Backend-for-Frontend (BFF) pattern. Zuul was moved to the role of a proxy

    In this pattern, every frontend or UI gets its own mini backend that performs the request fanout and orchestration for multiple services.

    The BFFs were built using Groovy scripts and the service fanout was done using RxJava for thread management.

  3. GraphQL Federation
    The Groovy and RxJava approach required more work from the UI developers in creating the Groovy scripts. Also, reactive programming is generally hard.

    Recently, Netflix moved to GraphQL Federation. With GraphQL, a client can specify exactly what set of fields it needs, thereby solving the problem of overfetching and underfetching with REST APIs.

    The GraphQL Federation takes care of calling the necessary microservices to fetch the data.

    These microservices are called Domain Graph Service (DGS) and are built using Java 17, Spring Boot 3, and Spring Boot Netflix OSS packages. The move from Java 8 to Java 17 resulted in 20% CPU gains.

    More recently, Netflix has started to migrate to Java 21 to take advantage of features like virtual threads.


Top 6 Cloud Messaging Patterns

How do services communicate with each other? The diagram below shows 6 cloud messaging patterns.

No alt text provided for this image



🔹 Asynchronous Request-Reply
This pattern aims at providing determinism for long-running backend tasks. It decouples backend processing from frontend clients.

In the diagram below, the client makes a synchronous call to the API, triggering a long-running operation on the backend. The API returns an HTTP 202 (Accepted) status code, acknowledging that the request has been received for processing.

🔹 Publisher-Subscriber
This pattern targets decoupling senders from consumers, and avoiding blocking the sender to wait for a response.

🔹 Claim Check
This pattern solves the transmision of large messages. It stores the whole message payload into a database and transmits only the reference to the message, which will be used later to retrieve the payload from the database.

🔹 Priority Queue
This pattern prioritizes requests sent to services so that requests with a higher priority are received and processed more quickly than those with a lower priority.

🔹 Saga
Saga is used to manage data consistency across multiple services in distributed systems, especially in microservices architectures where each service manages its own database.

The saga pattern addresses the challenge of maintaining data consistency without relying on distributed transactions, which are difficult to scale and can negatively impact system performance.

🔹 Competing Consumers
This pattern enables multiple concurrent consumers to process messages received on the same messaging channel. There is no need to configure complex coordination between the consumers. However, this pattern cannot guarantee message ordering.

Reference: Azure Messaging patterns


What Are the Most Important AWS Services To Learn?

Since its inception in 2006, AWS has rapidly evolved from simple offerings like S3 and EC2 to an expansive, versatile cloud ecosystem.

No alternative text description for this image

Today, AWS provides a highly reliable, scalable infrastructure platform with over 200 services in the cloud, powering hundreds of thousands of businesses in 190 countries around the world.

For both newcomers and seasoned professionals, navigating the broad set of AWS services is no small feat.

From computing power, storage options, and networking capabilities to database management, analytics, and machine learning, AWS provides a wide array of tools that can be daunting to understand and master.

Each service is tailored to specific needs and use cases, requiring a deep understanding of not just the services themselves, but also how they interact and integrate within an IT ecosystem.

This attached illustration can serve as both a starting point and a quick reference for anyone looking to demystify AWS and focus their efforts on the services that matter most.

It provides a visual roadmap, outlining the foundational services that underpin cloud computing essentials, as well as advanced services catering to specific needs like serverless architectures, DevOps, and machine learning.

Over to you: What has your journey been like with AWS so far?


SPONSOR US

Get your product in front of more than 500,000 tech professionals.

Our newsletter puts your products and services directly in front of an audience that matters - hundreds of thousands of engineering leaders and senior engineers - who have influence over significant tech decisions and big purchases.

Space Fills Up Fast - Reserve Today

Ad spots typically sell out about 4 weeks in advance. To ensure your ad reaches this influential audience, reserve your space now by emailing [email protected].