Lessons › From one user to millions
Numbers as they happen
20,000 sensors report in: 3,000 readings a second at the peak. You need to store them, show live totals and let analysts run big reports, and none of that should slow the others down.
Play this levelFree with an account. It runs in your browser: build the design, press Run, and watch what breaks.
The lesson
Sensor data is nearly all new writes, and old values never change. A time-series database is built for that. AWS's sizing guide for InfluxDB puts a 2xlarge at about 150,000 writes a second.
A Worker handles one event at a time. A Stream Processor such as Flink keeps running totals across events, for things like the average over the last five minutes.
Reports belong in a Data Warehouse such as Snowflake or Redshift, away from live traffic. Its data is a little behind, and analysts can run whatever they like without touching users.
An event stream connects all of it: each reader gets every event and moves at its own pace.
What you have to achieve
3,500 requests a second at the busiest hour, 85% of them writes.
- No broken or illegal connections
- Use a Time-Series DB
- Use a Stream Processor
- Use a Data Warehouse
- No component is overloaded
- Workers clear the queue within the day
- p99 response time under 250 ms
What you learn
Three kinds of store for one flow of data, and each one is good at its job. That's a lot to run, so most teams start with one and split later. The speeds for the processor and warehouse here are starting guesses, marked in each part's numbers. Load test yours.
Check yourself
Where should analysts run big reports?
- On the live database
- In a data warehouse, away from users
- On the cache
Show the answer
In a data warehouse, away from users. A warehouse is a little behind, and reports there can't slow down live traffic.
What does a stream processor do that a worker doesn't?
- Keeps running totals across many events
- Stores data forever
- Serves web pages
Show the answer
Keeps running totals across many events. A worker handles one event at a time. A processor like Flink keeps state, like a five minute average.