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

Python 项目中使用了 mysql.connector.pooling ,创建了 32 个数据库连接,使用完毕之后,已经关闭了数据库连接,但是在数据库发现还是存在大量的 Sleep 数据库连接

  •  
  •   blakefan · May 27, 2020 · 3177 views
    This topic created in 2201 days ago, the information mentioned may be changed or developed.
    6 replies    2020-05-29 09:25:18 +08:00
    est
        1
    est  
       May 27, 2020
    mysql.connector.pooling 是 oracle 官方那个驱动?
    fixend
        2
    fixend  
       May 27, 2020
    一般的 pool 都不会马上回收连接的,否则每次都要新建连接就很慢了,要么空闲连接达到一定数量,要么空闲连接超过一定时间,这些一般都有参数可以设置,甚至设置成马上回收不保留空闲连接。
    xizismile
        3
    xizismile  
       May 27, 2020 via Android
    @fixend 可以参考二楼说的,改一下线程池的各个配置参数,然后再去数据库看看连接数。实验加验证,帮助更好地理解线程池的配置
    qW7bo2FbzbC0
        4
    qW7bo2FbzbC0  
       May 27, 2020
    一直用的 pymysql + dbutils 不清楚 mysql.connector
    qW7bo2FbzbC0
        5
    qW7bo2FbzbC0  
       May 27, 2020
    mysql.connector 是纯 py 的吗
    lolizeppelin
        6
    lolizeppelin  
       May 29, 2020
    直接翻下 close 代码不就知道了....
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2777 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 05:20 · PVG 13:20 · LAX 22:20 · JFK 01:20
    ♥ Do have faith in what you're doing.