Uploaded image for project: 'Motor'
  1. Motor
  2. MOTOR-118

Too many connection using Tornado coroutine

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 0.6.2
    • Component/s: tornado
    • None
    • Environment:
      Ubuntu 14.04
      MongoDB 3.0.12
      Python 3.5.2
      Tornado 4.4.1
      PyMongo 2.8

      Hello. I have issue with many connection to database when I run Tornado coroutine asynchronously. I wrote simple example.

      example.py
      # coding=utf-8
      
      import motor
      import tornado.gen
      import tornado.ioloop
      
      
      client = motor.motor_tornado.MotorClient()
      db = client['test']
      
      
      @tornado.gen.coroutine
      def save():
          yield db.test.insert({'key': 'value'})
      
          client.close()  # Nothing happened
      
      
      async def main():
          print((await db.command('serverStatus'))['connections']['current'])  # 1
          save()
          print((await db.command('serverStatus'))['connections']['current'])  # 2
      
      
      if __name__ == '__main__':
          tornado.ioloop.IOLoop.instance().run_sync(main)
      

      In my project many asynchronous inserts and connections count up to ~800. I have 30 instances of Tornado on different servers with connection to single MongoDB instance. Give me a feedback please.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            pyvim Merlen Gross
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: