redis 连接池的一些问题

 
 
问题: 
Could not get a resource from the pool
将配置修改为如下:
  1. JedisPoolConfig config =newJedisPoolConfig();
  2. config.setMaxTotal(200);
  3. config.setMaxIdle(50);
  4. config.setMinIdle(8);//设置最小空闲数
  5. config.setMaxWaitMillis(10000);
  6. config.setTestOnBorrow(true);
  7. config.setTestOnReturn(true);
  8. //Idle时进行连接扫描
  9. config.setTestWhileIdle(true);
  10. //表示idle object evitor两次扫描之间要sleep的毫秒数
  11. config.setTimeBetweenEvictionRunsMillis(30000);
  12. //表示idle object evitor每次扫描的最多的对象数
  13. config.setNumTestsPerEvictionRun(10);
  14. //表示一个对象至少停留在idle状态的最短时间,然后才能被idle object evitor扫描并驱逐;这一项只有在timeBetweenEvictionRunsMillis大于0时才有意义
  15. config.setMinEvictableIdleTimeMillis(60000);
 





原文地址:https://www.cnblogs.com/rongfengliang/p/6559325.html