Cache Backend Benchmarking with n98-magerun
This is the start of a series which presents 3rd party n98-magerun modules.
The first one is a module which helps you to benchmark your shop cache system.
It’s a port of a benchmark script by Colin Mollenhour
which was a fork of a symlink cache script by Vinai Kopp.
Installation
The installation is really strait forward:
mkdir -p ~/.n98-magerun/modules
cd ~/.n98-magerun/modules
git clone https://github.com/cmuench/magerun-module-cache-benchmark.git
Usage
After the installation you should see some new cache commands in your n98-magerun command list.
cache:benchmark:analyse Analyze the current cache contents.
cache:benchmark:clean Flushes cache backend.
cache:benchmark:comp_test Test compression library performance
cache:benchmark:init Inits cache dataset
cache:benchmark:load Load an existing dataset.
cache:benchmark:ops Execute a pre-generated set of operations on the existing cache.
cache:benchmark:tags Benchmark getIdsMatchingTags method.
First run “cache:benchmark:init” which generates cache entries.
The init command can has a lot of paramters.
--name (default to default) (default: "default")
--keys Number of cache keys (default to 10000) (default: 10000)
--tags Number of cache tags (default to 2000) (default: 2000)
--min-tags The min number of tags to use for each record (default 0) (default: 0)
--max-tags The max number of tags to use for each record (default 0) (default: 15)
--min-rec-size The smallest size for a record (default 1) (default: 1)
--max-rec-size The largest size for a record (default 1) (default: 1024)
--clients The number of clients for multi-threaded testing (defaults to 4) (default: 4)
--ops The number of operations per client (defaults to 10000) (default: 10000)
--write-chance The chance-factor that a key will be overwritten (defaults to 1000) (default: 1000)
--clean-chance The chance-factor that a tag will be cleaned (defaults to 5000) (default: 5000)
--seed The random number generator seed (default random)
--help (-h) Display this help message.
--quiet (-q) Do not output any message.
--verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
--version (-V) Display this application version.
--ansi Force ANSI output.
--no-ansi Disable ANSI output.
--no-interaction (-n) Do not ask any interactive question.
--root-dir Force magento root dir. No auto detection
--skip-config Do not load any custom config.
No panic. The command defines default values for every setting.
After the generation you should see a bash script like “bash var/cachebench/default/run.sh” which was
generated by the init command.
Run the shell script an see the your benchmark statistics.
Now you are able to compare different cache backends (change it in your app/etc/local.xml config).
2 Comments
Vinai · August 4, 2014 at 01:55
This is so awesome 🙂
Thank you! I love it and am including it as one of the showcase tools in some of the training I do.
Magento-Neuigkeiten der Wochen 31/32 2014 · August 3, 2014 at 19:49
[…] Christian Münch startete eine Serie über 3rd-Party-Erweiterungen für n98-magerun. Den Beginn macht die Erweiterung von Colin zum Benchmarken von Cache-Backends. […]