in reply to Help, please - MySQL database error - too many connections
What you need is Apache::DBI which will manage a pool of persistent connections for you. Now every new request will not start a new connection but will re-use an existing connection, which will cut down your number of connections to the maximum number of concurrent requests which access the database, rather than adding a new connection for each such request (and they will only disappear once the time-out value expires, meaning you will quickly run out of free connections).
Another solution is set the time-out value to a very short period of time (thus freeing more quickly your connections) but that has the drawback that you need to re-connect frequently and that will cost precious time.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help, please - MySQL database error - too many connections
by fraktalisman (Hermit) on Nov 18, 2009 at 11:07 UTC |