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.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | memcache-default-stats-1150042-10.patch | 505 bytes | markpavlitski |
| #9 | 1150042-memcache_default_stats_fix_d7-7044208.patch | 1.13 KB | robinmofo |
| #8 | memcache-admin_bin_mapping-updated-1150042.patch | 914 bytes | robinmofo |
| #6 | memcache-admin_bin_mapping-updated-1150042.patch | 914 bytes | robinmofo |
| #5 | memcache-admin_bin_mapping-1150042.patch | 829 bytes | robinmofo |
Comments
Comment #1
jeremy commentedIf 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.
Comment #2
robinmofo commentedI'm gonna close this down, since updating my stack - memcache has been hitting @ 99%
Comment #3
robinmofo commentedSorry didn't see your last comment... reopening
Comment #4
robinmofo commentedRight, 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.
Comment #5
robinmofo commentedI've attached a patch for memcache_admin_bin_mapping() that respects the bin configuration whilst maintaining the cache bin as default.
Comment #6
robinmofo commentedJust a minor fix to the $cache variable so it gets initialized, even if $bins['cache'] doesn't exist.
Comment #7
robinmofo commentedThis 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.
Comment #8
robinmofo commentedAdded 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.
Comment #9
robinmofo commentedRight, 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.
Comment #10
markpavlitski commentedHi 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
Comment #11
robinmofo commentedThank you Mark... "memcache-default-stats-1150042-10.patch" works for me.
Comment #12
markpavlitski commentedComment #13
jeremy commentedThanks, fix committed:
http://drupalcode.org/project/memcache.git/commit/1af2c91