推荐学习书目
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
myyou
V2EX  ›  Python

在使用 DBUtils 的情况下, uwsgi 启动过多 woker 会影响 mysql 连接吗?

  •  
  •   myyou · Jul 25, 2016 · 2707 views
    This topic created in 3591 days ago, the information mentioned may be changed or developed.

    有用过 DBUtils 的吗? 如果设置 mincached (启动时开启的空连接数量)为 5 , mysql 允许的最大连接数为 100 , 使用 uwsgi 启动 21 个 django woker 的话, DBUtils 是不是就启动了 105 个 mysql 连接? 我知道 DBUtils 是线程共享的,请问进程之间共享吗?

    1 replies    2016-07-26 13:29:47 +08:00
    sujin190
        1
    sujin190  
       Jul 26, 2016
    这个明显得看你启动 DBUtils 的时机了吧,是在 fork 之前还是之后, fork 之后创建的连接肯定只能在本进程用啊,不过话说 python work 一般都是单线程的, DBUtils 没什么用处吧,开个连接一直挂着就是了,使用时检测下是否还正常就是了,完全不需要那么复杂的连接池管理机制
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5154 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 80ms · UTC 05:44 · PVG 13:44 · LAX 22:44 · JFK 01:44
    ♥ Do have faith in what you're doing.