Quantcast
Channel: KEREBUS » java
Viewing all articles
Browse latest Browse all 2

Trying out Redis with Java

$
0
0

I decided to take Redis for a spin on Sunday.

Redis is a key-value store and much more. For some good Redis use-cases read:
http://highscalability.com/blog/2011/7/6/11-common-web-use-cases-solved-in-redis.html

I installed redis using macports:
sudo port install redis
Although you can install it any way you want. Check the Redis download page.

Started the server
redis-server

Coded some Java based tests using Jedis.

Output on my 2010 macbook pro when running the tests within an IDE:

main: Starting cache writing test: 100 concurrent clients doing 1000 writes each. (100000 total writes)
main: Waiting for clients to finish writes.
main: 100 clients did 1000 writes in 5181 ms.
main: Served about 19301.29 writes per second.
============================================================================
main: Publishing 1000 messages to 10 subscribers.
main: Waiting for subscribers to receive all messages.
main: Published 1000 messages and confirmed receival in 10 subscribers in 360 ms.
main: Throughput (to confirmed delivery) with 10 subscribers was about 2777.78 published messages per second.
main: 27777.78 messages received in total per second.
============================================================================
main: 100 clients doing 1000 lookups each.
main: Waiting for clients to finish lookups.
main: 100 clients did 1000 lookups each for a single cached value in 3812 ms.
main: Served about 26232.95 lookups per second.
============================================================================
main: 100 clients incrementing the same key 1000 times.
main: Waiting for threads to finish.
main: 100 concurrent clients incremented 'incrKey1337529005509' 1000 times each. Completed in 3868 ms.
main: So around 25853.15 increments per second
============================================================================
main: 5 queue listening clients dequeuing 50000 items from a queue.
main: Waiting for all items to be dequeued.
main: 5 clients listening to 'queueKey1337529009407' containing 50000 items emptied the queue in 1942 ms
main: Queue listeners processed about 25746.65 items per second.
QueueListener-2: dequeued a total of 9954 items
QueueListener-1: dequeued a total of 10031 items
QueueListener-5: dequeued a total of 9991 items
QueueListener-3: dequeued a total of 9973 items
QueueListener-4: dequeued a total of 10051 items
============================================================================

Clone the repository and try twiddling around with it yourself:
git clone git://github.com/kallebertell/redisperf.git

You should be able to run the tests with plain maven:
mvn test

Or browse the github repo here: https://github.com/kallebertell/redisperf

For more info about Jedis, check: https://github.com/xetorthio/jedis/wiki


Viewing all articles
Browse latest Browse all 2

Trending Articles