Bugpit

Lessons › From one user to millions

Separate the database

Traffic grew to 1,500 req/s, and your data lives on the same machine as your code. You want to be able to replace or add servers.

Play this level

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

The lesson

If data lives on the app server, you can't add a second server: each would have different data. You also lose everything if it dies.

Move the data to its own Database. Then app servers become stateless: any server can handle any request (§5.2).

What you have to achieve

1,500 requests a second at the busiest hour, 10% of them writes.

What you learn

Your app server holds no data now, so you can copy it freely. That's what makes the next level possible.

Check yourself

Why did moving the data to its own database matter?

Show the answer

App servers became stateless, so you can add more. With no data on it, any app server can answer any request. That's what lets you copy servers freely.

What goes wrong if two app servers each keep their own data?

Show the answer

Users see different data depending on which server answers. Each server would hold a different copy, so users would get different answers. Shared data needs one shared home.

Try it yourself

More in From one user to millions

← Your first users Scale out →