It would be helpful to know what operating system you are using. I'm really hoping it's not Windows.
Anyway, this was written by Martin Langhoff back in 2005. I think it's still good advice...
"Whenever you see the 'database overloaded' screen, the database itself is documenting the exact reason why it is refusing the connection in the logs. This applies to
Postgres and
MySQL.
If you are using Linux/Unix, you will usually find it in /var/log/my
sql/ (or /var/log/postgres/), look for files with an ".err" extension or a ".log" extension. A good practice is to use the "tail" utility to track the file as the problem is occurring.
Under Windows, take a loot at the event log -- and perhaps at MySQL's data directory.
When you get the error msg, use google to find the database docs, and it'll probably tell you exactly what's happening.
Other things to do as well:
- run top and sysstat while the server is experiencing load
- do top/sar/vmstat say it's IO-bound (for instance, what is the percentage of iowait and system time reported)? Perhaps you need fast SCSI drives or to split the work over more spindles (drives).
- do top/sar/vmstat say you are using swap (are pageins/pageouts increasing during your peak-traffic) ? add memory -- as much as you can fit.
- Google for "mysql performance tuning" and follow the guides.
- Enable mysql's slow query log and monitor slow queries to help us improve the DB schema.
I've posted in this forum a mini-guide (based on mod_perl guide's performance tuning section -- go to the source for more detail). It explains how to tune MaxClients and connection_timeout in
Apache+MySQL according to your expected load and available memory (remember to retune if you add memory!). Once it's well tuned, you can enable persistent connections for better performance. Seek and ye shall find...
Keep in mind, there's only so much a single machine can do".
One more thing. I would never run a production server without some sort of monitoring - iostat, munin, nagios and others. You will find loads of information about all of these on the web. Google knows everything