skip to content

Scalability & System Design

Capacity estimates, load balancing, caching, sharding and rate limiting, plus the systems built from them: search, feeds, proximity, schedulers and file stores. Design rounds are built from these.

part ofDistributed & scalable systemsoverview, primer and where to startread it →
on this pageshow

explore

questions

419 · 15 sections

You're asked in an interview to estimate the average and peak queries-per-second (QPS) for a social app with 10 million daily active users (DAU), where each user makes about 20 read requests per day. Walk through how you'd compute average QPS and peak QPS, and why the two numbers differ.

level: juniorimportance: must knowfreq 92%
basics
~10 s

Multiply users by requests per user for total daily requests, divide by seconds in a day for average rate. Peak is higher because usage bunches at busy hours, so multiply average by 2-3x.

open as a page

A checkout service is measured at 1,200 requests/second average and 3,000 requests/second at its daily peak hour. Its owning team wants to know how many servers to run if each server can safely sustain 150 requests/second. How should peak traffic and headroom, not just the average, shape that server count?

level: middleimportance: must knowfreq 80%
basics
~20 s

Never size servers off the average - size off the busiest moments plus extra room. Take the peak number, divide by what one server handles, then add a safety margin so a small spike doesn't cause an outage.

open as a page

A photo-sharing service has 2 million new photo uploads per day, each stored as an original file averaging 3 MB plus two generated thumbnails averaging 200 KB combined, and everything is kept for 5 years with 3x replication for durability. How would you estimate the total storage the service needs to provision?

level: middleimportance: must knowfreq 85%
basics
~20 s

Add up what one upload creates (photo plus thumbnails), multiply by uploads per day, then by days you keep them, then multiply again by how many safety copies you store (replication). That total is your storage budget.

open as a page

An engineer is designing an API endpoint that, per request, does one in-memory cache lookup, and is deciding whether to also add a synchronous call to a database in the same region versus a synchronous call to a service in a different geographic region. What rough latency numbers should they know off the top of their head to reason about this trade-off, and how do those numbers actually change the design decision?

level: seniorimportance: should knowfreq 70%
basics
~20 s

Memory is nanosecond-fast, an SSD read is a fraction of a millisecond, a same-datacenter round trip is about half a millisecond, and a round trip to another continent is over 100ms - a cross-region call will dominate response time.

open as a page

You're asked to estimate outbound network bandwidth for a video-streaming service with 5 million concurrent viewers, each streaming at an average bitrate of 4 Mbps, and to state how confident you are in the resulting number. Walk through the bandwidth calculation, then explain where this kind of back-of-envelope reasoning tends to break down in the real world and what you'd do to compensate.

level: principalimportance: should knowfreq 55%
basics
~20 s

Multiply people watching at once by data used per stream for the total pipe needed. Real traffic isn't evenly spread across servers, so this is a starting point, not the final answer - real measurements and margin are still needed.

open as a page

What problem does a load balancer solve, and what is the practical difference between the round-robin and least-connections algorithms for distributing requests across backend servers?

level: juniorimportance: must knowfreq 85%
basics
~20 s

A load balancer spreads incoming requests across many servers so no single one gets overloaded and the app stays up if one server dies. Round-robin just takes turns in order; least-connections sends the next request to whichever server currently has the fewest requests in flight.

open as a page

What is the difference between an L4 (transport-layer) and an L7 (application-layer) load balancer, and what routing or scaling decisions can an L7 balancer make that an L4 balancer cannot?

level: middleimportance: must knowfreq 80%
basics
~20 s

An L4 load balancer only looks at IP addresses and TCP/UDP ports and just forwards packets, without knowing what's inside. An L7 load balancer reads the actual HTTP request (URL, headers, cookies) and can route based on that content, but doing so costs more CPU and adds latency.

open as a page

What is session affinity (sticky sessions) in a load balancer, how is it typically implemented, and what breaks when the backend a client is pinned to becomes unavailable?

level: middleimportance: must knowfreq 70%
basics
~20 s

Session affinity means the load balancer sends all of one client's requests to the same backend server, usually to keep server-stored session data (like a login session) working. It's typically done with a cookie identifying the server. If that server goes down, the client loses that session state unless it's shared elsewhere.

open as a page

How do active and passive health checks work in a load balancer, and what production failure modes can occur if health-check thresholds are configured too aggressively or too loosely?

level: seniorimportance: must knowfreq 75%
basics
~20 s

Active health checks are the load balancer regularly pinging each server with a test request to see if it's alive. Passive health checks watch real traffic and mark a server unhealthy if its actual responses start failing. Bad thresholds can either kick out healthy servers too fast or take too long to notice a broken one.

open as a page

Why is consistent hashing used as a load-distribution strategy instead of plain modulo hashing, and what problem does it specifically solve when backend servers are added or removed?

level: seniorimportance: should knowfreq 55%
basics
~20 s

Plain modulo hashing (key % number-of-servers) reshuffles almost every key's assigned server whenever a server is added or removed, which is disastrous for caches. Consistent hashing arranges servers and keys on a ring so that adding or removing one server only reassigns a small fraction of keys, not nearly all of them.

open as a page

A web app serves the same product page thousands of times per minute. What is caching, and how do different cache layers (CDN, reverse proxy, application, database) each help reduce load on the origin?

level: juniorimportance: must knowfreq 85%
basics
~20 s

Caching means saving a copy of data somewhere fast so you don't have to redo slow work every time. Different layers (CDN, reverse proxy, app memory, database) each keep a copy closer to where it's needed, so fewer requests reach the slow original source.

open as a page

In a cache-fronted lookup service, what is cache penetration, and how does it differ from an ordinary cache miss?

level: juniorimportance: must knowfreq 68%
basics
~20 s

Cache penetration is traffic for keys that exist in neither the cache nor the database, so nothing ever gets cached and every repeat reaches the database. An ordinary miss loads the row once, and later requests hit.

open as a page

A cache with limited memory must decide which entries to evict when it's full. Compare LRU (Least Recently Used), LFU (Least Frequently Used), and TTL (Time To Live) eviction policies — how does each decide what to remove, and when would you pick one over another?

level: middleimportance: must knowfreq 75%
basics
~20 s

When a cache runs out of space, it has to throw something away. LRU throws out the item nobody's touched in the longest time. LFU throws out the item used the fewest times overall. TTL just deletes items after a fixed amount of time, whether or not they're popular.

open as a page

In a sharded cache that places keys with consistent hashing, why does adding more nodes fail to relieve a node overloaded by one hot key?

level: middleimportance: must knowfreq 62%
basics
~20 s

A sharded cache places whole keys, so all of one key's traffic goes to its single owner node. Adding nodes only moves whole keys around, so a key that needs more than one node's capacity stays overloaded wherever it lands.

open as a page

In a lookup service that caches 'not found' results, how should a negative entry be represented and expired?

level: middleimportance: must knowfreq 60%
basics
~10 s

Store a reserved tombstone value that readers can tell apart from a cache miss, write it only for a confirmed no-row result, and give it a short TTL so a later-created item appears quickly.

open as a page

When would you choose a key-value store over a relational database, given how each one stores and queries data?

level: juniorimportance: must knowfreq 72%
basics
~20 s

A relational database stores typed rows and answers flexible SQL queries with joins and multi-row transactions; a key-value store only gets and puts a value by its key. Choose key-value when every access is a lookup by a known key.

open as a page

What is the difference between vertically scaling a database (upgrading to a bigger server) and horizontally scaling it (adding more servers such as read replicas), and what is one major limitation of vertical scaling?

level: juniorimportance: must knowfreq 70%
basics
~20 s

Vertical scaling means giving one database server more CPU/RAM/disk. Horizontal scaling means adding more database servers and spreading the work across them. Vertical scaling is simple but hits a hardware ceiling and stays a single point of failure.

open as a page

What is the difference between primary-replica (leader-follower) replication and multi-primary (multi-leader) replication in a distributed database?

level: juniorimportance: must knowfreq 70%
basics
~20 s

In primary-replica setups, one server accepts writes and copies them to other servers that only serve reads. In multi-primary, several servers can all accept writes and have to sync changes with each other, which can cause conflicts.

open as a page

Why do backend services use a connection pool instead of opening a new database connection for every request, and what goes wrong in production when the pool is sized incorrectly?

level: middleimportance: must knowfreq 65%
basics
~20 s

Opening a database connection is slow and uses server memory, so apps keep a reusable stash of already-open connections (a pool) instead of creating a new one each time. If the pool is too small, requests wait in line; too big, the database runs out of resources and slows down or crashes.

open as a page

In a product with an order ledger, sessions, a catalog, device metrics, a search box and media files, which store class fits each part?

level: middleimportance: must knowfreq 62%
basics
~20 s

Order ledger: relational. Sessions: in-memory key-value with expiry. Catalog: document or relational. Device metrics: time-series. Search box: a search engine's index fed from the source of truth. Media files: an object store, with metadata in the database.

open as a page

An e-commerce team is building a 'Recently Viewed Items' feature and a 'Payment Balance' feature. One can tolerate showing slightly stale data for a few seconds; the other cannot ever show a wrong number. Which consistency model would you pick for each, and why does that trade-off exist at all?

level: juniorimportance: must knowfreq 85%
basics
~20 s

Use fast, "good enough" data for low-stakes info like recently viewed items, and exact, up-to-date data for money like a payment balance. Keeping everything instantly perfect everywhere is slow, so you only pay that cost where being wrong actually hurts.

open as a page

In a Dynamo-style replicated store with N=3 replicas per key, a team sets read quorum R=1 and write quorum W=1 for maximum speed. A customer writes a new shipping address, then immediately reads it back and sometimes sees the old one. Why does this happen, and what quorum values would fix it?

level: middleimportance: must knowfreq 80%
basics
~20 s

With R=1 and W=1, a write needs one replica and a read needs one replica — not necessarily the same one, so a read can miss the update. Overlapping quorums, like R=2 and W=2 of 3, fix it.

open as a page

A checkout flow must debit a payment service and reserve inventory in two separate databases owned by two separate services. Compare coordinating this with a two-phase commit (2PC) protocol versus a Saga with compensating transactions, and say which you'd pick and why.

level: seniorimportance: must knowfreq 75%
basics
~20 s

2PC locks both services until both agree to commit — all-or-nothing, but it freezes resources and can hang if the coordinator dies. A Saga commits each step and undoes earlier ones if a later step fails — faster, briefly inconsistent.

open as a page

A distributed key-value store resolves write conflicts with last-write-wins (LWW) based on each replica's wall-clock timestamp. Two data centers each accept a concurrent increment to the same 'view count' key during a brief network partition. When the partition heals, what happens to one of the increments, and how would swapping the counter for a CRDT (conflict-free replicated data type) avoid the problem?

level: seniorimportance: should knowfreq 65%
basics
~20 s

With LWW, only the "later" timestamped update survives — the other increment is thrown away, silently losing a count. A CRDT counter instead merges both by adding each replica's own tally, so no increment is lost.

open as a page

You're designing a multi-region social platform. Using the PACELC framework, walk through how you'd decide, separately for the 'post a new status update' write path and the 'like count' read path, whether to favor latency or consistency — including what changes in your reasoning when there's no active network partition versus when there is one.

level: principalimportance: should knowfreq 55%
basics
~20 s

If the network is broken, choose staying available with stale data or refusing requests to stay correct; if it's fine, choose fast-but-stale or slow-but-exact anyway. Favor correctness for a post, favor speed for a like count.

open as a page

A synchronous checkout API calls an inventory service directly and times out under load spikes. An engineer proposes inserting a message queue between the checkout API and inventory service. What problem does this solve and how does it work at a basic level?

level: juniorimportance: must knowfreq 75%
basics
~20 s

A queue sits between sender and receiver so the sender doesn't wait or fail when the receiver is busy. It stores messages temporarily and the receiver processes them at its own pace, smoothing out traffic bursts.

open as a page

In an async messaging pipeline, what does 'backpressure' mean, and what are two concrete mechanisms a system can use to apply it when a consumer's processing rate falls behind the producer's publish rate?

level: middleimportance: must knowfreq 65%
basics
~10 s

Backpressure tells the sender 'slow down' when the receiver can't keep up, instead of letting work pile up forever. It caps how much a producer can send, or makes it wait until there's room.

open as a page

A team's order-processing consumer is falling behind a queue that's steadily filling up. They add five more instances of the same consumer reading from the same queue. Under what conditions does this actually increase throughput, and what eventually caps how far this scales?

level: middleimportance: must knowfreq 70%
basics
~20 s

More consumer instances reading the same queue means more messages processed per second — like adding more cashiers. It stops helping once something else, like a shared database or the queue's own partition count, becomes the bottleneck instead.

open as a page

A team moves 'send confirmation email + update loyalty points' out of the synchronous checkout request and into async consumers off an order-placed queue. What concrete correctness and consistency problems does this introduce that didn't exist when it was one synchronous transaction, and how would you mitigate them?

level: seniorimportance: must knowfreq 60%
basics
~20 s

Splitting order creation and points update into separate steps leaves a window where the order exists but points haven't been added — and if that update fails, nothing automatically undoes the order. You must handle that gap deliberately.

open as a page

A team sizes their order queue's retention/capacity to comfortably buffer their biggest expected traffic spike, and touts this as 'the queue smooths out any burst.' What is the fundamental limit on how much buffering can actually fix a spike, and what metric would tell you the buffering strategy has failed?

level: seniorimportance: should knowfreq 55%
basics
~20 s

A queue only smooths a spike if the backlog eventually clears — it buys time, not processing power. If incoming work stays faster than the consumer even after the spike ends, the backlog never shrinks, regardless of queue size.

open as a page

What is rate limiting, and what should an API return when a client exceeds its limit?

level: juniorimportance: must knowfreq 80%
basics
~10 s

Rate limiting caps how many requests a client can send in a time window. Once they go over it, the server rejects the extra requests with HTTP 429 and tells them when to retry.

open as a page

A service enforces 'max 60 requests per minute per client' using a fixed window counter that resets every minute on the wall clock (e.g. at :00 of each minute). Why can a client legitimately send close to 120 requests in a short burst spanning a minute boundary, and how does a sliding window approach address this?

level: middleimportance: must knowfreq 82%
basics
~20 s

Fixed windows reset abruptly at a clock boundary, so a client can max out the limit right before the reset and again right after — nearly double the intended limit in a short burst. Sliding window looks at a rolling time range instead of a fixed clock tick, so it never lets that double-up happen.

open as a page

Compare the token bucket and leaky bucket algorithms for limiting a single client's request rate. How does each one handle a burst of traffic that arrives all at once, and when would you pick one over the other?

level: middleimportance: must knowfreq 88%
basics
~10 s

Token bucket lets a client save up unused capacity and spend it in a burst. Leaky bucket smooths everything out to a fixed steady rate no matter how bursty the input is.

open as a page

You're implementing a rate limiter shared across many stateless application server instances, backed by Redis, using a simple GET-then-SET pattern: read the current counter, check it against the limit, and if under, increment and write it back. Under concurrent load, why does this let clients exceed their limit, and how do you fix it?

level: seniorimportance: must knowfreq 75%
basics
~20 s

Two requests can both read the counter before either writes it back, so both see 'under limit' and both proceed — a race condition called a check-then-act bug. The fix is to make the check-and-increment a single atomic operation, e.g. Redis INCR or a Lua script.

open as a page

A public API needs to enforce three limits simultaneously: 1,000 requests/day per API key, 20 requests/second per API key (burst control), and 50,000 requests/second across all clients combined (protecting the backend). Why can't a single counter satisfy all three, and what problems come from combining per-key and global limits?

level: seniorimportance: should knowfreq 60%
basics
~20 s

Each limit protects a different thing over a different time scale, so each needs its own counter and window; a single number can't answer 'am I under my daily cap AND my per-second burst cap AND is the whole system under its global cap' at once.

open as a page

In a video-on-demand platform, why is each video cut into short segments listed in a manifest rather than served as one file?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Short segments let a player start after fetching a few seconds, switch bitrate at each segment boundary as bandwidth changes, and seek or retry cheaply, while HTTP servers and caches handle small uniform objects instead of one multi-gigabyte file.

open as a page

A user in Tokyo requests a static image from a website whose origin server sits in Virginia, USA, and the site is served through a CDN with points of presence (PoPs) worldwide. Explain what happens on the very first request for that image versus the hundredth request from a different Tokyo user, and why the CDN makes the site faster.

level: juniorimportance: must knowfreq 75%
basics
~20 s

A CDN stores copies of files on servers (PoPs) close to users everywhere. The first request has to fetch and cache the file from the real origin server, which is slow. Later requests are served from the nearby copy, which is fast because the data travels a much shorter distance.

open as a page

Your team ships a new JS bundle under the same URL /app.js on every deploy, and users keep complaining they're stuck on stale versions after a release even though the file changed on the server. What CDN caching mistake is likely happening, and how would you fix Cache-Control and the deployment strategy to solve it for both this JS bundle and images that rarely change?

level: middleimportance: must knowfreq 80%
basics
~20 s

The file's cache setting is probably telling browsers and the CDN to keep the old copy for too long, and reusing the same filename gives no signal that anything changed. Fix: give changed files new filenames whenever the content changes (like app.abc123.js) and cache those forever, while keeping the URL that points to the latest version very short-lived.

open as a page

In an adaptive-bitrate video player, how is the bitrate rung for the next segment chosen?

level: middleimportance: must knowfreq 55%
basics
~20 s

The player estimates available throughput from recent segment downloads, checks how many seconds are buffered, and picks the highest rung it can sustain with a safety margin, stepping down quickly when the buffer drains and up cautiously to avoid oscillation.

open as a page

A CDN advertises the exact same IP address, say 203.0.113.10, from data centers in Frankfurt, Singapore, and Sao Paulo simultaneously via BGP, and relies on the internet's normal routing to send each user to the nearest one. Explain how this works, and describe a failure scenario where a user's connection to that IP breaks mid-session even though all three data centers are healthy.

level: seniorimportance: must knowfreq 50%
basics
~20 s

Anycast means many servers around the world share one IP address, and the internet's normal routing (BGP) automatically sends each user to whichever one is 'closest' by network path. The problem: if the network path changes mid-connection, a user can suddenly get routed to a different server than before, breaking anything that depended on talking to the same machine.

open as a page

In a distributed system where a single user request fans out across a dozen microservices, what is a correlation ID and why does the system need one to debug that request?

level: juniorimportance: must knowfreq 85%
basics
~20 s

A correlation ID is a unique tag attached to a request when it first enters the system. Every service that touches the request writes that same tag into its logs, so later you can search all the logs for that tag and see everything that happened for that one request, even across many machines.

open as a page

A team monitoring a fleet of stateless API services builds dashboards using the RED method, while the team monitoring the underlying VMs and disks builds dashboards using the USE method. What does each method measure, and why is one better suited to request-driven services and the other to resources?

level: middleimportance: must knowfreq 75%
basics
~20 s

RED tracks Rate, Errors, and Duration of requests a service handles, good for things that answer requests, like an API. USE tracks Utilization, Saturation, and Errors of a resource, like a CPU or a disk, good for things that don't handle requests themselves but can still run out of capacity.

open as a page

Walk through how a distributed tracing system such as Jaeger or Zipkin, instrumented via OpenTelemetry, tracks a single request as it flows through five microservices: what gets generated, what gets passed between services on the wire, and how does the backend reassemble it into one picture?

level: middleimportance: must knowfreq 80%
basics
~20 s

Each unit of work, like one service handling part of a request, creates a 'span' recording what it did and how long it took. All spans for one request share a trace ID, and each span points to its parent span, so a backend like Jaeger can stitch them into a single timeline showing the whole request's path and where time was spent.

open as a page

A tracing backend like Jaeger can't afford to store a full trace for every request in a system doing 500,000 requests per second. Compare head-based and tail-based sampling as strategies for deciding which traces to keep, and give a scenario where head-based sampling would make you miss the exact trace you needed.

level: seniorimportance: should knowfreq 60%
basics
~20 s

Sampling means only keeping some traces, not all of them, to control cost. Head-based sampling decides at the very start of a request, before anything is known about it, usually just by rolling dice, like keep 1%. Tail-based sampling waits until the whole request is finished, then decides based on what actually happened, like keeping it if it was slow or errored.

open as a page

A team adds a label for user_id to a Prometheus-style metric so they can slice request latency per user, and their metrics backend falls over within a day. Using the concept of cardinality, explain what went wrong, and contrast how structured logging would have handled the same per-user breakdown safely.

level: seniorimportance: should knowfreq 55%
basics
~20 s

Metrics systems create a separate stored time series for every unique combination of label values. Adding something like user_id, which has millions of possible values, multiplies the number of series by millions, which overwhelms the system. Logs don't have this problem because each log line is just recorded as its own event, with the user_id as a plain field you search later, not as a new stored series.

open as a page

In a search-box autocomplete service, why does one-request-per-keystroke traffic push designs toward precomputed suggestion lists instead of ranking at request time?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Each keystroke can send a request, so autocomplete sees several times the traffic of full search and must answer before the next key. Precomputing ranked suggestions per prefix turns each request into a cheap lookup.

open as a page

For a product catalog's search index, what is the difference between a batch rebuild and near-real-time incremental indexing?

level: juniorimportance: must knowfreq 60%
basics
~20 s

A batch rebuild periodically re-reads the whole catalog and builds a fresh index, so results lag by up to the rebuild interval. Near-real-time indexing applies each change as it commits, giving seconds of lag but needing an always-running pipeline.

open as a page

In a search engine whose index is split across many shards, how does scatter-gather serve a query and return the global top 10?

level: juniorimportance: must knowfreq 60%
basics
~10 s

A coordinator sends the query to every shard in parallel. Each shard scores its own documents and returns only its local top 10. The coordinator merges those lists and keeps the best 10 overall.

open as a page

In a web crawler, what job does the URL frontier do beyond holding a list of URLs to fetch?

level: juniorimportance: must knowfreq 60%
basics
~20 s

The URL frontier holds every discovered but unfetched URL and decides what to fetch next and when: it orders URLs by priority and spaces out requests to each host, so the crawler stays polite and spends its budget on valuable pages.

open as a page

For server-side typeahead, how does a trie with precomputed top-k per node compare with an edge-ngram index and an FST?

level: middleimportance: must knowfreq 55%
basics
~20 s

A top-k trie gives lookups proportional to prefix length but costs memory; an edge-ngram index reuses search infrastructure and ranks at query time, costing index size and latency; an FST is compact and fast but immutable, rebuilt offline.

open as a page

Why does a WebSocket or Server-Sent Events gateway tier not scale horizontally as simply as a stateless HTTP API tier?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Each long-lived connection is pinned to one server for its whole life, so that server holds state: capacity is counted in open connections, pushes must be routed to the right node, and restarts disconnect everyone on it.

open as a page

How do you estimate how many WebSocket gateway nodes a messaging app needs to hold 10 million concurrent connections?

level: middleimportance: must knowfreq 55%
basics
~20 s

Divide the memory budget by per-connection memory to find a node's ceiling, check descriptor, port and CPU limits, then plan well below it: 10 million connections at 500,000 per node is 20 nodes plus spares.

open as a page

For a chat service that orders messages, why number them with a per-conversation sequence number instead of sorting by sender timestamps?

level: middleimportance: must knowfreq 68%
basics
~20 s

A per-conversation sequence number, assigned by the server when it stores a message, gives every device the same order and makes a missing message visible as a gap. Sender timestamps suffer from clock skew and ties, and they never show that a message is missing.

open as a page

When a chat client reconnects after an hour offline, how does it catch up on missed messages without refetching every conversation's history?

level: middleimportance: must knowfreq 64%
basics
~20 s

The client keeps a cursor of the last acknowledged sequence and sends it on reconnect. The server first answers which conversations changed, then returns only the messages after each cursor. Offline sends are retried with client-generated IDs so the server can recognise duplicates.

open as a page

In a notification service consuming order events at least once, how do you stop a redelivered event from texting the same user twice?

level: middleimportance: must knowfreq 72%
basics
~20 s

Derive a deterministic idempotency key from the event id, recipient, channel and template, claim it in a send ledger with a unique constraint before calling the provider, skip keys already marked sent, and pass the same key to providers that accept one.

open as a page

In a ride-hailing app, why are live driver locations usually held in memory with a short expiry instead of written durably on every update?

level: juniorimportance: must knowfreq 58%
basics
~20 s

Each location ping is replaced by a newer one within seconds, so only the latest position matters. Keeping it in memory with a time-to-live makes writes cheap and removes silent drivers automatically once their updates stop.

open as a page

In a find-nearby-places service, what is a geohash, and how does it let an ordinary sorted index answer proximity queries?

level: juniorimportance: must knowfreq 68%
basics
~20 s

A geohash turns latitude and longitude into one short string by interleaving their bits, so points in the same cell share a prefix. A prefix range scan on an ordinary sorted index then returns every point in that cell.

open as a page

In a ride-hailing app, how does the driver location update interval trade position accuracy against write load on the backend?

level: middleimportance: must knowfreq 62%
basics
~20 s

Write rate is drivers divided by interval, while staleness is speed times interval. One million drivers every 4 seconds means 250,000 writes per second, and a driver at 50 km/h may be about 56 m from the stored point.

open as a page

In a geohash-indexed nearby-places service, how do you choose the cell precision and scan pattern so a radius query misses no point?

level: middleimportance: must knowfreq 62%
basics
~10 s

Pick the finest precision whose cells are at least as large as the radius on their shorter side, scan the query's cell plus its eight neighbours, then keep only candidates within the exact distance.

open as a page

In a ride-hailing dispatch system with several concurrent matchers, how do you guarantee a driver is never assigned to two riders at once?

level: seniorimportance: must knowfreq 68%
basics
~20 s

Keep each driver's dispatch state in an authoritative store and move it from available to offered with a conditional write that only one matcher can win. Offers expire, and accepting is another conditional write checked against the offer id.

open as a page

In a reminder service storing millions of future one-shot jobs, why does a due-time index beat scanning every job to find what is due?

level: juniorimportance: must knowfreq 60%
basics
~20 s

A full scan touches every stored job on every poll, though almost all of them are far in the future. An index ordered by due time lets a poller read only rows already due, so cost tracks due work rather than total backlog.

open as a page

Why does a nightly billing job scheduled by a local cron entry on each of five identical nodes run incorrectly?

level: juniorimportance: must knowfreq 68%
basics
~20 s

Each node's local scheduler fires on its own, so the job runs five times per tick and customers can be billed five times. The fire decision must be made once for the cluster, by an elected runner or a shared per-tick claim.

open as a page

In a background-job platform, what is a job state machine, and why does it keep a separate run record for each attempt?

level: juniorimportance: must knowfreq 58%
basics
~20 s

A job state machine is the fixed set of job states (queued, running, retry-wait, succeeded, dead) and the only transitions allowed between them. Per-attempt run records keep the job row small while preserving who ran each attempt and why it failed.

open as a page

In a reminder service where several pollers read the same due-time index, how do you claim a due job so two pollers never both take it?

level: middleimportance: must knowfreq 62%
basics
~20 s

Make the claim one conditional write: move a job from pending to claimed only if it is still pending, and treat zero rows changed as losing. Reading first and updating afterwards lets both pollers see the same pending row.

open as a page

For cluster-wide cron, how does firing schedules only on an elected leader compare with every node racing for a per-tick lock?

level: middleimportance: must knowfreq 58%
basics
~20 s

An elected leader runs all schedules from one node: simple, but ticks can be missed or doubled around failover. A per-tick lock lets any live node win each tick with no handover, at the cost of every node attempting a claim every tick.

open as a page

In a cloud-drive service, why are file bytes kept in an object store while paths, versions and permissions live in a separate metadata database?

level: juniorimportance: must knowfreq 70%
basics
~20 s

File contents are large, immutable blobs read whole, while names, versions and permissions are tiny records that change often and need transactions and indexed queries. Splitting them lets each store scale and be tuned for its own workload.

open as a page

In a cloud-drive service, why are files stored as chunks keyed by the SHA-256 hash of their content rather than as whole files?

level: juniorimportance: must knowfreq 58%
basics
~10 s

Chunking plus content addressing stores identical bytes once, lets an edited file re-upload only the chunks whose hashes changed, and turns each chunk's key into an integrity check on read.

open as a page

In a cloud-drive service, why does each synced device ask for changes since its saved cursor instead of re-listing every file?

level: juniorimportance: must knowfreq 70%
basics
~20 s

A server-side change journal records every change in order with a monotonic position. Each device stores the last position it applied, so one small request returns exactly what it missed instead of scanning and diffing the whole file tree.

open as a page

Why should a photo and video sharing app send large uploads straight to the object store instead of through its application servers?

level: juniorimportance: must knowfreq 72%
basics
~20 s

Proxying gigabytes pins app servers to slow byte streams for minutes. Instead the app hands out a short-lived signed upload URL, the phone sends bytes directly to the object store, and app servers handle only small control requests.

open as a page

In a cloud-drive sync client, why does content-defined chunking survive an insert near a file's start when fixed-size blocks do not?

level: middleimportance: must knowfreq 62%
basics
~20 s

Fixed-size blocks cut at fixed offsets, so an insert shifts every later boundary and hash. Content-defined chunking cuts where a rolling hash of nearby bytes matches a pattern, so boundaries follow the content and realign after the edit.

open as a page

A scoring fleet takes 12,000 sensor readings per second at peak, each instance sustains 200, target utilisation 60% - how many instances?

level: juniorimportance: must knowfreq 62%
basics
~10 s

One hundred instances. Dividing the 12,000-per-second peak by 200 gives 60 instances running flat out; dividing again by the 0.6 utilisation target gives 100, whose 20,000-per-second ceiling leaves peak sitting at 60%.

open as a page

A bulk catalogue re-embedding job runs 400 accelerator-hours a month at $3 an hour for 20 million embeddings - what is the cost per embedding?

level: juniorimportance: must knowfreq 62%
basics
~10 s

Six hundredths of a cent. 400 hours at $3 is $1,200 of compute, divided by 20 million embeddings gives $0.00006 each, or $0.06 per thousand. That figure covers marginal compute only.

open as a page

In a video-moderation service, which half of the spend grows with upload volume: the quarterly training run or per-clip scoring?

level: juniorimportance: must knowfreq 62%
basics
~20 s

Per-clip scoring grows with upload volume; the quarterly training run does not. Training is paid once per model version, while scoring is paid again for every clip that arrives, so only the serving half is multiplied by traffic.

open as a page

What must a training run's record hold before two quarterly claim-severity runs can be compared at all?

level: juniorimportance: must knowfreq 68%
basics
~20 s

A run record must pin every input and the yardstick: the dataset snapshot identifier, the code commit, the full parameter set, a content digest of the model artifact, and the evaluation set identifier with its exact metric definition. Two runs compare only when that evaluation set and metric are identical.

open as a page

In a content-moderation labeling operation, why is each reported post judged by three annotators instead of one?

level: juniorimportance: must knowfreq 60%
basics
~20 s

One verdict on a moderated post carries no error signal of its own. Three verdicts make disagreement visible, route the contested post into an adjudication path, and turn agreement into a running health check on the written guideline.

open as a page