- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我在使用带有 Jedis 连接池的 Redis 时遇到问题。
我看到的行为是,在建立连接后,它们不会被释放回连接池。
我知道这一点是因为使用 redis-cli client list
命令我可以看到连接仍然存在。
有人可以检查我的 jedis 连接池,让我知道这是否会导致问题。
<spring:bean id="ElasticachePoolConfig" name="ElasticachePoolConfig" class="redis.clients.jedis.JedisPoolConfig" >
<!-- Minimum number of idle connections to Redis - these can be seen as always open and ready to serve -->
<spring:property name="minIdle" value="${redis.minIdle}" />
<!-- Number of connections to Redis that just sit there and do nothing -->
<spring:property name="maxIdle" value="${redis.maxIdle}" />
<!-- Maximum number of active connections that can be allocated from this pool at the same time -->
<spring:property name="maxTotal" value="${redis.maxTotal}" />
<!-- The minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor.-->
<spring:property name="minEvictableIdleTimeMillis" value="${redis.minEvictableIdleTimeMillis}" />
<!-- The minimum amount of time a connection may sit idle in the pool before it is eligible for eviction by the idle connection evictor -->
<spring:property name="softMinEvictableIdleTimeMillis" value="${redis.softMinEvictableIdleTimeMillis}" />
<!-- The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception -->
<spring:property name="maxWaitMillis" value="${redis.maxWaitMillis}" />
<!-- Maximum number of connections to test in each idle check -->
<spring:property name="numTestsPerEvictionRun" value="${redis.numTestsPerEvictionRun}" />
<!-- Tests whether connection is dead when connection retrieval method is called -->
<spring:property name="testOnBorrow" value="${redis.testOnBorrow}" />
<!-- Tests whether connection is dead when returning a connection to the pool -->
<spring:property name="testOnReturn" value="${redis.testOnReturn}" />
<!-- Tests whether connections are dead during idle periods -->
<spring:property name="testWhileIdle" value="${redis.testWhileIdle}" />
<!-- Idle connection checking period -->
<spring:property name="timeBetweenEvictionRunsMillis" value="${redis.timeBetweenEvictionRunsMillis}" />
<spring:property name="blockWhenExhausted" value="${redis.blockWhenExhausted}" />
</spring:bean>
其中属性设置如下...
redis.port=6379
redis.timeout=2000
redis.ttl=600
redis.host=localhost
redis.repeater.maxRetries=3
redis.repeater.millisBetweenRetries=2000
redis.minIdle=5
redis.maxIdle=10
redis.maxTotal=8
redis.minEvictableIdleTimeMillis=30000
redis.softMinEvictableIdleTimeMillis=-1
redis.maxWaitMillis=5000
redis.numTestsPerEvictionRun=10
redis.testOnBorrow=true
redis.testOnReturn=true
redis.testWhileIdle=false
redis.timeBetweenEvictionRunsMillis=50000
redis.blockWhenExhausted=true
最佳答案
您的 maxIdle
设置大于您的 maxTotal
设置,因此实际上不会在空闲时释放任何连接。该池将维护 maxIdle
连接。
JedisPool 在内部使用 Apache Commons Pooling。参见 this answer关于 maxIdle
和 maxTotal
之间的区别。
关于redis - Jedis 连接未被释放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46032586/
我有一个附加了 View Controller 的 AVAudioPlayer 实例。 @property (nonatomic, retain) AVAudioPlayer *previewAudi
我是java初学者。假设我声明了一个 Account 类型的变量 Account _account = new Account("Thomas"); 然后在其他地方我做了这样的事情: _account
我在我的应用程序中使用了 3 个 UIViewController,现在我想知道当我从另一个应用程序切换到另一个 UIViewController 时释放它们是否是一个好主意。显然,这将是隐藏的,当它
我分配了一个直接缓冲区: ByteBuffer directBuffer = ByteBuffer.allocateDirect(1024); 我读过: Deallocating Direct Buf
场景。我有一个图表,我可以使用右键单击来执行平移。这非常有效。然后我完美地添加了右键菜单。 问题。现在,即使在拖动操作完成后释放鼠标,也会显示右键菜单。 有没有办法在 Java Swing 或 Jav
我使用此代码获取 ABPerson 的姓氏 CFStringRef lastNameRef = ABRecordCopyValue((ABRecordRef)personRecordRef, kABP
目前,我们在基于 C 的嵌入式应用程序中使用 malloc/free Linux 命令进行内存分配/取消分配。我听说这会导致内存碎片,因为内存分配/取消分配会导致堆大小增加/减少,从而导致性能下降。其
当我尝试释放缓冲区时遇到问题。每次我尝试将缓冲区传递给释放方法时,都会发生段错误。 Valgrind 确认段错误位于 BufferDeallocate 方法中。 ==30960== Memcheck,
我想知道何时按下或释放修改后的键(Ctrl 或 Shift)。 基本上,用户可以在按下修改键的情况下执行多次击键,而我不想在它被释放之前执行一个操作(想想 Emacs 和 Ctrl + X + S).
我编写了一个相当大的网络应用程序。它运行良好一段时间,然后慢慢开始运行缓慢,因为 DOM 节点开始爬升到 80,000 - 100,000 左右。 所以我一直在 Chrome 开发工具控制台 (DCT
我知道在像 c 这样的语言中,我需要在分配内存后释放它。 (我来自 Java),对此我有几个问题: 当我在做的时候: int array[30]; (即创建一个大小为 30 个整数的数组)与
这个问题在这里已经有了答案: 关闭 11 年前。 Possible Duplicate: How to release pointer from boost::shared_ptr? Detach
我有一个可以从多个后台线程访问的类,可能同时访问。我无法复制该类,因为重新创建它的内容(处理或内存方面)可能很昂贵。 也有可能在后台处理仍在继续并访问该属性时替换了此类的属性。 目前我有定期的保留/释
这个问题是对: 的扩展链接-1:Creating an image out of the ios surface and saving it Link-2:Taking Screenshots fro
我有一个实例变量 NSMutableArray* searchResults。 首先,我初始化它: self.searchResults = [[NSMutableArray alloc] init]
如果我在堆上声明一些东西,比如 char *a=new char[1000] 并且主程序停止,如果没有 delete[]<,那么分配的内存会发生什么 调用?它保留在堆上还是自动释放? 最佳答案 就C+
在开发相机应用时,我遇到了一个异常,该异常仅在我切换到其他应用时发生(onPause() 用于我的应用)。 01-15 17:22:15.017: E/AndroidRuntime(14336): F
使用 JDK 1.8 编译时出现 maven 编译器错误 无法执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (de
将 BufferedImage 保存到磁盘(以释放内存)的最快方法是什么? 我的 Java 应用程序处理大量图像(每约 300 毫秒将图像加载到内存中)。大多数这些图像都会立即被丢弃 (gc),但每隔
使用 JDK 1.8 编译时出现 maven 编译器错误 未能在项目 DUMMY 上执行目标 org.apache.maven.plugins:maven-compiler-plugin:3.8.1:
我是一名优秀的程序员,十分优秀!