bdurand / seamless_database_pool

Add support for master/slave database clusters in ActiveRecord to improve performance.
http://rdoc.info/projects/bdurand/seamless_database_pool
MIT License
224 stars 58 forks source link

More reads happening on master than on the slave. #3

Closed adamthedeveloper closed 12 years ago

adamthedeveloper commented 13 years ago

Hi,

I like the ease at which this Gem snaps in. We have a master and slave configuration and we are noticing that the master is taking most of the reads and the slave is mostly idle. We set the weight to 0 for the master, but still, most reads are going to the master. What can we do to ensure that no reads happen at all on the master and they all go to the slave?

Thanks in advance,

Adam

bdurand commented 12 years ago

Are setting the read connection in your code? The default behavior is to use the master connection for everything unless you specifically say to use the read connection. In a Rails app this can be accomplished by adding the controller filters.

See http://rubydoc.info/gems/seamless_database_pool/1.0.11/SeamlessDatabasePool/ControllerFilter for more info.