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

django 里面设置了 CONN_MAX_AGE,但是使用数据库后台查看连接数和连接时间,发现还是依然有好多连接时间超过了 60s。为什么呢

  •  
  •   no13bus ·
    no13bus · Jan 15, 2015 · 7045 views
    This topic created in 4272 days ago, the information mentioned may be changed or developed.
    这个是设置:

    DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'spider',
    'USER': 'root',
    'PASSWORD': 'root',
    'HOST': '127.0.0.1',
    'PORT': '5432',
    'CONN_MAX_AGE': 60,
    }
    }
    2 replies  •  2015-01-15 20:26:33 +08:00
    est
        1
    est  
       Jan 15, 2015
    CONN_MAX_AGE 是指 idle 了60秒的连接会被reaper收走。你如果59秒一次操作59秒一次操作,就会永远长连。
    no13bus
        2
    no13bus  
    OP
       Jan 15, 2015
    @est 多谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   882 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 22:13 · PVG 06:13 · LAX 15:13 · JFK 18:13
    ♥ Do have faith in what you're doing.