redis 拿不到连接池

巨葱 发布于 2015/02/06 12:01
阅读 5K+
收藏 0
redis.maxActive=32
redis.maxIdle=16
redis.maxWait=30000

redis.testOnBorrow=true

上面是reids配置,尝试改过maxActive、maxIdle、testOnBorrow的值,仍然拿不到连接池

控制台打印numActive的值,一般为2,不会超过8;

为什么老是拿不到连接池呢?

redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool at redis.clients.util.Pool.getResource(Pool.java:53) at redis.clients.jedis.JedisPool.getResource(JedisPool.java:99) at com.eku.prediagnosis.core.utils.RedisUtil.getResource(RedisUtil.java:79) at com.eku.prediagnosis.core.utils.RedisUtil.get(RedisUtil.java:313) at com.eku.prediagnosis.core.utils.RedisUtil.cacheGet(RedisUtil.java:240) at com.eku.prediagnosis.core.utils.RedisUtil.cacheGet(RedisUtil.java:228) at com.eku.prediagnosis.appserver.user.user.UserService.obtainUserOnline(UserService.java:313) at com.eku.prediagnosis.appserver.user.base.interceptor.AppBaseInterceptor.preHandle(AppBaseInterceptor.java:146) at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:130) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:919) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at com.eku.prediagnosis.core.servlet.EkuCharacterEncodingFilter.doFilter(EkuCharacterEncodingFilter.java:81) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: connect timed out at redis.clients.jedis.Connection.connect(Connection.java:150) at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:75) at redis.clients.jedis.BinaryJedis.connect(BinaryJedis.java:1797) at redis.clients.jedis.JedisFactory.makeObject(JedisFactory.java:70) at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:836) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:434) at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:361) at redis.clients.util.Pool.getResource(Pool.java:51) ... 34 more Caused by: java.net.SocketTimeoutException: connect timed out at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at redis.clients.jedis.Connection.connect(Connection.java:144) ... 41 more 后端-用户后

加载中
0
FatYU
FatYU
应该是你拿的时候redis的connection都被使用了,试着设置maxActive大点..你的连接使用后释放了吗?
0
巨葱
巨葱
maxActive试着调大过了,没有用,connection用完也被释放了
返回顶部
顶部