Why Prime Video moved a microservices tool back into one process
Amazon's video-quality monitoring tool cost too much and hit a scaling wall as a serverless pipeline. Rebuilt as one process, it cost over 90% less. What actually changed, and what it does not prove.
9:56 video5 min read
- 3 architecture diagrams
- 1 self-check
90%+
infrastructure cost reduction, as reported by Amazon
1
process instead of a chain of Lambda functions
0
network hops between detectors
On this page10 sections
- It was one tool, the video-quality monitor, not all of Prime Video.
- The bill came from orchestration steps and from passing video through S3, not from "having services".
- The fix put the pipeline in one process and passed data in memory.
- Split a system to separate teams and deploys, not just because the diagram looks modern.
Chapters
- 0:00Hook: Amazon deleted their microservices (opens the video at this moment on YouTube)
- 0:43What Prime Video was actually monitoring (opens the video at this moment on YouTube)
- 1:54The original microservices architecture (opens the video at this moment on YouTube)
- 3:12The two problems that broke everything (opens the video at this moment on YouTube)
- 4:28What microservices are really for (opens the video at this moment on YouTube)
- 5:28The monolith rewrite (opens the video at this moment on YouTube)
- 6:37Why this made engineers uncomfortable (opens the video at this moment on YouTube)
- 7:42The real lesson: right tool, right problem (opens the video at this moment on YouTube)
- 8:56Separate the teams, not the tasks (opens the video at this moment on YouTube)
In March 2023 an Amazon Prime Video engineering post said a monitoring tool had been rebuilt and now cost over 90% less to run. The internet read it as "monoliths beat microservices". That is the wrong lesson, and the real one is more useful.
Prime Video watches the streams customers actually receive and looks for defects a viewer would notice: corrupted blocks of video, and audio that drifts out of sync with the picture. The tool that does this is a video quality monitor. It is one internal service. It is not Prime Video as a whole, and the post never said the rest of the company moved off microservices.
The job has three steps, and the cheap, fast, complete version is the one that matters:
The requirement is to check every stream, not a sample. That means the cost of checking one stream has to be tiny, because it is multiplied by every stream.
The first version was built the way serverless tutorials teach it. Each step was its own component. The detectors ran as separate AWS Lambda functions, and AWS Step Functions decided what ran next. Between steps, the intermediate data (frames and audio buffers) was written to Amazon S3 and read back by the next step.
On a slide this is tidy. Each piece scales alone and can be changed alone.
Two separate things went wrong, and it helps to keep them apart.
- Cost. Step Functions bills per state transition, and S3 bills per request. With many streams, each passing through many steps, both meters ran constantly. The bill came from the number of hops, not from the amount of computing.
- A scaling ceiling. Amazon reported hitting a hard limit at only a small fraction of the load it expected, in the region of 5%. Moving large video data between functions over the network, with orchestration in the middle, did not scale the way the diagram suggested.
Neither is a bug you patch. Both follow from the design: every boundary between steps costs money and time, and this pipeline had a lot of boundaries.
The team put the whole pipeline in one process and ran it as a container on Amazon ECS (backed by EC2). The detectors became modules in that program. Frames moved between them as in-memory objects. The orchestration that Step Functions had provided became ordinary code: decide which detector to run next, and run it.
Amazon reported infrastructure cost down by more than 90%, and the system could scale well past the earlier ceiling. They also gained cheaper pricing options for steady EC2 and ECS capacity, which a bursty serverless design cannot use.
Be careful with the conclusion.
A fair reading is narrower:
- Serverless orchestration with per-step pricing is a poor fit for a high-volume pipeline that runs every step for every item.
- Passing large payloads between separate deployments is expensive. Keeping them in memory is not.
- Splitting a system has a price. You should be able to name what you are buying.
Here is the framing the video uses, and we want to be honest that it is an interpretation, not something Amazon's post states. Microservices mostly solve an organizational problem: they let many teams build, deploy and scale parts of a system independently. If one small team owns one tightly coupled pipeline whose steps always run together, you pay the cost of the split and receive little of the benefit.
- Are you splitting teams or splitting work? Twenty teams colliding in one codebase is a strong reason to split. Three engineers on one pipeline usually is not.
- Is the data naturally apart or together? A feed assembled from independent sources is already apart. A pipeline where step two needs step one's output is together, and splitting it adds network hops.
- What is actually slowing you down? If teams wait on each other's releases, services help. If the problem is latency or cost inside one flow, a single process often wins.
QuestionWhy did replacing Step Functions and S3 handoffs with an in-memory loop cut the cost so much?Reveal answer
Both were billed per operation (state transitions and requests). The pipeline performed many such operations for every stream, so the cost scaled with the number of hops. In one process the hand-off is a function call and costs nothing extra.
The lesson on queues and asynchronous work covers when splitting work across components helps. For how to reason about these choices out loud, see how to approach a system design interview.
- Amazon Prime Video Tech, "Scaling up the Prime Video audio/video monitoring service and reducing costs by 90%" (March 2023), primevideotech.com (opens in a new tab).
- InfoQ, Prime Video reduces costs by moving to EC2 and ECS (opens in a new tab).
- DevClass, Reduce costs by 90% by moving from microservices to monolith (opens in a new tab).
- The Stack, Prime Video monolith architecture debate (opens in a new tab).
Spot a mistake, or have a question?
Accuracy matters here. Tell me what looks wrong or unclear and I will fix it and credit you.