CodeIgniter 中 pconnect 选项的优缺点 [英] Advantages / Disadvantages of pconnect option in CodeIgniter
本文介绍了CodeIgniter 中 pconnect 选项的优缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
CodeIgniter 数据库配置中的一个参数如下
One of the parameters in the CodeIgniter database config is the following
['pconnect'] TRUE/FALSE - Whether to use a persistent connection
您建议我将其设置为什么?
如果我将其设置为 FALSE,是否会对性能造成重大影响?
将其设置为 TRUE 可能会出现哪些潜在问题?
What do you recommend I set this to?
Is there a significant performance hit if I set it to FALSE?
What potential problems might arise from setting it to TRUE?
推荐答案
只需查找持久连接的一般最佳实践即可.我的建议.
Just look up general best practices for persistent connections. My suggestions.
- 默认情况下,不要
- 如果您有:
- 生产中的专用网络服务器和数据库硬件
- 并正确调整了网络服务器和数据库
- 并拥有准确的类似生产的测试环境
- 仍然认为您的性能问题是由数据库连接时间引起的,
考虑开启它
持久连接可能导致
- 由于某些连接状态在无意中持续存在而导致的错误(这是一个大问题!)
- 要超出数据库连接限制
- 由于许多(主要是空闲的)连接使用了大量内存,数据库性能下降
- 错误,因为连接已经过时"并且应用没有注意到
但是可以
- 减少初始连接的延迟
如果您认为连接延迟导致问题,请考虑在您的性能测试系统中启用它并衡量影响.
If you think that connection latency is causing a problem, consider turning it on in your performance test system and measuring the impact.
这篇关于CodeIgniter 中 pconnect 选项的优缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文