Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-679

Add option socketKeepAlive to Python driver

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.8, 3.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • Environment:
      centos 6.1

      In certain heavily overloaded environments, it is possible to have socket communications undergo timeouts.

      While there are sockettimeout options available in the python driver, setting these very high has downsides for socket availability and recycling, etc.

      To avoid these situations, normal Python socket communications allow for an option of setting a socket option of 'socketKeepAlive', which results in the sending of keep-alive packets that reset the timeout timers on the server side. This is a common practice in heavily loaded applications that transmit large amounts of data and where the CPU of the client may be overloaded for various reasons.

      Setting this option is relatively trivial. Enabling this option involves passing the option through from mongo_client instantiation. Base behavior can be unaffected, since it is an option that only is active when explicitly set.

      Files affected should be:

      • mongo_client.py (pass option thru)
      • pool.py (actually set socket option)
      • common.py (validators)

            bernie@mongodb.com Bernie Hackett
            justanyone Kevin J. Rice
            0 Vote for this issue
            4 Start watching this issue