As a backend engineer, I used Grokking Modern System Design Interview to prepare for interviews, and I spent most of my study time on the data and messaging topics. This post covers database types, the messaging queue, rate limiter math, application programming interface (API) design, and the gaps the course closed for me.

Database types and trade-offs

Picking a database from habit is easy. The lesson on database types pushes you to name the access pattern first. It separates relational databases from NoSQL families such as key-value, document, columnar, and graph, and explains when each fits.

Practical tip: Ask three questions before choosing a database. What shape is the data, how will it be read, and how strict must consistency be? “Mostly reads by key” or “relationships between users” points to the right type faster than a product name does.

What helps the lesson stick is seeing each type inside a course design. The news feed keeps user relationships in a graph database. The course’s ChatGPT-like design keeps recent chat history in a Redis cache, stores ratings in a relational database, and puts comments in a document database. TinyURL uses MongoDB, a document database, because its mappings are independent and read-heavy.

In an interview, turn the three questions into one sentence that names the choice and its cost. For TinyURL, that might be “The data is independent short-link mappings read far more often than written, so I’d use a document store, and the cost is weaker support for joins across records.”

Database types and where the course designs use them
Database types and where the course designs use them

Replication shows up next in the queue design, where queue data is copied with a primary-secondary or quorum-style approach, so the data replication lesson is worth reading right after.

Distributed messaging queue lesson

The messaging queue lessons are where abstractions gave way to internals. In part one of the design, requests reach a load balancer and then stateless frontend servers, which also deduplicate requests. The metadata about queues has to scale, and the design shards and replicates it. Queue data is replicated with a primary-secondary or quorum-like approach, and partitioned with a consistent hashing-like scheme when a queue outgrows one server.

How one message travels through a distributed messaging queue
How one message travels through a distributed messaging queue

Follow one message to the queue named “orders,” as the figure does. A frontend drops it if it is a duplicate, asks the metadata service which broker owns “orders,” and forwards it there. The broker replicates it across the cluster, and cluster managers coordinate placement, membership, and failover.

Practical tip: Try placing a queue by hand. Picture a ring with positions 0 to 99 and brokers at 10, 40, and 70. A queue named “orders” hashes to 55, so it goes to the next broker clockwise, at 70. Add a broker at 60 and only queues landing between 40 and 60 move, so “orders” now goes to 60 and every other queue stays put.

In practice, frontend deduplication stops one request from being appended twice, but a consumer can still receive the same message twice. Suppose a consumer sends an email, crashes before acknowledging the message, and gets it again on redelivery. If each message carries a stable identifier (ID) and the consumer records the IDs it has handled, the second delivery is recognized and no second email goes out.

The second part compares two replication models, a primary-secondary arrangement and a cluster of independent hosts. Running queues in production, I knew producers and consumers well, and these lessons added the pieces behind them.

Rate limiter algorithms

Algorithms stick when you can run them by hand, and the rate limiter algorithms lesson rewards that. Take a token bucket with a capacity of three that refills three tokens a minute:

  1. It starts full, with 3 tokens.
  2. Four requests arrive together. Three take a token and pass, and the fourth finds the bucket empty and is blocked.
  3. One token returns every 20 seconds, so a request at 20 seconds passes and one at 30 seconds is blocked.
  4. Left idle, the bucket refills only up to its capacity of 3.

A fixed window counter has a different weakness. With a limit of 10 requests per minute, a client can send 10 near the end of one window and 10 near the start of the next. Each window stays within its limit, but twice the limit passes around the boundary.

The sliding window counter closes that gap by blending two windows. Suppose a request arrives 15 seconds into the current minute, so 45 seconds of the previous minute still overlap the trailing 60 seconds. The previous window saw 88 requests and the current one has seen 12, so the estimate is 88 × 45/60 + 12 = 78, under a limit of 100. If the current window had already seen 40, the estimate would be 88 × 45/60 + 40 = 106, and the request would be blocked.

Watch out: The sliding window counter assumes requests in the previous window were spread evenly. That approximation is usually fine, but say so in an interview.

A sliding window log would be exact but stores a timestamp per request. For 1 million clients at a limit of 100, that could mean up to 100 million timestamps, against 2 million counts for the counter.

Three rate limiter algorithms on one timeline
Three rate limiter algorithms on one timeline

I’d frame the choice as memory against burst tolerance, and I’d say which one the system can afford before naming an algorithm.

API design in RESHADED

In RESHADED, the course’s eight-step answer structure, API design is the bridge between requirements and storage, because each endpoint turns a requirement into a contract the data layer must serve. The sharded counters design shows this well. Its createCounter call takes a number_of_shards value chosen with heuristics such as follower count and post type. writeCounter spreads writes across shards, and readCounter aggregates them, so the shard count is a decision the caller can reason about. For example, a busy account’s post might get ten shards and an ordinary post one or two. If four shards hold 120, 95, 110, and 105, readCounter adds them and returns 430.

TinyURL gives a second example. Its shortening call takes an api_dev_key, the original Uniform Resource Locator (URL), and optional alias and expiry values. The api_dev_key identifies the caller, which is what lets the rate limiter apply a limit per user.

Practical tip: For each endpoint, write down which requirement it serves and which parameter makes that requirement enforceable.

Treating the API as the link between requirements and storage keeps a design from jumping to schemas too early.

Backend gaps the course filled

Three gaps tend to hide behind daily backend work, because production systems run well without anyone naming them:

  • Database choice: Defaults make the choice for you, so the access pattern never gets named.
  • Queue internals: A managed service hides metadata, partitioning, and failover.
  • Rate-limit math: Limits usually arrive as configuration values, so the arithmetic goes unseen.

For me, queue internals were the real gap. I had run queues for years without thinking about how metadata and partitions were managed, and the two messaging queue lessons filled that in.

If you work on the backend, pick the topic where your intuition is weakest and rebuild it from the lesson, writing the numbers out by hand. Use a mock interview to check whether you can explain it out loud. Keep the rest at skim level, and your preparation stays focused on the parts of the stack you can’t yet defend.