Scalability for Dummies
Part 1 Clone
- Load balancer - evenly distributes load onto group/cluster of application servers
Part 2 Database
- Scalable database solution
- DBA, master-slave replication (read from slaves, write to master)
- expensive, time consuming
- demoralize right from the beginning and include no more joins in any database query!
- switch to a better and easier scale NoSQL database (e.g. MongoDB, CouchDB)
- DBA, master-slave replication (read from slaves, write to master)
Part 3 Cache
- In-memory
- 2 Patterns of caching data
- Cached database queries
- Hash the result of queries
- Issue: expiration, perturbation
- Cached objects
- directly store the data array/complete instance of class
- make async processing possible
- Cached database queries
- Objects to cache
- user sessions (never use the database!)
- fully rendered blog articles
- activity streams
- user <-> friend relationships
Part 4 Asynchronism
wait for a while
- doing the time-consuming work in advance and serving the finished work with a low request time
- massive framework, pre-rendered and locally stored
- unforeseen tasks
- send the signal when job is done
- doing the time-consuming work in advance and serving the finished work with a low request time