Bugpit

Lessons › From one user to millions

Go worldwide

Half your users are now outside the US: 30% in Europe and 20% in Asia. A read from Mumbai to Virginia takes about 190 ms longer before your servers do any work.

Play this level

Free with an account. It runs in your browser: build the design, press Run, and watch what breaks.

The lesson

Nothing beats distance: the round trip from Mumbai to Virginia is fixed by the speed of light through fibre. The only fix is to run your servers closer to your users, in more regions.

Reads can stay local with a cache and a read replica in each region. Writes are harder: there's only one primary, so a write from Mumbai still crosses the world, unless it goes into a local queue and the user gets their answer straight away.

A region can also fail as a whole. Standbys live in the same region as the primary, so they go with it. What saves you is a replica somewhere else that can be promoted, and that takes minutes, by hand, and can lose the latest writes.

What you have to achieve

6,000 requests a second at the busiest hour, 10% of them writes and 20% static files.

What you learn

You made a design that's fast everywhere and outlives a whole region. Notice what it cost: reads may be slightly stale, and queued writes finish later than the user thinks.

Check yourself

How do you make reads fast for users in Mumbai?

Show the answer

A cache and read replica in a nearby region. Nothing beats distance. Run copies close to users so reads stay local.

What saves you if the primary's whole region fails?

Show the answer

A replica in another region that can be promoted. Standbys live in the same region and go down with it. A replica elsewhere can take over, though it may lose the latest writes.

Try it yourself

More in From one user to millions

← Ready for launch Ask before you build →