MaxClients exceeded on Heroku

apache-2.2heroku

Our Heroku app went down for a period of time yesterday. The error message in our logs:

[error] server reached MaxClients setting, consider raising the MaxClients setting

I checked the httpd.conf to see what the MaxClients setting was, and this is what I found:

MaxClients 1

The commit that added these directives is on Heroku's Github. Does there appear to be a rationale for a MaxClients setting of 1, or is it simply arbitrary? Are there any considerations I should make when increasing it?

Best Answer

Heroku dynos are designed to be a single unit of computation. For comparison:

A single-threaded, non-concurrent framework like Rails can process one request at a time.

Setting MaxClients 1 is simply telling your PHP dyno to only handle its one request at a time. Since the dyno is actually capable of handling many more requests that that, MaxClients can and should be raised to a number much larger, such as 256.