twitter/twemproxy — pull request #210 by idning (2014-03-31 19:20:39+00:00)
Title: Mget improve

hi, @manjuraj, I'm trying to import mget performance by rewrite it like this::

orig:

mget k1 k2 k3 k4 k5 k6 k7 k8 k9

after rewrite:

mget k1 k3 k6
mget k2 k4 k7
mget k5 k8 k9

this will cost less time on ``req_done()`` function calls,

I use this redis-benchmark::

if (test_is_selected("mget")) {
#define N 1000
const char *argv[N+1];
argv[0] = "MGET";
for (i = 1; i < N+1; i += 1) {
argv[i] = "key:__rand_int__";
}
len = redisFormatCommandArgv(&cmd,N+1,argv,NULL);
char tmp[1024];
sprintf(tmp, "MGET (%d keys)", N);
benchmark(tmp, cmd,len);
free(cmd);
}

here is the benchmark result on my laptop:

1000 keys mget::

ning@ning-laptop:~/idning-github/redis-mgr$ redis-benchmark -n 1000 -t mget -p 4001 -r 100000000
====== MGET (1000 keys) ======
1000 requests completed in 21.66 seconds
50 parallel clients
3 bytes payload
keep alive: 1

100.00% <= 1268 milliseconds
46.18 requests per second

ning@ning-laptop:~/idning-github/redis-mgr$ redis-benchmark -n 1000 -t mget -p 4000 -r 100000000
====== MGET (1000 keys) ======
1000 requests completed in 1.64 seconds
50 parallel clients
3 bytes payload
keep alive: 1

100.00% <= 102 milliseconds
611.25 requests per second (improved )

(benchmark against redis got 1292 requests per second)

100keys mget::

ning@ning-laptop:~/idning-github/redis-mgr$ redis-benchmark -n 10000 -t mget -p 4001 -r 100000000
====== MGET (100 keys) ======
10000 requests completed in 8.57 seconds
50 parallel clients
3 bytes payload
keep alive: 1

100.00% <= 56 milliseconds
1166.59 requests per second

ning@ning-laptop:~/idning-github/redis-mgr$ redis-benchmark -n 10000 -t mget -p 4000 -r 100000000
====== MGET (100 keys) ======
10000 requests completed in 1.88 seconds
50 parallel clients
3 bytes payload
keep alive: 1

100.00% <= 17 milliseconds
5316.32 requests per second (improved )

(benchmark against redis got 11668.61 requests per second)

the performance is about ``5x-10x`` (about 1/2 of redis instance)
@neeleshkorade will be happy to see this result (https://github.com/twitter/twemproxy/issues/158)

I need a detail benchmark later. and I need your advise.

I notice that I broke the 'del' cmd, I will fix it tomorrow.