Redis: Java client

Update: I have added the source code to my github page: https://github.com/kirsn/JavaRedisClient

I have been looking at Redis the past week, and realized that a Java client for Redis would help my cause… so quickly wrote one up. Its available here:  redis-java-client-rename-to-zip (please note, I saved it as .ppt to get it to upload to wordpress. Its actually a .zip file, just rename the extension to .zip to use it.)

One of the things I noticed is that the benchmarks numbers are way lower, through this Java client, than if I were to run the ./redis-benchmark. These are the numbers that I see, haven’t figured out what to make of it.

./redis-benchmark numbers

~/redis-beta-8$ ./redis-benchmark -q
PING: 49266.01 requests per second
SET: 56191.01 requests per second
GET: 53191.49 requests per second
INCR: 29697.33 requests per second
LPUSH: 43125.00 requests per second
LPOP: 40249.00 requests per second

Java client benchmark numbers

SET rates: 13027.44 requests per second.
GET rates: 13412.41 requests per second.
SETNX rates: 14118.09 requests per second.
PING rates: 16025.10 requests per second.
INCR rates: 13786.44 requests per second.
LPUSH rates: 15134.22 requests per second.
LPOP rates: 13687.28 requests per second.

Advertisements

5 thoughts on “Redis: Java client”

  1. Hi Kiran,

    The code is great. Do you have a git repo? I’ve fixed a small bug wherein some binary data values containing bytes 10 or 13 get truncated. Essentially you’re reading by line rather than counting bytes. I’m not sure of the Redis limits, but PrintWriter seems to handle only 7-bit ASCII (or UTF-8 – at least not 128-255 bytes of the stream). Perhaps we should use a byte stream writer.

    From my tests, keys are 7-bit (except 0, 10 and 32) and values can be anything 0-127, but I expect the full 8-bit range.

    Thanks again for your code. I’ll push my changes as soon as I hear back from Antirez.

    Cheers,
    Alex

    1. Alex,
      Thanks for your comments, and corrections. I probably need to setup a git repos – have been putting it off.

      Right now reading your interesting blog.

      Kiran

    1. Kalpesh,
      The intention wasn’t to re-invent.
      I did this stuff almost a year or so ago, and was itching to code something up during boring office meetings. Maybe I should have used Google better, and located JRedis back then.
      Anyway, thanks for stopping by 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s