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