Scenario: the site crawls at peak hours

15 investigations drawn from real incidents: measured symptoms (CPU, latency, bandwidth, errors), find the cause, then the typical solution. On the back: why, the alternative and the pitfall to avoid. Load balancers, sessions, CDNs, caching, message queues, rate limiting, connection pooling.

  • 39 cards
  • 3 topics
  • Free

The outline, topic by topic

Each topic is weighted the way the exam weighs it.

  1. Servers and balancing
  2. Content and caching
  3. Requests and dependencies

A few cards from the deck

  • 8 pm, the site takes 8 seconds to answer

    - A single application server, CPU at 95%
    - Database at 20% CPU
    - Traffic has tripled in a month

    What is the most likely cause?

    • The database is overloaded with reads
    • Visitors' connections are too slow
    • The single application server is out of CPU
    • DNS takes too long to answer
    Show the answer

    The single application server is out of CPU

    The server's CPU is maxed out while the database is almost idle: the server is the bottleneck, not the data.

  • 8 pm, the site takes 8 seconds to answer

    Cause: the single application server is out of CPU.

    What is the typical solution?

    • Add indexes to the database
    • Add identical, stateless servers behind a load balancer
    • Lengthen the DNS records' TTL
    • Switch the site to HTTP/2
    Show the answer

    Add identical, stateless servers behind a load balancer

    Horizontal scaling spreads requests over several machines and removes the single point of failure.

    Alternative: A bigger server (vertical scaling): quick, but capped and still a single machine.

    Pitfall: Sessions kept in one server's memory break as soon as there are several: servers must be stateless.

  • Logged out at random since servers were added

    - Three servers behind a round-robin load balancer
    - Users lose their session one page in three
    - No server-side error

    What is the most likely cause?

    • The browser blocks cookies
    • Sessions are stored in each server's memory
    • The load balancer drops packets
    • The database deletes the accounts
    Show the answer

    Sessions are stored in each server's memory

    Round robin sends the next request to another server, which does not know the session created on the first.