CodeIgniter中pconnect选项的优点/缺点 [英] Advantages / Disadvantages of pconnect option in CodeIgniter
本文介绍了CodeIgniter中pconnect选项的优点/缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
CodeIgniter数据库配置中的一个参数如下
['pconnect'] TRUE / FALSE - 使用持久连接
您建议我将此设置为?
如果我将它设置为FALSE,那么会有显着的性能损失?
将其设置为TRUE可能会产生什么潜在问题?
解决方案
只需查找持久连接的一般最佳实践。我的建议。
- 默认情况下,不要
- 如果您有:
- 生产中专用的网络服务器和数据库硬件
- 并已正确调整网络服务器和数据库
- >
< < / li>< / li>< / li>
CONSIDER打开
持续连接可能会导致
- 由于某些连接状态无意中持续存在而导致错误(这是一个大问题!)
- 超出数据库连接数限制
- 数据库性能下降,因为许多(大多数是空闲)连接使用的大量的RAM
- 错误,因为连接已经陈旧,应用程序没有通知
但是
如果您认为连接延迟会导致问题,请考虑在性能测试系统中打开它,测量
影响。One of the parameters in the CodeIgniter database config is the following
['pconnect'] TRUE/FALSE - Whether to use a persistent connection
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.
- By default, DO NOT
- If you have:
- Dedicated web server and database hardware in production
- and have tuned the web server and database correctly
- and have an accurate production-like test environment
- And still think your performance problems are caused by database connection time,
CONSIDER turning it on
Persistent connections can cause
- Bugs because some connection state persisted unintentionally (this is a biggie!)
- Database connection limits to be exceeded
- Database performance to drop because of lots of ram used by the many (mostly idle) connections
- Bugs because connections have gone "stale" and the app didn't notice
But CAN
- Reduce latency on initial connection
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屋!
查看全文