Persistent connections are only supported when using the Memcache extension.

We should add support for the same feature using the Memcached extension.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

markpavlitski’s picture

Status: Active » Needs review
FileSize
2.21 KB
Phizes’s picture

markpavlitski: I would like to test this, though I am not sure how to check that it is indeed functioning correctly, could you possibly provide an idea or methodology as to how to go about it? (I'm probably missing something.)
Thanks.

markpavlitski’s picture

@Phizes I think you should be able to monitor the number of open connections to your Memcached instance by looking at the curr_connections and total_connections stats.

total_connections should increase for every page load when using a non-persistent connection (as a new connection is opened every time), but it should only increase periodically when using persistent connections (when the connection times-out or is dropped/reset).

If you want to dig into it a bit further, $memcache->getServerList() should return a list of any servers that have persistent connections open (i.e. they were opened on a previous page load) and $memcache->isPersistent() will tell you if an open connection is persistent or not.

Phizes’s picture

Status: Needs review » Needs work

Please keep in mind that I was using Unix sockets with this patch, I'm not sure what effect this has. I was using the latest dev version, both when running with, and without the patch.

I ran with this patch for a while, then without it, and then with it again. Both the times I was running with this patch I saw somewhat severe performance degradation, as in 50% time or more spent in PHP than without the patch. I kept an eye on this using New Relic, I didn't do any screen grabs, which is unfortunate, and I'm only using the lite version, so data retention is only 24 hours.

To me it seems that it is not reusing the persistent connections it creates, memstat reported that there were ~20+ persistent connections at any given time, but the connection count statistic kept growing as normal. Without the patch there were no persistent connections mentioned.

I've been delaying reporting back on my results as I wanted to look into it further, and maybe find a solution, but I lack the time currently.

Jeremy’s picture

Issue summary: View changes
Status: Needs work » Needs review
FileSize
3.81 KB

Here's a patch that works a bit better. However, there's still the occasionally connection leak visible on the statistics page -- this is probably from memcache_requirements calling memcache_instance without a bin. I suspect the best solution is to ignore the memcache_persistent option when doing requirements testing.

  • Jeremy committed 0634fc4 on 7.x-1.x
    Issue #1977452 by markpavlitski, Jeremy: Add persistent connection...
Jeremy’s picture

Status: Needs review » Fixed

Did a little cleanup to my earlier patch and committed. And, enabled persistent connections by default.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.