lywane 最近的时间轴更新
lywane

lywane

V2EX 第 280544 号会员,加入于 2018-01-07 12:35:05 +08:00
lywane 最近回复了
2018-01-08 12:32:03 +08:00
回复了 lywane 创建的主题 Python 请教使用 gunicorn 部署 flask 时遇到的 redis 连接数飙升问题
@myyou
如下声明之后,
rdp = redis.ConnectionPool(host='127.0.0.1', port=6379,max_connections=10)
cache = redis.StrictRedis(connection_pool=rdp)

请求过来时会报错:
[2018-01-08 12:06:10,117] ERROR in app: Exception on / [POST]
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/lib64/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/opt/t_fl.py", line 54, in index
timeout, endtime = get_timeout_endtime(GID)
File "/opt/t_fl.py", line 20, in get_timeout_endtime
timeout_endtime = cache.get(gid)
File "/usr/lib/python2.7/site-packages/redis/client.py", line 976, in get
return self.execute_command('GET', name)
File "/usr/lib/python2.7/site-packages/redis/client.py", line 665, in execute_command
connection = pool.get_connection(command_name, **options)
File "/usr/lib/python2.7/site-packages/redis/connection.py", line 965, in get_connection
connection = self.make_connection()
File "/usr/lib/python2.7/site-packages/redis/connection.py", line 981, in make_connection
raise ConnectionError("Too many connections")
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   954 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 14ms · UTC 20:43 · PVG 04:43 · LAX 12:43 · JFK 15:43
Developed with CodeLauncher
♥ Do have faith in what you're doing.