Why doesn't django support connection pool?

前端 未结 2 669
醉话见心
醉话见心 2021-01-14 20:54

I wonder why django doesn\'t support connection pool? I can\'t bear open/close connection every request. I try to solve it, but hasn\'t a good solution.

I try to us

相关标签:
2条回答
  • 2021-01-14 21:24

    Here's a discussion about why django did not add pooling to the core: https://groups.google.com/forum/#!topic/django-developers/NwY9CHM4xpU

    Generally speaking it's because third party applications such as pgbouncer do it better.

    0 讨论(0)
  • 2021-01-14 21:44

    EDITED: look at Django persistent database connection (feature introduced in 1.6).

    Persistent connections avoid the overhead of re-establishing a connection to the database in each request. They’re controlled by the CONN_MAX_AGE parameter which defines the maximum lifetime of a connection. It can be set independently for each database.

    0 讨论(0)
提交回复
热议问题