Library / Case Studies
What Powers Instagram: Hundreds of Instances, Dozens of Technologies
One of the questions we always get asked at meet-ups and conversations with other engineers is, “what’s your stack?” We thought it would be fun to give a sense of all the systems that power Instagram,...
By Tumblr engineers · Tumblr · Added 2026-10-12
All content belongs to Tumblr engineers / Tumblr. 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
Tumblr 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.
Databases Deep Dive · 11 minNormalisation and schema designOrganising tables so each fact is stored once, the first three normal forms in plain words, and when to break the rules on purpose.Read here
The idea in one sentence
Normalisation means organising data so that each fact is stored in exactly one place. When a fact is stored in many places, changes must be made in many places, and sooner or later they disagree.
The anomalies it prevents
Imagine one big
orderstable with the customer's name and email on every row.- Update anomaly: the customer changes email; you must update every order row, and missing one leaves two different emails.
- Insert anomaly: you cannot record a new customer until they place an order.
- Delete anomaly: deleting a customer's only order deletes the only record of the customer.
The first three normal forms, in plain words
100%Figure SDA-DDV-01-1 · Normal forms as three questions · © forcsguy.com
- 1NF: no repeating groups or lists in a cell (not
tags = "a,b,c"; use a related table); each row has a primary key. - 2NF: relevant when the key has several columns (like
order_id, product_id). A column such asproduct_namedepends on onlyproduct_id, so move it to aproductstable. - 3NF: a column must depend on the key, "the whole key and nothing but the key". If
zip_codedeterminescity, storecitywith the zip code table, not on every customer row.
Most application schemas aim for 3NF and stop there.
Keys and relationships
- Primary key: unique row identity. Prefer a stable surrogate id (for example a number or UUID) over data that can change, such as an email.
- Foreign key: a column referencing another table's key; the database then guarantees the referenced row exists.
- One-to-many: put the foreign key on the "many" side (
orders.customer_id). - Many-to-many: use a join table with two foreign keys (
book_authors). - Constraints (not null, unique, check) are free correctness: let the database enforce what it can.
CREATE TABLE customers (id BIGINT PRIMARY KEY, email TEXT NOT NULL UNIQUE, name TEXT NOT NULL); CREATE TABLE orders ( id BIGINT PRIMARY KEY, customer_id BIGINT NOT NULL REFERENCES customers(id), created_at TIMESTAMPTZ NOT NULL DEFAULT now() ); CREATE TABLE order_items ( order_id BIGINT NOT NULL REFERENCES orders(id), product_id BIGINT NOT NULL REFERENCES products(id), quantity INT NOT NULL CHECK (quantity > 0), unit_price_cents INT NOT NULL, -- copied on purpose: the price at purchase time PRIMARY KEY (order_id, product_id) );Notice
unit_price_centsis deliberately duplicated: the order must remember what was charged even if the product price changes. That is a snapshot, not an anomaly; the distinction is whether the value should change when the source changes.Denormalisation: breaking the rules on purpose
Normalised data needs joins to read. Sometimes reads dominate and joins are too costly. Common, deliberate denormalisation:
- Precomputed counts and totals (
likes_counton a post) updated with each change. - Copies of frequently read fields (author name on a post row) to avoid a join.
- Summary or reporting tables rebuilt periodically.
- Document stores that embed related data inside one record.
The price is keeping copies in sync: update both in one transaction, rebuild from the source on a schedule, or accept eventual consistency. Rule of thumb: normalise first; denormalise a specific, measured hot path, and document it.
OLTP and analytics
Transactional systems (OLTP) favour normalised schemas for correct writes. Analytical systems (OLAP) favour wide, denormalised tables, often a star schema (a central fact table of events with dimension tables around it), because they scan lots of data and rarely update it.
Habits that prevent pain
- Model the real-world facts first, then tables.
- Use clear, consistent names; pick one convention.
- Store money as integers (minor units) or exact decimals, never floating point.
- Store timestamps in UTC with time zone awareness.
- Prefer soft deletes (a
deleted_atcolumn) only where you need history, and index accordingly. - Plan changes as migrations (small, reversible, tested), not manual edits.
Real-world reading
Related reading
- LISA '10 - Operations at Twitter: Scaling Beyond 100 Million UsersYouTubeYouTube
- Espresso: Distributed Document Store at LinkedInLinkedIn engineers · LinkedInCase Studies
- Akutan: Distributed Knowledge Graph Store at eBayeBay engineers · eBayCase Studies
- How Twitter Stores 250 Million Tweets a Day Using MySQL - High Scalability -High Scalability engineers · High ScalabilityCase Studies
Show 6 moreShow fewer
- TAO: Distributed Data Store for the Social Graph at FacebookFacebookPapers
- Scaling Infrastructure at Instagram - Lisa Guo, Instagram EngineeringYouTubeYouTube
- Cassandra for Keeping Counts In Sync at SoundCloudSoundCloud engineers · SoundCloudCase Studies
- Roshi: Distributed Storage System for Time-Series Event at SoundCloudSoundCloud engineers · SoundCloudCase Studies
- What Powers Instagram: Hundreds of Instances, Dozens of TechnologiesTumblr engineers · TumblrCase Studies
- Zipkin: Distributed Systems Tracing at TwitterTwitter engineers · TwitterCase Studies
Go deeper on this
A path through videos, articles, other case studies and code on the same ideas as What Powers Instagram: Hundreds of Instances, Dozens of Technologies.
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…