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

mongo-ruby-driver appears to open one connection per database, not per host

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Blocker - P1 Blocker - P1
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      We tested out the new mongo-ruby-driver (using HEAD from Nov, 17), and connection counts to our mongoS increased to the point where it OOM'd multiple mongoS and we had to roll back. We have multiple clusters that each have many databases on them.

      With Moped, it only creates 1 connection per host:port pair it seems. For example, I opened up a rails console and connected to every database on one of our clusters (I just ran some .find({}).count() commands). Running netstat only got 1 result:

      jonathan:~ $ netstat -an | grep MONGO_IP
      tcp4 0 0 192.168.0.13.63049 MONGO_IP.15426 ESTABLISHED

      Then I switched to the mongo-ruby-driver and re-ran the exact same command to connect to every database. It created one connection per database.

      jonathan:~ $ netstat -an | grep MONGO_IP
      tcp4 0 0 192.168.0.13.63425 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63424 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63423 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63422 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63421 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63420 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63417 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63416 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63414 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63413 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63412 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63411 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63410 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63409 MONGO_IP.15426 ESTABLISHED
      tcp4 0 0 192.168.0.13.63408 MONGO_IP.15426 ESTABLISHED

      Because of the large number of processes and threads we run, this issue completely prevents us from switching to the new driver right now.

            Assignee:
            emily.stolfo Emily Stolfo
            Reporter:
            jonhyman Jon Hyman
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: