System Design
4. Database FundamentalsAnimated
Read and Write Operations
How data is read from and written to storage.
The idea
Reads fetch rows, often via a cache or index. Writes go to a log first, then to data files.
Watch it work
Press play, pause, or step through. Some animations have settings you can change.
- client
- gateway / proxy
- service
- cache
- data store
- queue / stream
Step one: add indexes and cache.
- step:
- 1/4
- at:
- App servers
1/7
The green dot is a request moving through the system.
Step by step
- 1A write is appended to the log
- 2Memory is updated
- 3Pages flush to disk later
- 4Reads use the cache and indexes
Where it is used
Understanding database performance.
Watch out for
Heavy writes and heavy reads need different tuning.