Library / Case Studies
A 360 Degree View of the Entire Netflix Stack - High Scalability -
This is a guest repost by Chris Ueland , creator of Scale Scale , with a creative hig...
By High Scalability engineers · High Scalability · Added 2026-10-12
All content belongs to High Scalability engineers / High Scalability. We only link to it and give credit. Report a problem
Learn this case study
About 37 min left. Your work is saved as you go.
What you are about to study
High Scalability explains a real system. You should know the basics: caching, queues and replication.
Ideas you will meet
- Distributed Systems
- Consensus, time, failure and the fundamentals of scale-out.
What we already know about this
Our own lessons on these ideas. Read them here before you start, so it makes sense.
Software Design Essentials · 10 minStructural patterns: Adapter, Decorator, Facade, ProxyHow to compose objects and wrap existing code so pieces fit together, add behaviour and hide complexity.Read here
The goal
Structural patterns are about composing classes and objects into larger structures, often by wrapping existing ones, without changing them.
Adapter
Make an existing class fit the interface you need.
// Your code expects this interface Gateway { charge(cents: number, token: string): Promise<{ ok: boolean }> } // A third-party library with a different API class AcmePay { makePayment(req: { amount: number; source: string }): Promise<{ status: string }> {/*...*/} } class AcmeAdapter implements Gateway { constructor(private acme: AcmePay) {} async charge(cents: number, token: string) { const r = await this.acme.makePayment({ amount: cents / 100, source: token }); return { ok: r.status === "approved" }; } }Use it to wrap third-party and legacy code, and to keep vendor details out of your core. Swapping providers then means writing one new adapter.
Decorator
Add behaviour by wrapping an object that has the same interface. Wrappers stack in any order.
interface Weather { forecast(city: string): Promise<string> } class Logged implements Weather { constructor(private inner: Weather) {} async forecast(city: string) { console.time(city); const r = await this.inner.forecast(city); console.timeEnd(city); return r; } } class Cached implements Weather { private cache = new Map<string, string>(); constructor(private inner: Weather) {} async forecast(city: string) { if (!this.cache.has(city)) this.cache.set(city, await this.inner.forecast(city)); return this.cache.get(city)!; } } const service: Weather = new Logged(new Cached(new RealWeather()));Typical uses: logging, caching, retries, authentication, compression, metrics. HTTP middleware is this idea.
Decorators stack like layers
100%Figure SDA-SDE-04-1 · Wrapping a service with logging and caching · © forcsguy.com
Facade
A simple front over a complex subsystem.
class VideoConverter { // the facade convert(file: string, format: "mp4" | "webm") { const audio = new AudioExtractor().extract(file); const frames = new FrameDecoder().decode(file); return new Encoder().encode(frames, audio, format); } }Callers use
convert, not five classes. It reduces coupling and gives you a stable surface to keep when internals change. Do not let it become a "god object" that does everything.Proxy
A stand-in with the same interface that controls access to the real object.
Kind Purpose Virtual proxy Create or load the real object only when needed (lazy loading) Protection proxy Check permissions before forwarding Remote proxy Hide that the real object is on another machine (RPC stubs) Caching or logging proxy Add cross-cutting behaviour The structure matches a decorator; the intent differs: control access versus add behaviour.
Composite
Treat individual objects and groups of them uniformly, usually as a tree.
interface Node { size(): number } class File implements Node { constructor(private bytes: number) {} size() { return this.bytes; } } class Folder implements Node { constructor(private children: Node[]) {} size() { return this.children.reduce((sum, c) => sum + c.size(), 0); } }A caller asks any node for its
size()without caring whether it is a file or a folder. Used for file systems, UI component trees and organisation charts.Bridge and Flyweight (briefly)
- Bridge: split an abstraction from its implementation so each can vary independently. Example: shapes (circle, square) times renderers (screen, PDF), without a class for each combination.
- Flyweight: share the common, unchanging part of many similar objects to save memory (for example one glyph shape reused for every occurrence of a letter).
Choosing
Need Pattern Make an incompatible API fit Adapter Add behaviour without editing or subclassing Decorator Simplify a complicated subsystem Facade Control, defer or guard access Proxy Treat part and whole alike Composite All of them work by delegation: an object that holds another and forwards calls, adding something on the way.
Real-world reading
Related reading
- ByteByteGo: System Design Video SeriesAlex Xu · ByteByteGoYouTube
- tCache: Scalable Data-aware Java Caching at TrivagoTrivago engineers · TrivagoCase Studies
- Cross-Region Caching Library at WixWix engineers · WixCase Studies
- Standardize and Improve Microservices Caching at DoorDashDoorDash engineers · DoorDashCase Studies
Show 6 moreShow fewer
- Pycache: In-process Caching at QuoraQuora engineers · QuoraCase Studies
- Scaling Memcache at Facebook (paper)Nishtala et al. · Meta (Facebook)Papers
- Prefetch Caching of Items at eBayeBay engineers · eBayCase Studies
- ByteByteGo NewsletterAlex Xu and Sahn Lam · ByteByteGoPodcasts & Newsletters
- Logging and Aggregation at QuoraQuora engineers · QuoraCase Studies
- A 360 Degree View of the Entire Netflix Stack - High Scalability -High Scalability engineers · High ScalabilityCase Studies
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as A 360 Degree View of the Entire Netflix Stack - High Scalability -.
Warm upGet the vocabulary first.
Books · Free from the author
Concurrent and Distributed Systems (Cambridge lecture notes)
Eight lectures on time, broadcast, replication, consensus and transactions, with notes, slides and video. Free from the author under CC BY-SA.
University of CambridgeIntermediate
Books · Free from the author
Computer Networks: A Systems Approach
How networks are built and why: protocols, routing, congestion control and the internet's architecture. The authors publish it free online under CC BY 4.0.
Systems ApproachIntermediate
WatchHow others solve the same problem, on video.
Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)
ReadEngineers explain it in their own words.
Blogs · Free from the author · Read here
Scalable Web Architecture and Distributed Systems
A full chapter on the building blocks of large websites: availability, performance, reliability, scalability, caches, proxies, indexes, load balancers and queues. Free to read here under CC BY 3.0.
The Architecture of Open Source ApplicationsBeginner40 min
Papers · Read here
Facebook’s photo storage
This paper describes Haystack, an object storage system optimized for Facebook’s Photos application. Facebook currently stores over 260 billion images, which translates to over 20 petabytes of data.
USENIXIntermediate
See it in another companyThe same ideas, a different system.
Case Studies · Read here
Aroma: Using ML for Code Recommendation at Facebook
Thousands of engineers write the code to create our apps, which serve billions of people worldwide. This is no trivial task—our services have grown so diverse and complex that the codebase contains…
FacebookIntermediate
Case Studies · Read here
Brooklin: Distributed Service for Near Real-Time Data Streaming at LinkedIn
Brooklin—a distributed service for streaming data in near real-time and at scale—has been running in production at LinkedIn since 2016, powering thousands of data streams and over 2 trillion messages per day. Today, w...
LinkedInIntermediate
Read the codeSee how it looks when it is real.
GitHub
Engineering Blogs
A huge directory of company engineering blogs to learn from real production systems.
kilimchoiIntermediate
GitHub
Awesome Scalability
Curated reading list of articles on the architecture of scalable, reliable systems.
binhnguyennusIntermediate
Keep learning
Loading community…