mongoid / moped

A MongoDB driver for Ruby
https://mongoid.github.io/old/en/moped/
MIT License
201 stars 153 forks source link

Extreme delays after removing member of a replica set #178

Open jonhyman opened 11 years ago

jonhyman commented 11 years ago

Starting yesterday, MongoHQ put some physical servers in my replica set to replace my AWS-backed ones. I added the new servers to my mongoid.yml while they were secondaries, then we cutover to one as the primary. This was all fine.

Today, they removed the AWS backed machines from the replica set. All my apps started responding extremely poorly immediately: we were getting lots of 10 second response times; given that all these requests were a bit over 10 seconds, that seems like some kind of timeout. When I removed the entry from my mongoid.yml for the AWS machines and restarted the servers, response times returned to be normal in the milliseconds.

On Moped 1.4.5 (Mongoid 3.1.2)

neerfri commented 11 years ago

this looks like it could also be related to #186

threez commented 11 years ago

We face the same problem in our infrastructure. The infrastructure is very dynamic and the ip addresses of the mongodb is changing for all servers from time to time. This is a problem for the current driver, since it caches the ip address of the database (https://github.com/mongoid/moped/blob/master/lib/moped/address.rb#L48). The solution is to allow to set an option, that would disable the caching of the ip so that if the DNS points to a different set of host the connections can be re established. Otherwise the application just times out.

michaeldauria commented 10 years ago

This is the same issue as #257