This patch adds graphs for hit rate and usage for each bin as the default page in admin/logs/memcache using poll module's markup and css. Also, attached is a little cli script that I've been using to tweak my memcached instance sizes that lead to this patch.

Both display aggregate stats per bin, so if a bin is spread across a cluster it will calculate hit rate and usage as the sum of the bins on each server. This makes it easier to get a general overview for what's going on.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tomchuk’s picture

Ack, attachments disappeared.

tomchuk’s picture

Status: Closed (fixed) » Needs review
robertDouglass’s picture

There is also a memcache stats file somewhere on the internet (from one of the PECL maintainers) that basically replicates the admin screen from the APC package. The graphs in that file are beautiful, and there is extensive click-through reporting for all bins and servers, as well as the ability to selectively clear items. I think we should find that, resolve any potential licensing issues, and use it. These proposed graphs are very nice, but the ones I saw are a whole different world.

svenb’s picture

Jeremy’s picture

Priority: Minor » Normal
Status: Needs review » Needs work

Marking as patch needs work -- the idea is very much a step in the right direction, but let's take this even further...

kbahey’s picture

Harun Yayli is the author of this graph tool. It is very similar to APC's tool.

Here is the direct download link http://livebookmark.net/memcachephp/memcachephp.zip

The latest stable PECL memcache version http://pecl.php.net/package/memcache/2.2.4 says that it is included in the release.

catch’s picture

Version: 5.x-1.8 » 7.x-1.x-dev
Category: feature » task
Status: Needs work » Active

Moving to 7.x, apc.php-like stats would be great.

Jeremy’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
FileSize
4.92 KB
38.55 KB

Moving back to 6.x-1.x for a current project. To begin I'm simply pulling together more useful stats:

From here I plan to display stats from all servers on the same page (to allow a quick comparison / quickly spot servers that are mis-configured or having issues), and finally the goal will be to pretty-format it all with graphs ala apc.

This is a work in progress and nothing has been committed yet, but feedback on the stats presented in the above screen shot are very welcome.

Jeremy’s picture

FileSize
15.37 KB
60.92 KB

The attached patch completes phase 2 of this effort, which is to pull all relevant information together onto a single page to allow a quick analysis of the performance of all your memcache servers. There seems to be an issue preventing switching between bins, but otherwise it's working as designed. It currently only shows the default statistics page, none of the other statistics ('malloc', 'maps', 'slabs', 'items', and 'sizes').

From here it would be nice to pretty-format things in an apc.php style, but I'd like to commit this as is first as a step forward if there's no resistance. Feedback?

catch’s picture

I really like how this is going, having everything on one page is useful for comparisons, I hate having to compare anything between tabs.

It looks like a lot of code could be removed from memcache_admin_menu(), but I don't see any hunks in that patch. Or is the intention to leave those pages in for now?

Jeremy’s picture

> It looks like a lot of code could be removed from
>memcache_admin_menu(), but I don't see any hunks
> in that patch. Or is the intention to leave those pages
> in for now?

I've not yet done that cleanup, as it seems it may prove handy to be able to drill down more into each individual server in addition to seeing this overview. That way no stats are lost, but the main stats are more useful and organized.

catch’s picture

Status: Active » Needs work
FileSize
9.15 KB

When hit the stats page, I got a lot of notices (attached), didn't look into them yet.

Also I saw slightly odd statistics when I first got there.
25 gets (36.76%), 25 hits (100.00%) 53 misses (212.00%)

this then changed to
61 gets (56.48%), 61 hits (100.00%) 65 misses (106.56%)

And a couple of clicks later the last number went under 100%.

Leaving the full pages sounds sensible to me. I was thinking about #961472: Memcache stats reporting page menu items only reflect state at which menu router was rebuilt - if we were to make the server ips links, they could go straight to a menu callback with the server as argument, that'd save using tabs and would get rid of that issue (there's another one about the default tab too).

Overall this looks great and I agree about committing it soon and revisiting to add nice graphs, it's already a big improvement on what's there.

catch’s picture

Just realised that the per-page average should be per-connection average due to #822316: receiving a PHP notice "Connection reset by peer .... dmemcache.inc on line 104" - currently some servers are opened with a persistent connection, with that patch this will be optional.

Jeremy’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Needs work » Patch (to be ported)

Thanks for the feedback, Nat. I addressed the wording to per-connection and improper get stats, and cleaned up all the errors I could duplicate -- I only saw a fraction of the errors you reported with E_ALL however, so please let me know if this is still a problem for you that I'm somehow masking with my installation.

This has been tested with both the memcache and memcached PECL extensions (the latter provides fewer statistics), with custom configurations defined in settings.php, default configurations (no memcache_bins or memcache_servers defined in settings.php), with a broken configuration (a dead memcache instance -- the memcached PECL extension doesn't handle this well), with multiple servers per bin and single servers per bin, and all combinations of these configurations.

I have committed this code as a step forward to eliminating general confusion people have when reviewing memcache statistics. It adds a detailed overview page (per the screenshots above) while still retaining per-server raw statistics (missing in earlier patches). I also added the ability to dump individual slab caches, inspecting the actual cache-keys contained in memcache -- a future followup could allow us to fully dump the individual cache-keys to see their contents, though I'm not sure how we'd best display this data as it may be binary compressed data. I wrapped the slab-cache dumping in a new permission as visiting this page locks up the memcache server while the slab contents are being dumped: I'm open to ideas on how to best communicate this to memcache_admin users so folks don't cause themselves problems.

Committed here:
http://drupalcode.org/project/memcache.git/commitdiff/336ab52

I think the next step is porting this to the 7.x-1.x-dev branch. Once done, then we can revisit adding pretty-graphs beyond these informative tables.

Jeremy’s picture

While testing #1134158: Test 'upgrade path' from 6.x-1.8 to 6.x-1.9 I found that the items statistics weren't displaying correctly. I fixed this, and added a link from the items display to individual slab cachedumps.
http://drupalcode.org/project/memcache.git/commitdiff/015ac68

Jeremy’s picture

Committed some E_ALL cleanup, and added hits and gets per second stats.
http://drupalcode.org/project/memcache.git/commitdiff/4d34dde

catch’s picture

Priority: Normal » Critical

Bumping to critical, would be good to get this in before 7.x-1.0

Jeremy’s picture

Assigned: Unassigned » Jeremy

Making a stab at this now... assigning to myself.

Jeremy’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

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