It was thus said that the Great Mick Sheppard once stated:
> Hi,
> 
> Just to throw a slight spanner in the works here. My understanding of
> 'open files' is open file descriptors. As far as a file descriptor is
> concerned there is no real difference between a physical file on disk
> and a socket (network connection). So eliminating physical files, whilst
> it might get you a little more headroom, is unlikely to solve the
> problem.

  Yes and no.  Yes, sockets are considered "opened files" and do count
against the open file limit, that limit is *per process*, not *system wide*. 
I just checked one of our main web servers (serving up a few hundred sites)
and found only three active sockets per process:

        1. the listening socket on port 80, waiting for a connection
        2. the listening socket on port 443, waiting for a connection
        3. an actual connection to a client

  The main root process only has the first two sockets open.  If you have
Apache configured to have at a minimum 30 spare servers, no one Apache
process will have 30 sockets open---sockets just don't work that way.  What
it does mean is you have at least 31 apache processes running, one as root
(to bind to the proper ports [1]) and 30 ready to service a request, so at
most, any Apache process will have one socket per Listen statement, and one
socket only when actually processing a request.

  So, for example, let's say you have the following Apache configuration:

Listen                  *:80
StartServers             100
MinSpareServers          100
MaxSpareServers          900
ServerLimit             1000
MaxClients              1000
MaxRequestsPerChild     4000
CustomLog               access_log
ErrorLog                error_log

All your apache processes would have only seven files open (eight if serving
a request), and they would look something like:

        0       -> /dev/null    (STDIN)
        1       -> /dev/null    (STDOUT)
        2       -> error_log    (STDERR)
        3       -> listening socket
        4       -> pipe (for CGI communications)
        5       -> pipe (for CGI communications)
        6       -> error_log
        7       -> access_log

  The real concern are log files, not the number of connections in the
Apache configuration.  The only way the number of connections might be a
consideration is if you are using the threading MPM, where each thread (in a
single process) gets a connection.

> Remember that as you add connectivity to databases that this will
> increase the number of sockets, and therefore open files, used for each
> page served.

  True, but you really need to look at this at the process level.

  -spc

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
   "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to