Sampling memcached statistics
We recently launched a new environment for our WordPress CMS, making major changes to both the hardware (bare metal to VMs) and software (file-based WP Supercache to memcached-backed Batcache).
Unfortunately, we’re having performance issues. Page response times are significantly down, and several intensive activities cannot be completed (fortunately these are rare and infrequently performed).
We’ll be posting here as we investigate and, hopefully, address our performance problems.
One of the things we’re lacking is good insight to how memcached is performing. To fix this, we’re going to start collecting and analyzing statistics, both from the system (memory and CPU used by the memcached processes) and cache (from the memcached “stats” command).
There are a lot of tools out there that we could use to do this, but we’re under a bit of a deadline as tomorrow we’re going to be making a change to one of the VMs that memcached runs in. We’d like to be able to make some before and after comparisons, so I whipped together a really quick script to sample some data points we’re interested in.
The script runs every minute from my crontab, and logs system and cache statistics to two CSV files.