Bugpit

Lessons › Real apps

Fortnite: 3.4 million at once

In February 2018 Fortnite hit 3.4 million players at once, and its services fell over six times in one weekend. You're running one hundredth of that night: 34,000 players, each sending about one request a second. A quarter of them are writes: joining matches and saving stats. One cache sits in front of one database, and nothing holds the crowd back.

Play this level

Part of Bugpit Pro. It runs in your browser: build the design, press Run, and watch what breaks.

The lesson

Epic published what broke, and it wasn't one big thing. One cache cluster (Memcached) slowed down. The proxies waiting on it filled up, failed their health checks, and the load balancer took every node out of rotation. A slow dependency became a total outage.

So the cache needs company. Run at least two, so losing one machine costs speed, not the game.

Matchmaking was the busiest shard of the database, and its writes queued up for tens of seconds. Writes that can wait belong in a queue, with workers saving them at a steady pace. The player hears "you're in the queue" instead of an error.

Players also stay connected, so friends can see who's online. When Epic's messaging load balancer failed, every client reconnected at once and the flood made it worse. Hold those connections on a Realtime Gateway with room to spare, and make clients back off before they retry.

Finally, the front door. When more people arrive than the servers can take, a login queue lets them in at a safe rate. Epic added one to Fortnite; nearly every big online game has one now.

What you have to achieve

34,000 requests a second at the busiest hour, 25% of them writes.

What you learn

Crash one cache machine now: the game slows, but stays up. Most big outages are small failures that spread: a slow cache, a full proxy, a flood of retries. Every fix here stops one failure from reaching the next part.

The real numbers behind it

Check yourself

Fortnite's slow cache took the whole game down. How did a slow part become a total outage?

Show the answer

Proxies waiting on it filled up and failed health checks, so every node was taken out. A slow dependency is often worse than a dead one: everything waiting on it fills up. Two cache machines and bounded waits stop it spreading.

Thousands of players lose their connection at once. What stops them all reconnecting in the same second?

Show the answer

Clients back off, waiting longer and a little randomly before each retry. Retries that all fire together are a second wave of traffic. Backing off spreads them out.

Try it yourself

More in Real apps

← GTA VI: launch night Hotstar: 25 million watching →