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)