3

I have 10 application servers and 1 mysql database. I would like to do connection pooling for mysql, but simply enabling mysql_pconnect() will not work since it'll cause some servers to have more connections than others.

What's the best solution for this scenario..?

Ian
  • 24,116
  • 22
  • 58
  • 96

1 Answers1

3

Why do you want to use persistent connections?

They are likely to cause trouble and will not improve performance noticeably (in all likelihood).

Run some performance tests on production-grade hardware in your lab, and you'll see.

MarkR
  • 62,604
  • 14
  • 116
  • 151
  • 1
    When opening thousands of connections over and over, that adds a lot of overhead. Persistent connections will make considerable improvements on the mysql server.. – Ian Feb 12 '10 at 17:14
  • @MarkR is correct, see http://groups.google.com/group/comp.databases.mysql/browse_thread/thread/4ae68befe1b488e7/e843f0b9e59ad710?#e843f0b9e59ad710 – Bill Karwin Feb 12 '10 at 20:00
  • Ian - do not presume to know how much impact persistent connections makes until you've performance tested on it. We found (when doing production-grade hardware performance measurement) that it made no significant difference. – MarkR Feb 13 '10 at 23:11
  • 2
    More info for the debate: http://www.mysqlperformanceblog.com/2006/11/12/are-php-persistent-connections-evil/ – YOMorales Jun 20 '11 at 20:43