Uploaded image for project: 'PHP Legacy Driver'
  1. PHP Legacy Driver
  2. PHP-200

Persistent Connections Inhibit Failover

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.0
    • Component/s: pecl-mongo
    • Labels:
      None
    • Environment:
      CentOS 5.4, Ubuntu 9.10
    • # Replies:
      8
    • Last comment by Customer:
      true

      Description

      I've been testing failover and measuring
      data loss when asking a primary replica to step down. I've setup a
      very simple test as follows:

      1) Setup a PHP script that increments a count using findandmodify
      2) Use ab (apache benchmark) to do 10,000 requests with a concurrency of 5
      3) Tell the primary replica to step down during this process
      4) Look at the final value of the counter

      Ideally, the counter final value would be 10,000. I've tested this two
      ways. First with the PHP driver's persistent connections turned on and
      second without persistent connections. Previous discussions on the
      list have indicated that mongos does its own connection pooling, so
      with persistent connections turned on, you're essentially pooling a
      pool. Long story short, with persistent connections turned on, and PHP
      talking to mongos, there's a lot of data loss.

      The final count generally ends up around 2,200 while it should be
      10,000. Turning them off, the final count is generally in the ballpark
      of 9980 or 9990 (very close to where it should be). A bizarre side
      effect of this is that connecting mongo to mongos with the persistent
      connections turned on frequently gives a "not master" message as if
      the stale pooled PHP connections are somehow influencing new
      connections as well. No such behavior is present when turning of PHP's
      persistent connections.

        Attachments

          Activity

            People

            • Votes:
              6 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                8 years, 3 days ago
                Date of 1st Reply: