I have several bins on the same server, different ports.. I can see memcache getting between 70-95% hit rate on them, which is great.. we are runnning APC 3.1.7 and Memcache 1.4.5.

My problem is that I cannot see the Malloc or Map parts of the stats.
I changed the memcache user to www-data but that didn't help.

Comments

jeremy’s picture

Title: Unable to get Stats for Malloc and Maps » Expose Stats for Malloc and Maps when available
Category: bug » feature

If you're used to seeing these stats, I'll conclude that you're using the Memcache PECL extension, not the Memcached PECL extension. Which version of the PECL extension are you using?

According to the Memcache documentation ( http://www.php.net/manual/en/memcache.getstats.php ) "According to the memcached protocol spec these additional arguments 'are subject to change for the convenience of memcache developers'." In my testing, neither the Malloc nor Maps stats are available with the latest Memcache PECL extension release, hence I removed them from the output as they were just generating errors.

Changing this from a bug report to a feature request to 1) detect the version of the Memcache PECL extension being used, and 2) properly expose whatever stats are available with that version of the extension. This is non-trivial and is very unlikely to get into 6.x-1.9.

robinmofo’s picture

Status: Active » Closed (works as designed)

I'm gonna close this down, since updating my stack - memcache has been hitting @ 99%

robinmofo’s picture

Status: Closed (works as designed) » Postponed (maintainer needs more info)

Sorry didn't see your last comment... reopening

robinmofo’s picture

Right, seeing as I buggered this ticket up I thought I'd help investigate what's going on.

In my case, I think it's down to the way my bins are configured, all cache tables point to the 'default' bin.. so when memcache_admin_bin_mapping() is called and it performs array_flip(), I end up with the final entry.. which turns:
cache -> default,
cache_block -> default,
etc...
cache_views_data -> default,
INTO
default -> cache_views_data (which is the last entry)

Unfortunately I cannot change my settings.php right now as I'm running a large batch job; but once its finished I'll try reversing the order of my bins. I can dump the $stats variable in memcache_admin_stats() and it's populated... so (for me at lest) it's just a problem with the bin mapping function.

I did an array_reverse and sure enough - my stats page is now populated.. I'll look at how we can improve this function to return the correct bin.

robinmofo’s picture

Component: memcache.inc » memcache_admin
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new829 bytes

I've attached a patch for memcache_admin_bin_mapping() that respects the bin configuration whilst maintaining the cache bin as default.

robinmofo’s picture

Just a minor fix to the $cache variable so it gets initialized, even if $bins['cache'] doesn't exist.

robinmofo’s picture

This happens on 7 too with certain bin configurations:

Pre flipped bins =>
... (Array, 12 elements)
cache (String, 7 characters ) default
cache_apachesolr (String, 7 characters ) default
cache_block (String, 7 characters ) default
cache_content (String, 7 characters ) default
cache_filter (String, 7 characters ) default
cache_form (String, 7 characters ) default
cache_menu (String, 7 characters ) default
cache_page (String, 7 characters ) default
cache_path (String, 7 characters ) default
cache_update (String, 7 characters ) default
cache_views (String, 7 characters ) default
cache_views_data (String, 7 characters ) default

Post flip bins =>
... (Array, 1 element)
default (String, 16 characters ) cache_views_data

So this now returns the 'cache_views_data' bin, when we wanted 'cache'... performing asort() on the array before being flipped also pushes the default bin to the bottom (if the default is called 'cache' that is)

These are simple fixes so I'll leave up to you guys to choose the best method... if you want me to provide patches just let me know how you want it done.

robinmofo’s picture

Added simpler patch for 7.. using asort() as mentioned above.

*edit* I'm not sure what happened but looks like an issue with my upload? its a duplicate of the original patch... trying again.

robinmofo’s picture

Right, I must be half asleep and can only apologize for the mess I'm making of this ticket.

Attached is the D7 patch for correctly finding the default bin for the cache stats page.

It uses array_search because as explained before, array_flip can reduce the bins to just the last entry.. but 'cache' is usually the first entry.

markpavlitski’s picture

Title: Expose Stats for Malloc and Maps when available » The default statistics report won't work with multiple bins set to the default cluster
Version: 6.x-1.x-dev » 7.x-1.x-dev
Category: feature » bug
StatusFileSize
new505 bytes

Hi frobinrobin,

I've changed the issue to match your more recent comments and patches.

Memcache gathers stats on a per server basis rather than a per bin basis but the stats report wasn't taking this into account for the default page.

The attached patch should fix the issue for both PECL libraries.

Kind regards,

Mark

robinmofo’s picture

Thank you Mark... "memcache-default-stats-1150042-10.patch" works for me.

markpavlitski’s picture

Status: Needs review » Reviewed & tested by the community
jeremy’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.