Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

Thanks

share|improve this question

1 Answer 1

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

 
discard

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.