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

ckliborn
  • 2,750
  • 4
  • 24
  • 36

1 Answers1

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.

Niko S P
  • 1,182
  • 8
  • 15
  • 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 01: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 02:18