推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
zhu123456
V2EX  ›  Python

关于 celery 和 redis 的 CLOSE_WAIT 连接问题

  •  
  •   zhu123456 · Dec 25, 2018 · 2481 views
    This topic created in 2843 days ago, the information mentioned may be changed or developed.
    使用 celery 时,用 redis 作为 result_backend 和 broker,配置是 CELERY_RESULT_BACKEND = 'redis://localhost:6379/2',CELERY_BROKER_URL = 'redis://localhost:6379/0'。执行任务时,一开始会生成很多 ESTABLISHED 的 tcp 连接无法回收,connected_clients 不断累积。如:uwsgi 31657 root 2263u IPv6 918201 0t0 TCP localhost:39098->localhost:6379 (ESTABLISHED)。
    后来在 redis 的配置中添加了 timeout=60,redis 中利用 info clients 命令查询发现,connected_clients 数量过一段时间确实会降下来;但是利用 netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'命令查询发现,又产生大量的 CLOSE_WAIT 的 tcp6 连接,用 lsof -i 命令查看连接结果是,如:uwsgi 31657 root 3289u IPv6 934052 0t0 TCP localhost:41230->localhost:6379 (CLOSE_WAIT)。(项目中,没有使用任何连接池)该怎么解决大量 CLOSE_WAIT 连接问题? 头大了好几天了,望大佬指点一下
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2587 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 21ms · UTC 10:10 · PVG 18:10 · LAX 03:10 · JFK 06:10
    ♥ Do have faith in what you're doing.