A simple example of horizontal scaling VS. vertical scaling just with Database's
Given an example application like so:
Application has many clients, each client has multiple users.
update:
No client needs to know about another client, each user belongs exclusively to one client
Vertical scaling:
Client data is stored in a normalized SQL based database.
user credentials for all users is stored in client_users table.
Benefits
- Shortest path of resistance for development
- relatively easy to maintain integrity with
- Easy to backup
Problem:
Because all client credentials are stored in this one table along with related data, to maintain or increase performance would require beefing up your database tier with more resources or investing in more slaves to this one master.
Horizontal scaling:
Each client exists on a prefixed table schema. client_users becomes client01_users
Benefits
Someone with intermediate level skills in DB administration could write a simple script to copy client#_* tables to a new DB server in about 5 minutes ( then another hour to sanity check/test/verify). In this way you can push your low traffic clients onto a overbooked server and profit from the infrastructure savings while charging your higher traffic clients for requiring dedicated hardware.
Problems
- Maintenance/development time can extend into oblivion and paralyse development entirely if shared nothing techniques don't include automation and schema change management systems.
- A simple task like adding/dropping a column will take much longer to peform as you have to do it on multiple tables/machines in lockstep to software changes.
- Backup's get pretty interesting sometimes
Summary
If in the beginning I can see an opportunity for shared nothing, I will fight tooth and nail to get that implemented. For new client's with scaling issues, after contracted my initial proposal will include refactoring to incorporate sharding or shared nothing principals. In my mind, the extra complexity can be managed if approached/handled correctly.