Hey there
I recently noticed* that there may be a misconfiguration between the number of concurrent connections that your Apache frontend accepts and the number of connections that the backend database will allow.
Since this can be a slight nuisance to some** I would like to suggest something that may remedy the situation - along with a description of why the problem may exist in the first place.
The problem:
When a user connects to the Apache webserver Apache will launch the forum software through an interpreter running through a "Multi-Processing Module" and the forum software will in turn create a connection to the database backend. By default Apache will allow 250 such connects and will queue up any further connections and treat them later (see http://httpd.apache.org/docs/2.....maxclients ).
Once a user has established a connection to Apache they can keep the connection for a little while (HTTP 1.1 keepalive) to further speed up loading of other page content.
Since we are talking about Wordpress here I'm going to assume that MySQL is the database server used by the backend. When Wordpress connects to MySQL it either creates a new connection on every request (default) or reuses a set of persistant connections. MySQL only allows a limited number of client programs (like Wordpress and the forum) to connect at the same time - 151 seems to be the golden number here. Once that many clients have connected, any further attempts to connect will be met by an immediate rejection by MySQL (see http://dev.mysql.com/doc/refma.....tions.html ).
In other words: A default Apache+MySQL+PHP+Wordpress setup would start emitting immediate Database Connection Rejected errors once more than 151 concurrent users visit the site. The frontend would be able to quickly serve the error messages and thus would appear to be fairly quick even under load. This is exactly the situation observed for this website - and please feel free to delete my post if this is in fact an incorrect analysis of your problem.
Suggested Solutions and other Optimizations:
1) Match backend connections with frontend connections:
Either increase the number of connections that MySQL can handle concurrently or decrease the number of connections that Apache will put into the MPM concurrently in such a way that there is always enough headroom for the database to serve the requests without dropping users to an error page. Specifically this is done by adjusting the following configuration directives:
Apache config file (typically /etc/apache2/httpd.conf or /etc/apache2/modules.d/00_mpm.conf) -> MaxClients
MySQL config file (typically /etc/mysql/my.cnf) -> mysqld section
set-variable = max_connections=<xyz>
The result is that all page loads will be slightly slower but rather than sometimes dumping people to an error message all pages should be served properly.
2) Try switching to persistant connections if you aren't already using them. (mysql_pconnect instead of mysql_connect in wp-db.php, you must have done [1] first, though!)
3) Try enabling and increasing the MySQL query cache size. This will allow reads from the database to be greatly (!) sped up when using Wordpress:
query-cache-size=<xyz> (see http://dev.mysql.com/doc/refma.....cache.html This can be done without doing [1] or [2])
After-word:
Please ignore my general ignorance about your particular setup. I'm afraid info has been really sparse.
I may be completely wrong in my assumptions, in which case I really hope that you understand that this post was meant as a helping hand for the organization and its participants; not a rant in any way***.
Best regards,
Me
ps. I apologize in advance for spelling and grammatical errors, my native language is not English.
* An understatement - this has been going on for several days now, it is blowing peoples' heads up!
** It is blowing my head up!
*** Although the thing is still really blowing my head up!

