X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/970e10bb34690746ba378b0408ec37e7f7b57040..be00fa244d9b8e107b080c756bf73d3137c3ccd1:/redis-benchmark.c diff --git a/redis-benchmark.c b/redis-benchmark.c index 2984efe4..123d8118 100644 --- a/redis-benchmark.c +++ b/redis-benchmark.c @@ -1,6 +1,6 @@ /* Redis benchmark utility. * - * Copyright (c) 2006-2009, Salvatore Sanfilippo + * Copyright (c) 2009-2010, Salvatore Sanfilippo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -464,7 +464,7 @@ void parseOptions(int argc, char **argv) { printf(" -n Total number of requests (default 10000)\n"); printf(" -d Data size of SET/GET value in bytes (default 2)\n"); printf(" -k 1=keep alive 0=reconnect (default 1)\n"); - printf(" -r Use random keys for SET/GET/INCR\n"); + printf(" -r Use random keys for SET/GET/INCR, random values for SADD\n"); printf(" Using this option the benchmark will get/set keys\n"); printf(" in the form mykey_rand000000012456 instead of constant\n"); printf(" keys, the argument determines the max\n"); @@ -525,6 +525,24 @@ int main(int argc, char **argv) { } do { + prepareForBenchmark(); + c = createClient(); + if (!c) exit(1); + c->obuf = sdscat(c->obuf,"PING\r\n"); + prepareClientForReply(c,REPLY_RETCODE); + createMissingClients(c); + aeMain(config.el); + endBenchmark("PING"); + + prepareForBenchmark(); + c = createClient(); + if (!c) exit(1); + c->obuf = sdscat(c->obuf,"*1\r\n$4\r\nPING\r\n"); + prepareClientForReply(c,REPLY_RETCODE); + createMissingClients(c); + aeMain(config.el); + endBenchmark("PING (multi bulk)"); + prepareForBenchmark(); c = createClient(); if (!c) exit(1); @@ -580,11 +598,20 @@ int main(int argc, char **argv) { prepareForBenchmark(); c = createClient(); if (!c) exit(1); - c->obuf = sdscat(c->obuf,"PING\r\n"); + c->obuf = sdscat(c->obuf,"SADD myset 24\r\ncounter_rand000000000000\r\n"); prepareClientForReply(c,REPLY_RETCODE); createMissingClients(c); aeMain(config.el); - endBenchmark("PING"); + endBenchmark("SADD"); + + prepareForBenchmark(); + c = createClient(); + if (!c) exit(1); + c->obuf = sdscat(c->obuf,"SPOP myset\r\n"); + prepareClientForReply(c,REPLY_BULK); + createMissingClients(c); + aeMain(config.el); + endBenchmark("SPOP"); prepareForBenchmark(); c = createClient();