general question about number of connections...

Gabriel Ramuglia gabe at
Sat Sep 5 08:44:54 MSD 2009

Depends what you're measuring. In general, that's quite a lot of
connections, something apache would never be able to handle properly.
Of course, if you're handling 2000 connections with nginx but you only
have, say, 100 php clients going at one time, that might be workable,
especially if most of the open connections are just because of a long
keep-alive period.

If on the other hand you have 2000 copies of php running, even if each
isn't doing a whole lot, you're wasting a lot of resources by making
the OS task-switch between so many processes. If the reason you have
so many processes open is because you're waiting on a slow database,
you could potentially speed up the web server by speeding up the
database server. Fewer open copies of php would lead to less cpu time
being wasted on task switching and related overhead. Of course, if
each php process is doing any tangible amount of work, then 2000
connections is probably too many.

In the end, my gut instinct is that 2000 connections to a server
handling php is quite a lot.  Although quad core opteron @ 2.33ghz is
no slouch, I think you'll find the intel core2quad to be quite a bit
faster, and should be cheaper as well. If it costs less than twice as
much as the core2quad, a dual quad xeon would be ideal; in my
experience it performs almost twice as fast as a core2quad, and
roughly three times as fast as what you're using now..


On Fri, Sep 4, 2009 at 6:38 PM, Ilan Berkner<iberkner at> wrote:
> Hi All,
> I finally figured out how to read the "stats" that nginx provides, although
> they are basic, its awesome.
> Our web server CPU and load get high when our traffic spikes and I'm just
> curious if someone could give me a "reasonable" quantification as to when
> its time to get another web server.
> What's holding up our web server are the PHP processes which are being held
> up by DB queries.  We're working on that.
> Currently I noticed that around 2,000 connections, is our choking point,
> that's when CPU gets maxed and load is high.  We have a dual core, dual CPU
> system with 8MB of RAM and 2.33 processors (AMD).  Database is a dedicated
> system (separate) so its processing is not interfering with the web server.
> I'm just interested in hearing an opinion about the number of connections,
> is 2,000 connections per box considered "A LOT" and its time to get another
> box or is that considered very "LOW" and we really should continue focusing
> on optimizing PHP and DB processes (which needs to be done anyway).  I just
> hate throwing more hardware at this unless I really have to.
> We are running Nginx with 4 processes and its CPU utilization is very low
> compared to the PHP processes (via PHP FPM).
> Just looking for any thoughts / opinions.
> Thanks!

More information about the nginx mailing list