views:

230

answers:

1

Hi,

My Django application uses memcached via cmemcache. An issue sprung up when I was trying to monitor its usage:

I tried to access stats memcached provides through both Django and cmemcache:

django:

from django.core.cache import cache
cache._cache.get_stats()
[[email protected]] mcm_server_stats():3027: unknown stat variable: pointer_size

cmemcache:

import cmemcache
client=cmemcache.Client(['127.0.0.1:62656',])
client.get_stats()
[[email protected]] mcm_server_stats():3027: unknown stat variable: pointer_size

I can get nothing more than a warning. However, memcached itself provides stats without problems:

telnet 127.0.0.1 62656
stats
...

The web page of cmemcache mentions that "libmemcache-1.4.0.rc2 is not compatible with memcached 1.2.1, this results in get_stats returning no stats". The app is running on Debian. memcached's version is 1.2.2. I have no idea if there is still an incompatibility problem.

Is there anyone who has encountered this issue and has a solution?

+1  A: 

First, you should not run those versions of memcached. They have lots and lots of known bugs and are many years old.

Secondly, we add stats to memcached quite frequently, so if these libraries are complaining when they encounter new stats, you should complain to their authors.

Also, I don't believe cmemcache is maintained. It's based on a deprecated memcached C library that has several known bugs. Users of that library are encouraged to migrate to libmemcached.

Dustin
Thanks for the answer, I will contact my hosting provider to see if they can upgrade. However, cmemcache seems to be the preferred Python binding by the Django team: "The fastest available option is a module called cmemcache (http://docs.djangoproject.com/en/dev/topics/cache/). And cmemcache support is new to Django, starting from Django 1.0.
shanyu
Not sure how your hosting provider is setup but if they can't change it out for you. You may try using the Pure Python python-memcached package by placing it into your app. I know Django does support it but don't know its order of import over CMemcached or other memcached client packages.
NerdyNick
@NerdyNick: Thanks, I'll keep in my mind using python-memcached. But first of all I'll try to install a newer version of memcached.
shanyu