0

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

1 Answer 1

0

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.

2
  • It we had a miss and fetched the data from the DB, how would the data be placed in memcache?
    – ckliborn
    Mar 15, 2012 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, 2012 at 2:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .