xetorthio/jedis — Issue #260: Transactions seem successful but not really working as expected
Author: lostsoulgb
Created: 2012-02-28 20:52:04+00:00
State: open

Hi!

I am really enjoy using Jedis(I'm a bit of a rookie so I maybe making a n00b mistake, sorry in advance). I have code like this:
Jedis jedis = new Jedis("localhost");
jedis.getClient().setTimeout(100000);
Transaction t = jedis.multi();
for (int i = 0; i < data.length; i++){
for (int c = 0; c < data.length; c++)
t.sadd(Integer.toString(c), Integer.toString(i));
}
}
System.out.println("we are done");
t.exec();

but when I look at cpu usage, redis is constantly using 50-100% of a cpu, while the simlair code in python using redis-py uses python 100% then after the loop is done, redis starts working. In my example, redis would be going crazy even before the 'we are done' message prints out.

I am sure I'm making a mistake here but I'm having trouble figuring out what that is. Please advise.