Skip to main content

Real architecture · Mid

Prime Video: from serverless microservices to a monolith (90% lower cost)

Real production architecture. Key points: Microservices vs. Monolith, Serverless Architecture, and Cost Optimization at Scale.

15 min read · Source: Prime Video · Content reviewed on October 23, 2026

Short answer

Real production architecture. Key points: Microservices vs. Monolith, Serverless Architecture, and Cost Optimization at Scale. Prime Video offers thousands of live streams and built a tool to monitor every stream watched by customers. It automatically identifies perceptual quality problems, such as block corruption or audio/video sync loss, and triggers a remediation process.

01 · CONTEXT

A tool that watches every stream

Prime Video offers thousands of live streams and built a tool to monitor every stream watched by customers. It automatically identifies perceptual quality problems, such as block corruption or audio/video sync loss, and triggers a remediation process.

The quality analysis team already had an audio and video inspection tool, but it was never designed for high scale: the goal was to monitor thousands of simultaneous streams. As more streams were added, the team saw that running the infrastructure at high scale was very expensive and that there were bottlenecks preventing it from reaching that number. The account is by Marcin Kolny, published on March 22, 2023.

The service has three pieces: a media converter, the defect detectors and the orchestration that controls the flow.

02 · THE SERVERLESS VERSION

Fast to build, expensive to scale

The first version was a distributed system with serverless components, orchestrated by AWS Step Functions and with detectors on AWS Lambda. According to the team, it was a good choice for building the service quickly. In practice, the way some components were used led to a hard scaling limit at about 5% of the expected load.

  1. The media converter receives the stream and turns it into decrypted frames or audio buffers that go on to the detectors.

    Architecture diagram: Monitoring with distributed serverless
    CLLive streams
    CPOrchestration (Step Functions)
    CPMedia converterconverts the stream
    DBFrame storage
    CPDetectores (Lambda)
    NWDefect notifications
  2. The converter temporarily sends the images to an object store.

    Architecture diagram: Monitoring with distributed serverless
    CLLive streams
    CPOrchestration (Step Functions)
    CPMedia converter
    DBFrame storagetemporary images
    CPDetectores (Lambda)
    NWDefect notifications
  3. Each detector is a separate microservice: it downloads the images and processes them in parallel with Lambda. The large number of calls to the storage was expensive.

    Architecture diagram: Monitoring with distributed serverless
    CLLive streams
    CPOrchestration (Step Functions)
    CPMedia converter
    DBFrame storageexpensive calls
    CPDetectores (Lambda)processes in parallel
    NWDefect notifications
  4. The orchestration made several state transitions per second of stream, so it hit account limits, and Step Functions charges per transition.

    Architecture diagram: Monitoring with distributed serverless
    CLLive streams
    CPOrchestration (Step Functions)limit and cost per transition
    CPMedia converter
    DBFrame storage
    CPDetectores (Lambda)
    NWDefect notifications
  5. When a detector finds a defect, it sends a real-time notification.

    Architecture diagram: Monitoring with distributed serverless
    CLLive streams
    CPOrchestration (Step Functions)
    CPMedia converter
    DBFrame storage
    CPDetectores (Lambda)
    NWDefect notificationsdefect alert

The two pain points were the orchestration and the data transfer between components.

When reading a box-and-arrow diagram, it is worth asking what each arrow costs.

03 · THE MONOLITH

Everything in a single process

The team first considered fixing the problems separately, ran experiments and decided to restructure the infrastructure. It realized the distributed approach did not bring many benefits in this case and merged all the components into a single process. Data transfer became in-memory, which eliminated the object store as an intermediary and simplified the orchestration.

  1. Converter, detectors and orchestration now run inside the same process.

    Architecture diagram: Monitoring as a monolith
    CLLive streams
    CPIn-process orchestrationsame process
    CPMedia convertersame process
    CPDetectoressame process
    NWDefect notifications
  2. Frames go from the converter to the detectors through the process's memory, with no intermediate object storage.

    Architecture diagram: Monitoring as a monolith
    CLLive streams
    CPIn-process orchestration
    CPMedia converter
    CPDetectoresreceives in memory
    NWDefect notifications
  3. The orchestration now controls the components inside a single instance, with simpler logic.

    Architecture diagram: Monitoring as a monolith
    CLLive streams
    CPIn-process orchestrationsimplified orchestration
    CPMedia converter
    CPDetectores
    NWDefect notifications
  4. The components are the same as in the previous design, so the team reused a lot of code and migrated quickly.

    Architecture diagram: Monitoring as a monolith
    CLLive streams
    CPIn-process orchestration
    CPMedia convertersame component
    CPDetectoressame component
    NWDefect notifications
  5. The detectors keep sending notifications when they find defects.

    Architecture diagram: Monitoring as a monolith
    CLLive streams
    CPIn-process orchestration
    CPMedia converter
    CPDetectores
    NWDefect notificationsdefect alert
Distributed serverlessMonolith in one process
OrchestrationStep Functions, with several state transitions per second of stream.Orchestration inside the same process, simpler.
Data between componentsTemporary images in object storage.Transfer in process memory.
DetectoresEach detector is a separate microservice.All run on the same instance.
InfraestruturaServerless components such as Lambda.Amazon EC2 and Amazon ECS.

04 · THE PRICE OF THE CHOICE

Scaling vertically and cloning the service

The monolith brought a limitation: since all the detectors run on the same instance, they can only scale vertically. The team adds detectors frequently and has already exceeded the capacity of a single instance.

The fix was to clone the service several times, each copy with a subset of detectors, and add a lightweight orchestration layer to distribute client requests.

  1. Client requests arrive at a lightweight orchestration layer, which distributes them.

    Architecture diagram: Monolith copies with subsets of detectors
    CLLive streams
    CPLightweight distribution layerdistributes requests
    CPCopy with one subset of detectors
    CPCopy with another subset
    CPCopy with yet another subset
    NWDefect notifications
  2. Each copy of the service is configured with a different subset of detectors.

    Architecture diagram: Monolith copies with subsets of detectors
    CLLive streams
    CPLightweight distribution layer
    CPCopy with one subset of detectorssome of the detectors
    CPCopy with another subsetanother part
    CPCopy with yet another subsetanother part
    NWDefect notifications
  3. The detectors within a single instance can only scale vertically; the fix was to clone the service.

    Architecture diagram: Monolith copies with subsets of detectors
    CLLive streams
    CPLightweight distribution layer
    CPCopy with one subset of detectorsvertical scaling
    CPCopy with another subset
    CPCopy with yet another subset
    NWDefect notifications
  4. The detectors in each copy send notifications when they find defects.

    Architecture diagram: Monolith copies with subsets of detectors
    CLLive streams
    CPLightweight distribution layer
    CPCopy with one subset of detectors
    CPCopy with another subset
    CPCopy with yet another subset
    NWDefect notificationsdefect alert

Another decision the post describes as non-obvious: the team replicated the expensive media conversion process and placed it close to the detectors. Converting once and caching the result might seem cheaper, but the team did not find it cost-effective.

05 · RESULTS AND LESSONS

What changed and what to take into the interview

According to the post, moving the service to a monolith cut infrastructure cost by more than 90% and increased scaling capacity. Today the service handles thousands of streams and still has room to grow. Running on Amazon EC2 and Amazon ECS also made it possible to use EC2 compute savings plans.

The changes make it possible to monitor all the streams viewers watch, not just the most popular ones.

In an interview, before splitting a system into services, ask where the arrows between components will be and what each one costs in price, in limits, and in data moved. If the scaling and cost bottleneck is precisely the communication between the pieces, merging them may be the answer; if the pieces have very different loads, splitting still makes sense.

Frequently asked questions

What is Prime Video: from serverless microservices to a monolith (90% lower cost)?

Real production architecture. Key points: Microservices vs. Monolith, Serverless Architecture, and Cost Optimization at Scale.

What does the Prime Video: from serverless microservices to a monolith (90% lower cost) design cover?

It is organized in these sections: A tool that watches every stream, Fast to build, expensive to scale, Everything in a single process, Scaling vertically and cloning the service, and What changed and what to take into the interview.

How long is Prime Video: from serverless microservices to a monolith (90% lower cost) and what level is it?

It takes about 15 minutes to read and is rated Mid level.

Now design it yourself

Run this case as an interview in the System Design school: you make the decisions, the tutor challenges them and you see how your design scores.