为什么django不支持连接池? [英] Why doesn't django support connection pool?

查看:250
本文介绍了为什么django不支持连接池?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么django不支持连接池?我不能承受每个请求的开/关连接。我试图解决它,但没有一个很好的解决方案



(我尝试使用 TypeError:init()只需要1个参数(3个给定的值),但是它们不能同时使用, )

编辑:查看 Django持久数据库连接(1.6中介绍的功能)


持续连接避免在每个请求中重新建立与数据库的连接的开销。它们由CONN_MAX_AGE参数控制,该参数定义了连接的最大使用寿命。可以为每个数据库独立设置。



i wonder why django doesnt 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 use mysql_pool , but fail. TypeError: init() takes exactly 1 argument (3 given) )

解决方案

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.

这篇关于为什么django不支持连接池?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆