Simple memcached benchmark
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


mcb is a simple memcached benchmark. This has been tested by using CBMC(, valgrind(, and Intel Inspector XE.


$ cc -Wall -lpthread -o mcb mcb.c


usage: mcb -c {set|add|get} [OPTIONS]
	   -c {set|add|get}         command type
	   -a <address>             memcached address[]
	   -p <num>                 memcached port[11211]
	   -T {TCP|UDP|UNIX_SOCKET} connection type[TCP]
	   -f <file-path>           unix socket path
	   -t <num>                 number of threads to run[1]
	   -n <num>                 number of commands to send[1]
	   -m <num>                 max key length[1000]
	   -l <num>                 average data length[10]
	   -v                       verbose
	   -s                       connect to memcached for each command
	   -h                       help


Starting 10 threads, each thread sends one thousand "set" commands.

$ mcb -c set -a -p 11211 -t 10 -n 1000 -l 100
condition =>
    connect to TCP port 11211
        command = set
        10 threads run
        send 1000 commands a thread, total 10000 commands
        average data length = 100
result =>
        interval =  0.419934 [sec]
        performance =  23813.263946 [commands/sec]
        thread info:
          ave. = 0.230296[sec], min = 0.047713[sec], max = 0.393719[sec]

Total execution time of all commands is 0.419934 seconds. Therefore, memcached can handle 23813.263946 commands per second.

If you want to use UDP, set '-T UDP' option.

$ mcb -c set -a -p 11211 -t 10 -n 1000 -l 100 -T UDP

If you want to use unix socket, set '-T UNIX_SOCKET' and '-f /domainsocket/dir/file' options.

$ mcb -c set -t 10 -n 1000 -l 100 -T UNIX_SOCKET -f /tmp/memcached


Suzuki Hironobu: