tchandy/octopus — pull request #278 by islue (2014-09-30 02:48:09+00:00)
Title: enable_query_cache! when it is really necessary

We use octopus for sharding purpose, so we have multiple slave servers. Recently, one of the slave servers was down, and it made the whole Rails app down.

The reason is ActiveRecord::QueryCache is called by Rails, which requires a real connection.
In octopus implementation, it will create a real connection for every slave in shards. The point is not every slave server will be used in every request.

I suppose that octopus prefers a lazy database connection strategy. If a slave server hasn't been used, it is not necessary to create a real connection just only for enable_query_cache!.
IMO, in case one of slave servers is down, it is better to keep others working, instead of let the whole service down.