Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
168 views
in Technique[技术] by (71.8m points)

php - Advantages / Disadvantages of pconnect option in CodeIgniter

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...