Uploaded image for project: 'PHP Driver: Extension'
  1. PHP Driver: Extension
  2. PHPC-723

Blocking connect() leads to cumulative timeouts for multiple inaccessible servers

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2.0
    • Affects Version/s: 1.1.8
    • Component/s: None
    • Labels:

      Previous 'legacy' PHP driver used to connect() to mongo servers using blocking sockets since https://github.com/mongodb/mongo-php-driver/pull/166
      When a mongo server process is down the OS' TCP stack can reject any request to connect() with an error, it's a near immediate answer. But when the server hosting mongo process is down (turned off/crashed), connectTimeoutMS (timeout option in driver) is fired. On a replicaset using 4 nodes with two nodes per datacenter (and 1 arbiter on a third Datacenter) it means a datacenter crash or network outage between the two main datacenters can generate 2*connectTimeoutMS delay, even if remaining servers are enough to satisfy queries (One PRIMARY and One SECONDARY, if using w<=2).
      As socket connect() client side is blocking, the total time to connect to a cluster can be large.
      So I would like to upgrade my application from legacy driver to latest one which moved its internals to mongo c driver to connect to cluster but does new driver present the same behaviour (large delay to connect on crash servers) or does it fix it ?
      Please could you confirm ?

            jmikola@mongodb.com Jeremy Mikola
            lglayal Laurent Glayal
            1 Vote for this issue
            4 Start watching this issue