Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phalcon\Cache\Backend\Memcache fails on high usage #1550

Closed
Plaputta opened this issue Nov 12, 2013 · 3 comments
Closed

Phalcon\Cache\Backend\Memcache fails on high usage #1550

Plaputta opened this issue Nov 12, 2013 · 3 comments
Labels
bug A bug report status: medium Medium

Comments

@Plaputta
Copy link

Like mentioned in https://github.com/phalcon/docs/blob/master/en/api/Phalcon_Cache_Backend_Memcache.rst the Memcached cache backend stores all keys it manages in a key called _PHCM.

Memcached items are limited to 1 MB by default and the Memcached docs state that it is not safe to increase this value.

However, since Phalcon stores all keys in _PHCM, on high traffic applications this item grows quickly. On our application we're using the Memcached adapter to store user sessions and since we have some traffic on our site, within a few hours we have 60k sessions and the _PCHM item grows to about 4mb.

Phalcon should avoid this by not storing the keys in one item, giving up the ability to query all keys but being failsafe.

@temuri416
Copy link
Contributor

Hm... This seems to be a valid concern.

@stamster
Copy link
Contributor

This has been fixed in 2.0.9.
You can just omit the 'statsKey' parameter while instantiating new Libmemcached instance.

@stamster
Copy link
Contributor

Uh-oh.
it is fixed only for SESSION libmemcached adapter, not for BACKEND libmemcached.

But, fortunately this works fine as override:
https://github.com/phalcon/cphalcon/blob/master/phalcon/cache/backend/libmemcached.zep#L321

While trying to query cached keys this exception is thrown:
Class:Phalcon\Cache\Exception#File:phalcon/cache/backend/libmemcached.zep#Line:322#

So just pass to the constructor: 'statsKey' => null
or:
'statsKey' => ''

@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

4 participants