io.lettuce.core.protocol.CommandHandler  : null Unexpected exception during request: java.io.IOException: 

Reconnecting, last destination was localhost/127.0.0.1:6379
 

	public GenericObjectPoolConfig<?> redisPoolConfig()
	{
		GenericObjectPoolConfig<?> poolConfig = new GenericObjectPoolConfig();
		
		//
		poolConfig.setMaxTotal(20); // 最大连接数
		poolConfig.setMaxIdle(10); // 最大空闲连接数
		poolConfig.setMinIdle(5); // 最小空闲连接数
		poolConfig.setTestOnBorrow(true); // 借用连接时PING检测(解决远程关闭连接的核心)
		poolConfig.setTestWhileIdle(true); // 空闲时检测连接有效性
		
		poolConfig.setMaxWaitMillis(3000); // 获取连接最大等待时间(3秒)
		poolConfig.setTimeBetweenEvictionRunsMillis(60000); // 1分钟检测一次空闲连接(优化:从5分钟改为1分钟,更快发现断连)
		poolConfig.setMinEvictableIdleTimeMillis(300000); // 连接空闲5分钟后才可能被回收
		poolConfig.setNumTestsPerEvictionRun(3); // 每次检测3个连接
		
		//
		return poolConfig;
	}

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐