Scalability: Horizontal and Vertical Scaling, Sharding and Partitioning Interview Questions

261 multiple-choice tech interview questions on Scalability: Horizontal and Vertical Scaling, Sharding and Partitioning: scale up vs scale out, statelessness and autoscaling, replication, partitioning and sharding strategies, consistent hashing, hot spots and rebalancing. Written for technical phone screens and interview prep, organized by subtopic, with a short explanation for every answer. Learn the 73 key terms with the flashcards first, then test yourself.

Take the practice test · Flashcards · All study tools

What it covers

  1. 4.1 Scaling fundamentals and the laws that limit it
  2. 4.2 Capacity planning and estimation
  3. 4.3 Load testing and finding bottlenecks
  4. 4.4 Stateless tiers, load balancing and autoscaling
  5. 4.5 Scaling relational databases before sharding
  6. 4.6 Sharding strategies and shard keys
  7. 4.7 Consistent hashing, rebalancing and resharding
  8. 4.8 Hot spots, cross-shard work and global IDs
  9. 4.9 Async work, multi-tenancy and global scale

Key terms

4.1 Scaling fundamentals and the laws that limit it

Vertical scaling
Adding resources to one machine (scale up)
Horizontal scaling
Adding more machines or instances (scale out)
Autoscaling
Automatically adding or removing capacity based on metrics
Amdahl's law
Speedup from parallelism is limited by the serial part of the work
Universal Scalability Law
A model where contention and coherency limit scaling
Contention
Waiting for shared resources like locks
Coherency cost
Work spent keeping nodes' shared state in sync
Scale cube
AKF's three axes of scaling: clone, split by function, split by data
Linear scalability
Throughput rising in proportion to resources
Retrograde scaling
Throughput falling as more nodes are added
Serial bottleneck
A step that can't run in parallel and caps speedup

4.2 Capacity planning and estimation

Capacity planning
Making sure enough resources exist for expected demand
Peak-to-average ratio
How much higher the busiest period is than the mean
Demand driver
A business metric that drives system load
Capacity model
A mapping from demand drivers to needed resources
N+1 capacity
Enough capacity to carry peak load with one node lost
Seasonality
Repeating demand patterns like holiday peaks
Growth rate
How fast demand rises over time
Capacity per instance
The most load one instance can handle

4.3 Load testing and finding bottlenecks

Load test
Running expected traffic to check performance
Stress test
Pushing past expected load to find limits
Soak test
Running steady load for a long time to find leaks
Spike test
A sudden load jump to check the reaction
Open workload model
Requests arriving at a set rate regardless of replies
Saturation
Work queued because a resource is full
Latency knee
The load where latency starts climbing sharply
Bottleneck shifting
A new limit appearing once one is fixed

4.4 Stateless tiers, load balancing and autoscaling

Stateless tier
Servers that keep no client state between requests
Target tracking scaling
Scaling to keep a metric near a target value
Cooldown
A wait after scaling so metrics can settle
Horizontal Pod Autoscaler
Kubernetes controller that changes replica counts

4.5 Scaling relational databases before sharding

Functional partitioning
Splitting features' data into separate databases
Read/write splitting
Sending writes to the primary and some reads to replicas
Archiving
Moving old rows out of hot tables
Load leveling
Using a queue to smooth bursts of work
Compute-storage separation
Scaling a database's storage and compute independently

4.6 Sharding strategies and shard keys

Sharding
Splitting data across multiple servers by a shard key
Shard key
The attribute that decides which shard stores a row
Hot spot
A shard or partition receiving disproportionate load
Shard routing
Finding which shard holds a given key
Vitess
A sharding and routing layer for MySQL
Citus
A PostgreSQL extension for distributed tables
Reference table
A small table copied to every node
Co-location
Placing related tables' rows for one key on the same node
Logical shard
A unit of data that can be moved between servers
Compound shard key
A shard key made of several fields
Shard map
The record of which keys live on which shard
Geographic sharding
Splitting data by user region

4.7 Consistent hashing, rebalancing and resharding

Hash ring
A circle of hash values where nodes and keys are placed
Rendezvous hashing
Picking the node with the highest score for each key
Jump consistent hash
A fast, memory-free hash mapping keys to numbered buckets
Bounded-load hashing
Consistent hashing that caps each node's load
Hash slot
A fixed bucket of keys that moves between nodes
Range split
Breaking a busy or large key range into smaller ones
Cutover
Switching traffic from old shards to new ones

4.8 Hot spots, cross-shard work and global IDs

Consistent hashing
Hashing scheme where adding or removing nodes moves few keys
Resharding
Moving data between shards to rebalance or grow
Scatter-gather
Sending a query to many shards and merging the results
Aggregation pushdown
Computing partial results on each shard
Broadcast query
A query that must run on every shard
Global index
An index mapping a non-shard key to a shard
Ticket server
A central database handing out unique IDs
Key splitting
Spreading one hot key over several sub-keys
Affinity
Routing related work to the same place
Hot key detection
Tracking per-key request rates to find hot spots

4.9 Async work, multi-tenancy and global scale

Background job
Work done outside the user's request
MapReduce
Parallel map over pieces, then combine with reduce
Pool model
Tenants sharing the same resources
Silo model
Each tenant getting dedicated resources
Tenant quota
A per-tenant limit on resource use
Edge compute
Running code at CDN locations near users
Precomputation
Building results ahead of time for cheap reads
Arrival-rate test
A load test sending requests at a set rate

Sample practice questions

  1. What is vertical scaling?

    1. Adding more machines behind a load balancer
    2. Splitting a database's rows across several servers
    3. Moving the workload into a different cloud region
    4. Giving one machine more CPU, memory or faster disks

    Answer: D. Giving one machine more CPU, memory or faster disks It is simple but has a hard ceiling, often needs downtime, and keeps a single point of failure.

  2. Traffic averages 200 requests per second with a 5x peak ratio. What peak should you plan for?

    1. About 200 per second
    2. About 40 per second
    3. About 1,000 per second
    4. About 5,000 per second

    Answer: C. About 1,000 per second Average × ratio, then add headroom.

  3. What's a load test?

    1. Running expected traffic to check speed and errors
    2. Counting how many files a disk can hold
    3. Measuring how heavy a server rack is
    4. Testing that a page loads in a browser once

    Answer: A. Running expected traffic to check speed and errors At normal and peak levels.

  4. What does autoscaling need to work well for a web tier?

    1. Stateless instances, health checks, a good metric and fast startup
    2. One single large server that's sized for the very highest peak
    3. Sticky sessions stored in each instance's local memory
    4. A manual approval step before every single scale event

    Answer: A. Stateless instances, health checks, a good metric and fast startup Scale on signals like CPU, request rate or queue length, with cooldowns to avoid flapping.

  5. Which component is usually hardest to scale horizontally?

    1. A tier of stateless web servers behind a balancer
    2. A stateful relational database handling writes
    3. A content delivery network serving cached files
    4. Static file hosting in cloud object storage

    Answer: B. A stateful relational database handling writes Writes require coordination; reads can be scaled with replicas and caches more easily.

  6. What is the difference between partitioning and sharding?

    1. Sharding splits a table's columns, while partitioning splits its rows instead
    2. Partitioning splits data, maybe on one server; sharding spreads it across servers
    3. They're unrelated techniques that solve completely different problems
    4. Partitioning always requires multiple databases, while sharding never does

    Answer: B. Partitioning splits data, maybe on one server; sharding spreads it across servers The terms are often used interchangeably, but sharding implies distribution across nodes.

  7. What problem does consistent hashing solve?

    1. Adding or removing nodes moves only a few keys, unlike hash mod N
    2. It makes the hash function cryptographically secure against attacks
    3. It sorts every key alphabetically so range queries stay on one node
    4. It guarantees that no hot spots can ever form on any of the nodes

    Answer: A. Adding or removing nodes moves only a few keys, unlike hash mod N DynamoDB, Cassandra and many caches use consistent hashing, often with virtual nodes.

  8. In a multi-tenant SaaS app sharded by tenant ID, what problem can one very large tenant cause?

    1. Every tenant on the platform loses some of their data permanently
    2. Queries become completely impossible for every tenant on that shard
    3. A hot shard much busier than the rest, which may need its own shard
    4. Sharding stops working for every tenant, so the database must merge

    Answer: C. A hot shard much busier than the rest, which may need its own shard Directory-based sharding makes it easy to move big tenants.

  9. Why move slow work like sending emails out of the request path?

    1. Background jobs never fail
    2. It makes emails arrive instantly
    3. Requests return fast; workers scale separately
    4. Emails can't be sent from web servers

    Answer: C. Requests return fast; workers scale separately Queue it.

  10. What is horizontal scaling?

    1. Upgrading the existing server to a bigger instance size
    2. Adding more columns to the busiest database table
    3. Adding more instances and spreading the load across them
    4. Raising the number of threads in each process

    Answer: C. Adding more instances and spreading the load across them It can grow almost without limit and adds redundancy, but needs stateless services or data partitioning.

Practice all 261 questions

More Architecture