I had seen a connection thrashing issue with the pool when I had
maxIdle set to less than maxActive in the pool and the actual number
of connections in use was less than maxIdle - I sorted that out. I
put the pool config in a file that looks like this:
# jedis pool settings, documented here
#
http://commons.apache.org/pool/apidocs/org/apache/commons/pool/impl/GenericObjectPool.html
minIdle = 1
maxIdle = 15
maxActive = 15
connTimeout = 299000
# see
http://commons.apache.org/pool/apidocs/constant-values.html
whenExhaustedAction = 1
testWhileIdle = false
whenExhaustedMaxWait = -1
minEvictableIdleTimeMillis = 125000
timeBetweenEvictionRunsMillis = 120000
numTestsPerEvictionRun = 3
My (scala) code that starts the JedisPool looks like this:
def startCorePool(): JedisPool = {
try {
// create a new jedis configuration and set attributes from the
configuration file
val dbConf = new JedisPoolConfig()
dbConf.setMinIdle(config.getInt("ccm.redis.minIdle", 5))
dbConf.setMaxIdle(config.getInt("ccm.redis.maxIdle", 25))
dbConf.setMaxActive(config.getInt("ccm.redis.maxActive", 25))
dbConf.setWhenExhaustedAction(config.getInt("ccm.redis.whenExhaustedAction",
1).toByte)
dbConf.setTestWhileIdle(config.getBool("ccm.redis.testWhileIdle",
false))
dbConf.setMaxWait(config.getInt("ccm.redis.whenExhaustedMaxWait",
60000))
dbConf.setMinEvictableIdleTimeMillis(config.getInt("ccm.redis.minEvictableIdleTimeMillis",
-1))
dbConf.setTimeBetweenEvictionRunsMillis(config.getInt("ccm.redis.timeBetweenEvictionRunsMillis",
30000))
dbConf.setNumTestsPerEvictionRun(config.getInt("ccm.redis.numTestsPerEvictionRun",
-1))
// get redis access info from config file
val redisHost = config.getString("ccm.redis.coreHostname",
"corehost")
val redisPort = config.getInt("ccm.redis.corePort", 6379)
val redisAuth = config.getString("ccm.redis.coreAuth", "")
val redisTimeout = config.getInt("ccm.redis.connTimeout", 2000)
// create the jedis pool
val pool = new JedisPool(dbConf, redisHost, redisPort,
redisTimeout, redisAuth)
logger.info("CORE Redis connection pool instantiated.")
//return the pool
pool
}
catch {
case e: InstantiationException => {
logger.info("Could not instantiate CORE Redis connection
pool", e)
throw new RuntimeException(e)
}
case unknown => {
logger.info("CORE Redis unhandled exception")
throw new RuntimeException(unknown)
}
}
}
Thanks for taking a look.
Regards,
Steve Boyle
On Aug 22, 9:12 am, Jonathan Leibiusky <
ionat...@gmail.com> wrote:
> Interesting. It really seems like an issue in the pool. Maybe a
> configuration thing.
> Can you share your conf so I can try to reproduce this?
>
> On 8/22/11, Eric Hauser <
ewhau...@gmail.com> wrote:
>
>
>
> > I've been load testing an application using Jedis for the past week,
> > and I am able to get ~40K operations per second on a laptop (20 SETBIT
> > operations in a pipeline). However, I dumped commons pool awhile ago
> > after I was able to regularly get it to deadlock under heavy load and
> > saw lots of people reporting similar findings. If you are interested
> > in the pool I am using, it is available here:
>
> >
https://gist.github.com/1162766
>
> > I was going to look into the commons pool issue, but it does not
> > provide any useful metrics about the state of the pool, so I just went
> > another direction that gave me more insight.
>
> > On Mon, Aug 22, 2011 at 11:48 AM, SBoyle <
sboyle...@gmail.com> wrote:
> >> I'm having an issue with Jedis and Redis where when I push over 4K
> >> operations/second redis goes to 100% CPU. I am using Jedis Pooling.
> >> I see on the redis side that redis's CPU usage is about 3% User space
> >> CPU and about 97% Sytem space CPU. Has anyone else seen this kind of
> >> behavior? What could I be doing wrong to cause this type of problem?
>
> >> Using redis benchmark against the same redis instance with a similar
> >> command set I can get 80K operations/second. Not sure how to dig into
> >> to Jedis to see what is going on. Would appreciate some feedback.
>
> >> There are some more details available on our redis instance in the
> >> Redis DB google group:
> >>
http://groups.google.com/group/redis-db/browse_thread/thread/38276975...
>
> >> Thanks,
> >> Steve Boyle