Verdalia and Rutalia are alike in what matters: in both, every write is money, and a wrong piece of data is a serious problem. Brotes is something else. It is a social network for plant and gardening enthusiasts, with eight million users, where nobody pays, almost everyone looks, and very few write. In this lesson you will apply the eight-step method to a system in which the priorities are reversed. You will learn how the news feed is generated, which is the central problem of every social network, with its two models and the hybrid that combines them. And you will see how millions of “likes” are counted, how a list that never stops growing is paginated, and why here the data does have to be partitioned.

Aitana, head of platform at Brotes, tells the story at the Valencia meetup. Brotes is a fictitious company. A word of caution: a social network handles personal data, publishes third-party content, and may have underage users. Privacy, moderation, and regulatory compliance, including GDPR, must be reviewed with legal professionals.

Step 1: Functional Requirements and Scope

Function Description
Profiles Name, bio, photo, and the user's list of plants
Follow A user follows another, with no need for reciprocity
Post Text of up to 500 characters, with an optional photo
Feed The recent posts of the followed accounts, newest to oldest
“Likes” and comments On any visible post
Notifications Someone follows you, comments, or hits “like”
Search Of users and posts, by text and by plant

Video is left out; we will study it in the next lesson. Private messages and advertising are left out. And the feed is chronological: ranking it with recommendation models is a different problem, which belongs to the lesson “Architectures for Systems with Artificial Intelligence,” in Module 8.

What Sets It Apart From an E-Commerce System

Aspect Verdalia Brotes
Reads and writes 708 requests per order An even higher ratio, and on top of that the writes multiply when they fan out
Who creates the content The company: 15,000 reviewed products The users: 600,000 posts a day, unreviewed
What each user sees The same catalog A different feed for each one
Relationship between the data Orders, items, and products A graph: who follows whom
Consistency Strong at the checkout Eventual almost everywhere
Peaks Planned: the campaign has a date Unplanned: a post goes viral within an hour
Cost of a mistake A duplicate charge A “like” that takes 20 seconds to be counted

The third row is the one that weighs most. Verdalia's cache works because the olive tree page is the same for everyone. At Brotes there are a million and a half different feeds every day, and none of them can be shared.

Step 2: Quality Attributes and Scenarios

Scenario Stimulus Expected response
BS-1, performance A user opens their feed, with 417 opens per second 95th percentile under 300 ms
BS-2, scalability A post multiplies its traffic by 10 within an hour The rest of the network does not notice
BS-3, availability The service that generates the feeds fails The user sees a saved feed, even if it is not up to date. Target: 99.95%
BS-4, freshness A user posts Their followers see it in under 5 seconds, or under 60 if the account is very large
BS-5, security A post is reported It stops being shown in under 1 hour, after review

The order of priorities is: availability, performance, scalability, and, far behind, consistency. Scenario BS-4 would be unacceptable in a store. Here it is a design decision: a feed that arrives 5 seconds late is better than a feed that does not arrive.

Step 3: Scale Estimates

SECONDS_PER_DAY = 24 * 3600
DAILY_ACTIVE_USERS = 1_500_000          # out of 8 million registered users
PEAK_FACTOR = 3                         # Sundays, 8:00 p.m. to 10:00 p.m.

# Average activity of an active user, per day
FEED_OPENS, POSTS, LIKES, COMMENTS = 8, 0.4, 12, 1.5
POSTS_PER_PAGE = 20
AVERAGE_FOLLOWERS = 120
WITH_PHOTO = 0.70
MB_PER_STORED_PHOTO = 0.9               # compressed original and three variants
KB_PER_SERVED_PHOTO = 150               # the variant shown in the feed


def per_second(per_day):
    return per_day / SECONDS_PER_DAY


feed_reads = DAILY_ACTIVE_USERS * FEED_OPENS
posts = DAILY_ACTIVE_USERS * POSTS
writes = posts + DAILY_ACTIVE_USERS * (LIKES + COMMENTS)
print(f"Feed reads: {feed_reads / 1e6:.0f} million a day, {per_second(feed_reads):.0f} per second, "
      f"{per_second(feed_reads) * PEAK_FACTOR:.0f} at the peak")
print(f"Posts: {posts:.0f} a day, {per_second(posts):.1f} per second")
print(f"Writes, with likes and comments: {per_second(writes):.0f} per second")

posts_read = feed_reads * POSTS_PER_PAGE
print(f"Posts read for every one written: {posts_read / posts:.0f}")

fan_out = posts * AVERAGE_FOLLOWERS
print(f"Fan-out on write: {fan_out / 1e6:.0f} million inserts a day, "
      f"{per_second(fan_out):.0f} per second")
print(f"One post from the biggest account: 1,900,000 inserts, "
      f"{1_900_000 / 50_000:.0f} seconds at 50,000 per second")

gb_photos_per_day = posts * WITH_PHOTO * MB_PER_STORED_PHOTO / 1000
print(f"Photos: {gb_photos_per_day:.0f} GB a day, {gb_photos_per_day * 365 / 1000:.0f} TB a year")
print(f"Text and metadata, at 1 KB: {posts * 365 / 1e6:.0f} GB a year")
print(f"Precomputed feeds in memory: {DAILY_ACTIVE_USERS * 500 * 16 / 1e9:.0f} GB")

gbit = per_second(posts_read * WITH_PHOTO * KB_PER_SERVED_PHOTO) * 8 / 1e6
print(f"Photo bandwidth: {gbit:.1f} Gbit/s on average, {gbit * PEAK_FACTOR:.1f} at the peak")

Output:

Feed reads: 12 million a day, 139 per second, 417 at the peak
Posts: 600000 a day, 6.9 per second
Writes, with likes and comments: 241 per second
Posts read for every one written: 400
Fan-out on write: 72 million inserts a day, 833 per second
One post from the biggest account: 1,900,000 inserts, 38 seconds at 50,000 per second
Photos: 378 GB a day, 138 TB a year
Text and metadata, at 1 KB: 219 GB a year
Precomputed feeds in memory: 12 GB
Photo bandwidth: 2.3 Gbit/s on average, 7.0 at the peak

Explanation:

  • Everything starts from one figure, the daily active users, and from what an average user does. It is the usual way to estimate a system that does not exist yet.
  • per_second spreads a daily figure across the 86,400 seconds of the day. The peak is obtained by multiplying by a factor, which here is 3.
  • The precomputed feed stores, per user, 500 identifiers of 8 bytes. 16 bytes are counted per entry, because of the store's overhead.

Interpretation:

  • 400 posts are read for every one that is written. The system must optimize reading, even if that makes writing more expensive.
  • Each post becomes, on average, 120 writes. The 6.9 posts per second become 833 inserts if they are copied into the feed of every follower. And the average is misleading: a single post from the most-followed account is 1.9 million.
  • Photos are the storage: 138 TB a year, against 219 GB of text. And they are the bandwidth: 7 Gbit per second at the peak. Verdalia moved 194 Mbit.
  • The feeds of all active users fit in 12 GB of memory. The most queried piece of data in the system is also one of the smallest.

Step 4: High-Level Design

flowchart TB
    apps(["Web application and mobile apps"])
    cdn["CDN"]
    gateway["API gateway: authentication, limits, and routing"]
    subgraph services["Services"]
        users["Users"]
        social_graph["Social graph"]
        posts["Posts"]
        feed["Feed"]
        media["Media"]
        search["Search"]
        notif["Notifications"]
    end
    events["Event log"]
    fanout["Fan-out workers"]
    relational[("PostgreSQL: accounts")]
    wide_column[("Wide-column store: posts and followers")]
    cache[("In-memory cache: feeds and counters")]
    objects[("Object storage: photos")]
    index[("Search engine")]
    apps --> cdn --> objects
    apps --> gateway --> services
    users --> relational
    social_graph --> wide_column
    posts --> wide_column
    posts --> events
    events --> fanout --> cache
    events --> search --> index
    events --> notif
    feed --> cache
    media --> objects

Brotes has 85 people in engineering, in 11 teams. It meets the conditions we saw at Rutalia, and that is why its components are services. The API gateway, which Verdalia did not need, is justified here: there are seven services and three kinds of client, and someone has to authenticate, rate-limit, and route in a single place. The mobile apps add one more reason: a version installed two years ago keeps calling the same address, even though the services behind it have changed.

Step 5: Data Model and Choice of Data Stores

Data Store Partition key Reason
Accounts, credentials, and privacy settings PostgreSQL Not partitioned 8 million rows. They require strong consistency and transactions
Posts and comments Wide-column store, such as Apache Cassandra author_id Continuous writes, 219 GB a year, and always read by author or by identifier
Followers and following The same store, in two tables user_id See below
Precomputed feeds In-memory cache, clustered user_id 12 GB. They can be rebuilt
Counters In-memory cache, with a periodic copy to the store post_id They change every second
Photos Object storage and CDN 138 TB a year
Search index Search engine PostgreSQL full-text search does not reach this volume

The Social Graph

The “who follows whom” relationship is a graph. Graph databases exist, designed to traverse relationships several hops deep: the friends of the friends of my friends. Brotes does not need them, because its two questions are one hop deep: whom a user follows, and who follows them. It answers them with adjacency tables: following(user_id, followed_id) and followers(user_id, follower_id). Each relationship is stored twice, once in each table, so that both questions are answered by reading a single partition. It is a deliberate duplication, which in the relational model of Module 3 we would have avoided.

Partitioning, Yes This Time

In Module 4, Verdalia decided not to partition: it had 2 orders per minute and 6 GB. Brotes has 241 writes per second, which the fan-out multiplies, and hundreds of gigabytes a year. The partition key is the user, because almost every query asks for the data of one. The price is the one that lesson warned about: queries that cross users, such as search, need a separate store.

Step 6: Detailed Design of the Critical Points

The Feed: Fan-Out on Write or on Read

There are two ways to build a user's feed.

In fan-out on read, or the pull model, the feed is computed when the user opens it. The latest posts of each followed account are read, and merged.

In fan-out on write, or the push model, the feed is computed when someone posts. The post is copied into the stored feed of every follower, and opening the feed means reading a list that is already made.

flowchart LR
    subgraph write["Fan-out on write"]
        a1["Remei posts"] --> a2["One copy per follower"] --> a3["Stored feeds"]
        a4["Ana opens her feed"] --> a3
    end
    subgraph read["Fan-out on read"]
        b1["Remei posts"] --> b2["Remei's posts"]
        b4["Ana opens her feed"] --> b5["One query per followed account"] --> b2
    end
Aspect Fan-out on read Fan-out on write Hybrid
Cost of posting One write One per follower One per follower, except for large accounts
Cost of opening the feed One query per followed account One read One read, plus one per large account followed
Feed latency High, and grows with the number followed Low and constant Low
Freshness Immediate Delayed by the fan-out Immediate for large accounts
Inactive users Cost nothing A feed is computed for them that they will never open Fan-out only to active users
Weak point Users who follow many accounts Accounts with many followers Two paths to maintain

The weak point of fan-out on write is known as the celebrity problem. The most-followed account at Brotes, “La Huerta de Remei,” has 1.9 million followers. Each of its posts means 1.9 million copies, which keep the workers busy for 38 seconds and delay everyone else's.

The hybrid model combines the two. Normal accounts fan out on write. Those above a follower threshold do not fan out: their posts are added on read. At Brotes, the threshold is 50,000 followers, and 310 accounts exceed it.

The Three Models, in Python

import random
from collections import defaultdict

PAGE_SIZE = 20


class Feeds:
    """Generates each user's feed and counts the operations on the data stores."""

    def __init__(self, model, threshold=None):
        self.model = model                          # "write", "read", or "hybrid"
        self.threshold = threshold                  # followers from which there is no fan-out
        self.followers = defaultdict(set)           # author -> who follows them
        self.following = defaultdict(set)           # user -> whom they follow
        self.posts = defaultdict(list)              # author -> identifiers, in order
        self.feeds = defaultdict(list)              # user -> precomputed feed
        self.writes = self.reads = 0

    def follow(self, user, author):
        self.followers[author].add(user)
        self.following[user].add(author)

    def _fans_out(self, author):
        if self.model == "hybrid":
            return len(self.followers[author]) < self.threshold
        return self.model == "write"

    def post(self, author, post_id):
        self.posts[author].append(post_id)
        self.writes += 1
        if self._fans_out(author):
            for follower in self.followers[author]:
                self.feeds[follower].append(post_id)
                self.writes += 1

    def read_feed(self, user):
        candidates = []
        if self.model != "read":
            candidates += self.feeds[user][-PAGE_SIZE:]
            self.reads += 1
        for author in self.following[user]:
            if not self._fans_out(author):
                candidates += self.posts[author][-PAGE_SIZE:]
                self.reads += 1
        return sorted(candidates, reverse=True)[:PAGE_SIZE]


def simulate(model, threshold=None, users=2_000, following=30, seed=7):
    rng = random.Random(seed)                       # same seed: same experiment
    network = Feeds(model, threshold)
    for user in range(users):
        for author in rng.sample(range(users), following):
            if author != user:
                network.follow(user, author)
        if rng.random() < 0.60:                     # 60% follow account 0, the celebrity
            network.follow(user, 0)
    for post_id in range(1, 801):                   # 800 posts
        author = 0 if post_id % 100 == 0 else rng.randrange(1, users)
        network.post(author, post_id)
    before = network.writes
    network.post(0, 801)                            # one more post from the celebrity
    celebrity_cost = network.writes - before
    feeds = [network.read_feed(rng.randrange(1, users)) for _ in range(16_000)]
    return network, celebrity_cost, feeds


print(f"{'Model':12}{'Writes':>12}{'Reads':>10}{'Per read':>13}{'Celebrity':>12}")
results = {}
for model, threshold in (("write", None), ("read", None), ("hybrid", 500)):
    network, celebrity_cost, feeds = simulate(model, threshold)
    results[model] = feeds
    print(f"{model:12}{network.writes:>12}{network.reads:>10}"
          f"{network.reads / len(feeds):>13.1f}{celebrity_cost:>12}")

print("Followers of the celebrity:", len(network.followers[0]))
print("The three models return the same feeds:",
      results["write"] == results["read"] == results["hybrid"])

Output:

Model             Writes     Reads     Per read   Celebrity
write              35498     16000          1.0        1245
read                 801    489477         30.6           1
hybrid             24302     25992          1.6           1
Followers of the celebrity: 1244
The three models return the same feeds: True

Explanation of the code:

  • Feeds keeps four structures in memory, which at Brotes are four tables: followers, following, posts by author, and precomputed feeds. The writes and reads counters add one unit for each operation on a data store.
  • _fans_out decides the path. In the hybrid model it depends on the author's number of followers. In the other two, only on the model.
  • post always stores the post. If the author fans out, it also adds a copy to the feed of every follower.
  • read_feed gathers the candidates from two sources: the stored feed, and the posts of the authors who do not fan out. Then it sorts from highest to lowest and keeps 20. The identifiers grow over time, and sorting by identifier is sorting by date.
  • simulate creates 2,000 users, who follow 30 random accounts, and one celebrity, account 0, followed by 60%. The fixed seed makes the three experiments identical. There are 20 feed reads for every post, the same ratio as at Brotes.

Interpretation:

  • On write, reading costs 1 operation and posting, 44 on average. The celebrity's post costs 1,245.
  • On read the opposite happens. Posting costs 1, and each feed open, 30.6 queries. Since far more is read than written, the total is almost 10 times higher: 490,278 operations, against 51,498.
  • The hybrid does the least work: 50,294 operations. It saves 11,196 writes, those of the celebrity's nine posts, in exchange for 9,992 more reads. And above all it removes the spike: no post costs more than 500 writes.
  • All three return the same thing. They are three ways of computing the same result, with the cost in different places.

At Brotes, the fan-out is not done by the post service. It stores the post, emits the post.created event, and responds. The fan-out workers consume the event and write to the feeds, at their own pace. If work piles up, the feeds fall a few seconds behind, but posting stays fast. It is the queue from Module 3, with the same purpose.

Unique, Sortable Identifiers

With dozens of servers creating posts, a central counter would be a bottleneck and a single point of failure. The usual solution follows the Snowflake model, which Twitter published: a 64-bit identifier that each server generates on its own.

Bits Content What for
41 Milliseconds since a fixed date The identifiers grow over time
10 Number of the server that generates it Two servers never collide
12 Counter within the millisecond Up to 4,096 per millisecond per server

They are unique without coordination, and sorting them is sorting by date. The simulation depended on that property.

Cursor-Based Pagination

Offset pagination, with “page 3, 20 at a time,” fails on a list that changes. If 5 posts come in while the user is reading, the next page repeats 5 that they already saw. Besides, skipping 10,000 rows forces the database to read them. Cursor-based pagination asks for “the 20 before post 1004.” The cursor is the identifier of the last post received, and the query goes straight to its position.

A Minimal Posts API

The snippet is a reference, with Flask. It keeps the data in memory, and needs pip install flask.

# post-service/app.py
from flask import Flask, jsonify, request

app = Flask(__name__)
posts = {}                          # id -> post. In production, a wide-column store
next_id = 1000                      # in production, a distributed, sortable identifier


@app.post("/v1/posts")
def create_post():
    global next_id
    data = request.get_json(silent=True) or {}
    text = str(data.get("text", "")).strip()
    if not text or len(text) > 500:
        return jsonify({"error": "the text must be between 1 and 500 characters"}), 422
    next_id += 1
    post = {
        "id": next_id,
        "author_id": request.headers["X-User-Id"],      # set by the API gateway, after authenticating
        "text": text,
        "photo_id": data.get("photo_id"),               # the photo is uploaded separately, to the media service
    }
    posts[next_id] = post
    # Here the post.created event would be published, which triggers the fan-out to the feeds
    return jsonify(post), 201, {"Location": f"/v1/posts/{next_id}"}


@app.get("/v1/users/<user_id>/posts")
def user_posts(user_id):
    limit = min(int(request.args.get("limit", 20)), 50)
    cursor = int(request.args.get("cursor", 2**63))    # no cursor: from the most recent
    ids = sorted((i for i, p in posts.items()
                  if p["author_id"] == user_id and i < cursor), reverse=True)
    page = ids[:limit]
    has_more = len(ids) > limit
    return jsonify({
        "posts": [posts[i] for i in page],
        "next_cursor": page[-1] if has_more else None,
    })
  • @app.post and @app.get declare a route and its method. The /v1 prefix makes it possible to publish a new version without breaking the old apps.
  • The validation returns code 422 if the text is missing or too long. A successful creation returns 201 and the Location header, with the address of the new resource.
  • The service does not authenticate. It trusts the X-User-Id header, which the API gateway adds. That is only safe if the network prevents reaching the service by any other path, as we saw in Module 5.
  • limit has a maximum of 50. A client must not be able to request a million rows.
  • next_cursor is the identifier of the last post returned, or null if there are no more.

With five posts by user u-31, from 1001 to 1005, the request GET /v1/users/u-31/posts?limit=2 returns 1005 and 1004, with "next_cursor": 1004. Repeated with cursor=1004, it returns 1003 and 1002. The third returns 1001 and a null cursor.

The “Like” Counters

A viral post can receive 40,000 “likes” in an hour. Adding 1 to a column on each one would make thousands of writes compete for the same row.

Piece Design
The “like” One row, with the key (post_id, user_id). Repeating it does not create another: it is idempotent
The counter A number in the in-memory cache, incremented with an atomic operation
The durable copy Every 30 seconds, a process aggregates the increments and stores the total
What the user sees An approximate number, up to 30 seconds behind. Their own is shown instantly, on their own screen

It is eventual consistency, chosen one piece of data at a time, as in Module 4. Nobody makes a decision based on that number.

Step 7: Bottlenecks, Failures, and Trade-offs

Situation What happens Defense
Viral post Millions of reads of one post and its photo The CDN serves the photo. The post and its counter are in the cache
A large account posts 1.9 million copies Hybrid model: no fan-out
The fan-out workers fall behind The feeds lag Workers are added. The alert measures the age of the oldest event
A cache node is lost Feeds are lost They are rebuilt with fan-out on read, when opened
The feed service fails No new feed The app shows the last one it saved
Search or notifications fail That function does not respond The rest carries on. Each service has its circuit breaker

Real-time notifications deserve a mention. To notify without the user reloading, the server needs an open connection with each client. The two usual techniques are WebSocket, which is bidirectional, and server-sent events, or SSE, which go one way and are simpler. Both require servers that hold hundreds of thousands of connections, and that is state: a separate service, which scales differently from the rest.

Security has two fronts of its own here:

Front Measures
Moderation Automatic filters when a photo is uploaded, user reports, review by people, and a record of every decision
Privacy Private accounts, blocking between users, real deletion of data when an account is closed, and removal of the location embedded in photos

Deletion is harder than it seems: a deleted post is still copied into thousands of feeds, in the cache, and in the CDN. The design must anticipate how it is removed from each place, and within what time frame.

The accepted trade-offs: data is duplicated, counters are approximate, a feed can be 5 seconds behind, and there are seven services and five kinds of store to operate.

Step 8: Evolution and Recorded Decisions

Year Users Decision Reason
2019 Thousands A monolith, with PostgreSQL and fan-out on read The simplest. With 50 followed accounts, the feed was one query
2022 1 million Fan-out on write, with feeds in memory The feed's 95th percentile had reached 2.8 seconds
2023 3 million Posts in a partitioned wide-column store. First services The single database could not take more writes. There were already 40 people
2024 5 million Hybrid model, with a threshold of 50,000 followers “La Huerta de Remei” passed a million followers, and each of its posts delayed the others by 4 minutes
2026 8 million Aggregated counters and a single API gateway A viral post locked its own row

None of the 2019 decisions was a mistake. Brotes started like Verdalia, with a monolith and a database, and changed each piece when a measurement demanded it. Aitana summed it up like this: “If in 2019 we had built what we have today, we would not have made it to 2020.”

Common Mistakes and Tips

  • Designing for the average. The average number of followers is 120. The problem is caused by 310 accounts.
  • Demanding strong consistency where nobody needs it. An exact counter costs a lot, and nobody appreciates it.
  • Fanning out inside the request. Whoever posts must not wait for 50,000 feeds to be written.
  • Paginating a changing list by offset. It repeats and skips items.
  • Treating the feed cache as the primary store. It must be rebuildable.
  • Leaving moderation and deletion for later. They affect the data model, and adding them late forces you to redo it.
  • Copying the architecture of a network with a billion users. Brotes took seven years to need its own.
  • Practical tip. Before choosing a feed model, calculate three figures: reads per write, average followers, and the size of the biggest account.

Exercises

Exercise 1: The Threshold of the Hybrid Model

With the lesson's simulate function, run the hybrid model with thresholds of 10, 40, 500, and 5,000 followers. In the simulation, normal accounts have between 13 and 52 followers, and the celebrity, 1,244. Explain the results.

Exercise 2: Each Piece of Data, With Its Consistency

State whether it needs strong consistency or can accept eventual consistency, and why: an account's password; the number of followers shown on a profile; the list of blocked users; switching an account from public to private; the feed.

Solutions

Solution to Exercise 1

print(f"{'Threshold':>10}{'Writes':>12}{'Reads':>10}{'Per read':>13}")
for threshold in (10, 40, 500, 5_000):
    network, _, feeds = simulate("hybrid", threshold)
    print(f"{threshold:>10}{network.writes:>12}{network.reads:>10}{network.reads / len(feeds):>13.1f}")

Output:

 Threshold      Writes     Reads     Per read
        10         801    505477         31.6
        40       22795     58417          3.7
       500       24302     25992          1.6
      5000       35498     16000          1.0
  • Threshold of 10. Every account exceeds it, and none fans out. It is fan-out on read, with one useless read added: that of the stored feed, which is empty.
  • Threshold of 40. Some of the normal accounts are treated as celebrities. Each feed open makes 3.7 reads.
  • Threshold of 500. Only the celebrity is left out. It is the balance point.
  • Threshold of 5,000. Nobody exceeds it. It is pure fan-out on write, with its post of 1,245 copies.

The threshold is chosen by looking at the distribution of followers, and it must leave out very few accounts. Common mistake: lowering it to save writes. Every account left out adds a read to the feed of all its followers, and reads are 20 times more frequent.

Solution to Exercise 2

Data Consistency Reason
Password Strong After changing it, the old one must not work on any server
Number of followers Eventual It is a counter. Nobody decides anything with it
Blocked users Strong It is a protective measure. A block that takes a minute is a minute of harassment
Switching an account from public to private Strong It is a privacy decision. It must also apply to the copies, in the feeds and in the cache
Feed Eventual A delay of seconds harms nobody

The rule is the one from Module 4: what happens if someone acts on stale data. In a social network, almost everything can accept eventual consistency, except what affects people's safety and privacy.

Conclusion

In this lesson you have applied the eight-step method to a social network, and you have seen that the same familiar pieces are arranged differently when the numbers change. Brotes reads 400 posts for every one it writes, and that is why it precomputes the feeds. You have compared fan-out on read, fan-out on write, and the hybrid model, which solves the celebrity problem, and you have measured the cost of each with a simulation. You have met sortable identifiers, cursor-based pagination, aggregated counters, and adjacency tables. And you have seen that partitioning, which at Verdalia was excessive, at Brotes is a necessity.

There is one figure from step 3 that deserves a second look: photos take up 138 TB a year, more than 600 times what all the text takes up, and they consume almost all the bandwidth. At Brotes they are an accompaniment. The last speaker at the meetup is Óscar, architect at Savia Play, a platform of gardening courses and documentaries in video. In his system, the heavy content does not accompany the product: it is the product. An hour of video takes up thousands of times more than a photo, it has to reach a television and a phone with poor coverage without interruptions, and the CDN bill is the biggest line item in the budget. We will see it in the next lesson: “Case Study: Architecture of a Video-on-Demand Platform.”

© Copyright 2026. All rights reserved