Results 1 to 3 of 3
  1. #1

    Number of program instances

    What controls the number of started instances of qmail, httpd, named and other tasks? My http.conf file shows two initial instances but when I check I see 10.

    I though named would probably have an instance for each ip address but there are more instances running than that.

    Also mysql has a lot of instances running.

    I presume that the additional instances will help to serve requests but there must be a tradeoff where too many instances would compete with limited system resources and actually make things slower.

    Does anyone know how to control the number of instances for these programs?


  2. #2
    Join Date
    Jul 2005
    If you've only got ten Apache instances running, don't worry about it.

    Apache (well, Apache 2.0) ships with a series of MPMs, or processing modules. Off of the top of my head, I can think of two - threaded and prefork.

    The threaded MPM puts Apache into a threaded model, where it doesn't rely on the standard "prefork" paradigm used in earlier versions.

    The prefork model is the one that 95% of installations use. In a nutshell, when Apache starts up, it forks off a parent, or a delegation process. That process runs as root and binds to port 80. It then creates a pool of spare worker children to handle actual HTTP requests. When a request comes in to the parent, it passes that HTTP request structure off to one of the available children.

    As load increases, it spawns more children - up until it hits it's MaxClients configuration directive (INCREASING this may help if you have a heavily hit server, but not too high!).

    To avoid fork() overhead, it keeps a series of children in pool... configuration directives:

    StartServers - How many children to start at exec time.
    MinSpareServers - the mininum number or spare servers to keep running
    MaxSpareServers - the maximum number of spare servers to keep running
    ServerLimit - Max Clients for lifetime of the server.
    MaxClients - total number of servers allowed to start.
    MaxRequestsPerChild - number of requests a child can take before it's destroyed and another is spawned in it's place.

    Older Unix's (Solaris) contained memory leaks in their libc implementations, so Apache would restart certain children just as a memory leak precaution .

    Google those configuration directives for a bit more information.

    Personally, I've always bumped 'em way up and set MaxRequestsPerChild to 0 in order to turn off that child-restart feature.

    MySQL creates a series of threads to handle different jobs, don't mess with that.

  3. #3

    I see those config values now and now that I know where to start looking I can read up on them in the documentation.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts