Giter Club home page Giter Club logo

mc-crusher's Introduction

An extremely rough but extremely damaging benchmark utility for memcached.

Does not use a client library.

Building
--------

$ (install libevent + headers)
$ ./compile

Usage
-----

Look in the conf/ directory for example configuration files.

$ ./mc-crusher --conf ./conf/loadconf --ip [ip] --port [port]
defaults:
host: 127.0.0.1
port: 11211

Running
-------

You can use the included bench-warmer.pl tool to preload some keys. mc-crusher
makes no attempt to recache anything on a miss.

Pick a config file, and start it as above. You should start a fresh memcached,
and run the "sample" script that comes with mc-crusher. mc-crusher makes no
attempt to read or validate response data.

Modify "sample" to print what you are most interested in examining.

The latency-sampler utility included is used to measure response latency
during a test. You must run it yourself, either after a warmup period or at
the same time as a test.

Start options
-------------

--conf [file]
 - the test configuration to load/run.

--ip [127.0.0.1]
 - IP address to connect to.

--port [11211]
 - port to connect to.

--timeout [seconds]
 - stop the test after this amount of time

--zipf-n
--zipf-s
 - Commands which will dump a curve from the supplied zipf arguments (N being
   limit, S being curve skew (0.00-2.00 useful range).
 - Exits after dumping 10 million key:frequency ratios.
 - Used for tuning zipf arguments in a config file. High skew gives "hot
   keys". Low skew gives a more gentle curve.

Configuration
-------------

mc-crusher reads a configuration file then begins a test run. These configurations
describe a template of a connection, one per line.

Each template can spawn N connections. This allows you to mix setters and
getters, getters of different sizes, binprot + asciiprot.

Config Options
--------------

send : defines what function to use to send requests to memcached
 - ascii_get : one get per request via asciiprot
 - ascii_set : one set per request via asciiprot
 - ascii_delete : one delete per request via asciiprot
 - ascii_mget : multiget test via asciiprot
 - bin_get : one get per req via binprot
 - bin_getq : endless streaming multiget from hell
 - bin_set : one set per req via binprot
 - bin_setq : unleash cthulu upon the cache_lock

recv : same, but for received data
 - blind_recv : mindlessly slurp any responses without inspecting them

mget_count : set this to the number of keys to fetch per get in ascii_mget

key_prefix : a string to prefix before each key's number (default 'foo')

value_size : size of the value to set

expire : the expiration value (default 0)

flags : client flags (raw number, default 0)

value : define a value by hand. Must be shortish and a string.

host : define a host to connect to

port : define a port to connect to

key_count : number of keys to iterate across. use with key_prealloc=0 to
iterate over large numbers of keys

key_randomize : shuffle the keys rather than fetching in order

usleep : fire one write event (up to pipeline count) with a microsecond sleep
after. the sleep is per-connection (so conns=2 will write twice per usleep)

stop_after : stop all conns for this test after N writes have been made.

pipelines : stack this many requests into the same syscall. Useful for
reducing some overhead for high request rates.

thread : number of threads to spawn with the same configuration. This means if
conns=1,thread=4 there will be four total connections made.

live_rand : if set to 1, will use embedded PCG randomizer to choose keys.
(default 0)

live_rand_zipf : if set to 1, paired with zipf_skew, will choose a key
randomizer which skews according to a zipf distribution (ie; keys early in the
list have a higher use bias).

zipf_skew : typically 0.01 to 2.00 in range. Higher skews create hot-key
scenarios, where a bulk of accesses are a handful of keys. Lower skews are
useful for creating somewhat realistic workloads of hot vs not as hot keys.

Caveats
-------

- Does not make any attempt to safely parse or validate the config file.

- It only works well with small values

- It makes no attempt to reconcile with errors in the protocol, and can break
  if memcached throws errors. It will also stop if the connections are closed.

- It's a ton of fun!

Future Features
---------------

A short list of things I intend to change or add:

- Fix the command generators to have a *little* error handling

- Add commands to iterate over different value sizes

- Bundle a better perl util for printing stats

mc-crusher's People

Contributors

dormando avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.