Hi,
how did you run the test?
some comments:
Jedis is in general a very fast redis client comparing with other clients out there (ruby, php, etc.). I doubt Jedis will ever be as good as redis-benchmark because it is Java and it is in general slower than c (not always, but usually it is) and also something that I noticed in redis-benchmark is that it is not waiting for the response in the socket (at least what I could understand from the code). That changes a lot numbers, if you do the same in Jedis you'll see a huge improvement, of course it doesn't make any sense for a client.
redis-benchmark is more oriented to benchmark Redis server, probably that is why they are not waiting and reading response from socket.
Also I am not sure if when they run these tests, they use pipelines, which will speed up everything a lot.
I am very interested in digging more into this. Maybe there is something wrong in Jedis somewhere, but such a big difference usually tells that the benchmark is not exactly the same on both.
# redis-benchmark -n 100000 - c 128 -d 500
-Abhishek kona
Ok, after digging a while...
redis-benchmark won't measure time for the actual parsing of responses, just receiving the response but not parsing it. So there will be difference between redis-benchmark and Jedis.
Also redis-benchmark is not using threads but FD's,
where your test with Jedis uses A LOT of threads (128), that means A LOT of thread-context-switches which is probably killing the benchmark.
Also redis-benchmark won't use CPU assigned to Redis, while JVM probably will do.
So I would say that benchmarking this way is somehow unfair.
What happens if you use less threads? With 4 cores, one for Redis, you should probably use something between 10-20 threads? Not sure about that actually.
What kind of operations are you performing?
Hi Jonathan,
Thanks for digging a bit deep.
As of now I am testing only the Redis SET operation. I ran the test with different thread count.
Have a look at https://gist.github.com/1016035
( Both the redis and the test were running on My MacBook , so might not be very accurate, will post results on a linux Box).
You can have a look at https://github.com/sheki/sheki/tree/master/jedis-benchmark for the code.
On 09/06/11 4:37 AM, Jonathan Leibiusky wrote:Each Client is a separate process then?Ok, after digging a while...
redis-benchmark won't measure time for the actual parsing of responses, just receiving the response but not parsing it. So there will be difference between redis-benchmark and Jedis.
Also redis-benchmark is not using threads but FD's,
I can see the performance degrading with 32 and beyond threads. I think it was the high thread count which was skewing my numbers.
where your test with Jedis uses A LOT of threads (128), that means A LOT of thread-context-switches which is probably killing the benchmark.
Also redis-benchmark won't use CPU assigned to Redis, while JVM probably will do.
So I would say that benchmarking this way is somehow unfair.
What happens if you use less threads? With 4 cores, one for Redis, you should probably use something between 10-20 threads? Not sure about that actually.