--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at http://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.
No exceptions but the jedis.eval(...) gives back a null at times. I don't see connection starvations (like exceptions stating that connections not present in pool) nor timeout exceptions (socket timeouts or read timeouts) either.
I have the following code for connection pooling and evaluation of "eval"
config = new JedisPoolConfig();
config.setMaxActive(300);
config.setTestOnBorrow(false);
config.setTestOnReturn(false);
config.setMaxIdle(100);
// Tests whether connections are dead during idle periods
config.setTestWhileIdle(false);
pool = new JedisPool(config,
"serverhost", <Someport>,50,null,6);
and the code for calling eval is as follows -
public static Object eval(String script, int redisDB, List<String> keys, List<String> args) {
Jedis jedis = null;
Object value = null;
try {
jedis = pool.getResource();
//jedis.select(redisDB);
long t1 = System.currentTimeMillis();
value = jedis.eval(script,keys,args);
long t2 = System.currentTimeMillis();
System.out.println(Thread.currentThread().getName()+": Redis EVAL: "+(t2-t1)+" @ "+t2);
} catch (JedisConnectionException e) {
if (null != jedis) {
pool.returnBrokenResource(jedis);
jedis = null;
}
} finally {
if (null != jedis)
pool.returnResource(jedis);
}
return value;
}
Script is what is shared before... Only difference is as follows -
1. If I call this method "sequentially" for 10000 times, the INCR works perfectly and the final value is 10000.
2. If I call this method parallely, say in 100 threads each calling this method 10 times, the final INCR value is never 1000 but always close to it (something like 954, 977, 989 and sometimes 992).
3. If I call this in a DEBUG mode and space it out, then the value is perfectly 1000.
This made me think whether all eval functions are getting executed or not? Is there is a queue of "commands" being maintained at REDIS side?
Thank you..
Kashyap
Thanks Josiah. One question though - Am using Jedis java client . Did you ever experience issue with this client?
Regards
Kashyap
Will do. Thanks. But one question.
Redis runs on one thread. But when a command is getting executed, are the other commands queued or are they ignored? Both for normal commands and for Lua based execution.
Thanks!
Kashyap