Skip to the page

Reliability and scale · senior

Preparing for 10x traffic and changing huge tables

Readiness is measured load tests, pre-scaling and an agreed degradation plan. Schema changes on big tables use expand, backfill in throttled batches, then contract.

The notes

What you must know

  • For 10x traffic clarify which flows get it, the shape over time (a spike at midnight or spread out), marketing pushes and partner limits (payment gateways, SMS providers, banks).
  • Measure today peak and headroom per service. Load test on a production-like setup with a realistic mix and spikes. Fix the first bottleneck and test again. Do not load test a single API only.
  • Database at 4 times in three weeks: caching and replicas for reads, connection pooling, missing indexes and slow queries, moving writes off the request path, a bigger instance. Sharding now is too risky.
  • Pre-scale before the start because autoscaling takes minutes and spikes take seconds. Raise cloud quotas, warm caches and the CDN, and tell partners the expected volume.
  • Agree the degradation plan with product beforehand: kill switches for recommendations, reviews and personalisation, a waiting room and static fallbacks. Freeze changes a few days before; prepare runbooks, on-call and a war room with dashboards; run a game day.
  • Reshape a huge table without downtime. Risks: long locks or a full table rewrite, replication lag, blocked writes. In Postgres adding a nullable column without a default is a quick metadata change; MySQL has online DDL, gh-ost or pt-online-schema-change.
  • Expand: add new nullable columns, deploy code that writes both old and new, backfill old rows in batches by primary-key range (a few thousand rows), verify, switch reads behind a flag. Contract: stop writing the old column and drop it in a later release.
  • The backfill is throttled by replica lag and load, resumable from a checkpoint, idempotent, and run off-peak. Verify with counts and sample comparison. Keep the old column filled until no old app version reads it.

The red pen

Common traps: mistake → fix

  • Mistake: We will autoscale

    Fix: it is too slow for a spike.

  • Mistake: One giant UPDATE over every row

    Fix: it locks and floods replication.

  • Mistake: Drop the old column in the same release

    Fix: old app versions break and you cannot roll back.

  • Mistake: Change the architecture a week before the sale

    Fix: freeze instead.

Easy to hard

Questions interviewers ask, easy to hard

  1. How do you prepare for 10x traffic in three weeks?
  2. What do you switch off first when load is too high?
  3. How do you add a column and backfill a huge table without downtime?
  4. How do you throttle a backfill?

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview