How it works
As demand grows, move the database to its own machine. A tier is a group of machines doing one job, so you now have a web tier and a data tier. Web traffic can then grow without forcing a database upgrade, and database capacity can change without resizing the web tier. The two also stop competing: on one machine, a slow report can starve page rendering of CPU, while the application’s memory use squeezes the database’s cache.
The move has a price. Each query now crosses a network. A round trip inside one data center is very roughly 0.5 ms, so a page that makes 20 queries gains about 10 ms, while a page with 500 accidental queries gains 250 ms. The link can also fail on its own, and you now have two machines to patch and secure. Managed services such as Amazon RDS take over some of that work for a fee.
A relational database, such as Postgres or MySQL, is a practical default when records relate to each other and queries need joins, which combine rows from several tables. A document, key-value, graph, or column-oriented store may fit better when the access pattern or data model calls for it. Cassandra, for example, is built for very high write volumes read by a known key, but it has no joins. Evaluate actual queries, latency needs, and data shape before changing database types; “large scale” alone does not choose one for you.
A sensor platform stores billions of readings, always written and read by device ID and time range. Which storage model would you evaluate first?
A wide-column store such as Cassandra deserves a look, because the access pattern is known in advance and needs no joins. You give up ad hoc queries and joins, so confirm that no important report needs them. At smaller volumes, a partitioned Postgres table may be simpler to run.
Use this as a guide for self review; written answers are not graded.Keep in mind
- Tier separation lets each tier scale for its own workload.
- Choose storage from data relationships and query patterns.