Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-1052

Failover : why does the following script take so long to execute ?

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.2
    • Affects Version/s: 2.1.1
    • Component/s: None
    • None

      Hello,
      I have experienced big slow applications when using MongoDB with ruby in case of a failover. At the time of Moped I even opened an issue about this https://github.com/mongoid/moped/issues/373 without any feeback ...

      My servers are AWS ec2 instances and I run a replica set accross different availability zones in the same region. Whenever a host is down (the instance is shutdown) I experience very slow query performances. It turns out this is because mongodb driver takes a lot of time to figure out that a host is down. Quite suprisingly, it gets instant feeback when trying to connect to a localhost port where there is now mongod listening.

      I have isolated a simple case illustrating my problem in the following gist : https://gist.github.com/rpechayr/782df4b8b270bde21d7c

      What can we do about this ? It looks like `connect_timeout` that has a 5 seconds default could be used, but I am really wondering why the default is 5 seconds.

      Real life mongodb failover don't happen with down localhost ports, but with situations similar to the one I experienced.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            rpechayr Romain Pechayre
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: