Memory consumption

Each request consumes resources, including RAM. Orders of magnitude: An apache with mod_php can therefore hardly accept more than 1000 permanent connections.

What can overload your web server

KeepAlive HTTP

During KeepAlive, connections use a request. If you have a lot of clients, the recommended KeepAlive of 60s will block a prefork apache.

Simulation

Solutions:

Slow clients

Slow connections use resources during download.

Simulation

Solutions :

Permanent connections (Tchat, Push)

It's hard to have a lot of permanent connections with PHP.

Slow queries

Queries can be slow or slow only in case of overload: lack of CPU/IO or slow web-service/BDD/LDAP.

Solutions

System limits (max open files, TCP TimeWait/CloseWait)

Solutions

Manage the overloading of your web server

maxConnections/MaxRequestWorkers

In case of overload, apache / haproxy / tomcat / FPM / uwsgi use the backlog to keep pending connections.

nginx / nodejs do not use the backlog.

If worker_connections is exceeded, nginx: So make sure you have a high worker_connections!

Simulation

Avoid saturating the backend

Using apache max option, you can limit the requests to the backend and keep the others waiting.

The equivalent in nginx (queue) is not available in Open Source nginx. Nginx limit_conn returns an error to the client.

Simulation with or without queue

Various

List of simulations