Slaves *and* Caching
Dear Lazyweb,
We have a web application that has quite a large database and reasonable usage. Back in the dim and distant past, we scaled the application by the age-old method of using several read-only slave databases to prevent reads on the master swamping writes. This worked well for several years, and then we introduced memcached into the mix to improve performance by reducing the number of reads from the database. This improved our database capacity even further.
Now the question has arisen about reducing or even removing the code to read from the slaves. I'm trying to come up with some compelling reasons to keep the application reading from the slaves. The pros and cons I currently have for removing the code are:
- Pros
- Reduces code complexity
- Removes consistency problems due to latency in the replication. This is less of a problem than it used to be after we solved a problem with our replication
- Cons
- Reduces our existing capacity
- Cache flushes would cause huge spikes on our master server until the cache filled up again
- Caches wouldn't help queries with unique critera
I would appreciate any additional reasons, pro or cons. We already have an existing non-live slave for backups and slow queries by developers. We would retain a slave for redundancy in the case of master failure. I'm only looking for issues that would affect the application.