Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a php application that uses memcache and a back-end database

At times we see high "current connections" in memcache and can't determine why.

Why php "misses" from memcache and needs to go to the backend db, does it keep a mem cache connection open until the data is returned?

I am seeing "Too many open connections" in my memcache log. I know that I need to fix some things with my back end DB but I am wondering if a slow DB would cause memcache connections to be kept open.


share|improve this question
up vote 0 down vote accepted

That depends on the design of your Webapp and how you are accessing memached.

If you are using php with pecl-memcached the memcache client does not even know nor care where the data comes from.
You are probably making a $m->get("keyname") call, i suppose you are fetching the data from the database and write it to memcache if the call returns false.
In that scenario, how would the memcache client or server even know what you are doing?

So, short answer: No, under common circumstances memcache will not keep connections open.

share|improve this answer
It we had a miss and fetched the data from the DB, how would the data be placed in memcache? – ckliborn Mar 15 '12 at 1:25
Most common in this scenario would be to fetch from memcache, if it's a miss fetch from elsewhere and write to memcache. In this cycle there is no place where a connection will be kept open by the memcache client. That's why i wrote, it depends on the design of your webapp, maybe it is flawed. – Niko S P Mar 15 '12 at 2:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.