首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >couchbase python SDK长连接

couchbase python SDK长连接
EN

Stack Overflow用户
提问于 2018-03-21 00:47:48
回答 1查看 84关注 0票数 2

我正在使用这个代码

代码语言:javascript
复制
from couchbase.cluster import Cluster
from couchbase.cluster import PasswordAuthenticator
cluster = Cluster('couchbase://localhost')
authenticator = PasswordAuthenticator('username', 'password')
cluster.authenticate(authenticator)
cb = cluster.open_bucket('bucket-name')

while True :
   cb.get('key1').value

在24小时内执行> 500次/秒的操作。

10分钟后,连接断开,进程终止。假设SDK有一些内存问题...

如何解决这个问题?我需要重置连接吗?

找到原点: cb.get('key1').value返回100,000个字符串的python列表。此查询每秒执行100次。--> Python解释器增加了OS分配(即使我们使用gc.collect),最终被OS杀死。

--> Python管理大列表+ realloc操作系统内存的问题。

EN

回答 1

Stack Overflow用户

发布于 2018-03-24 16:24:09

找到原点:

代码语言:javascript
复制
 cb.get('key1').value returns a python list of 100,000 string. 
 This query is done 100 times a second. 
 --> Python interpreter increases OS allocation (even we use gc.collect)
 And ends up being killed by OS .

--> Python管理大列表+ realloc操作系统内存的问题。

参考资料:

https://chase-seibert.github.io/blog/2013/08/03/diagnosing-memory-leaks-python.html

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49389873

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档