Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Web Servers»Apache»Apache Prefork MPM Configuration

    Apache Prefork MPM Configuration

    RahulBy RahulFebruary 26, 20152 Mins Read

    Prefork is the Apache default Multi-Processing Module. When you start working as a System administrator, You generally deal with low traffic servers. You don’t need to know about how Apache handles multiple processes at one time. Even I was don’t know all about it. But after some days when you start working with high load servers and you need to optimize Apache. That time its important to know about Multi-Processing Modules in Apache and how it works

    Apache Prefork Default Configuration

    Below is the default Prefork Multi-Processing module configuration as below for Apache versions.

    For Apache 2.4

    StartServers 3
    MinSpareServers 5
    MaxSpareServers 10
    MaxRequestWorkers 400
    MaxConnectionsPerChild 0
    

    For Apache 2.2

    StartServers 5
    MinSpareServers 5
    MaxSpareServers 10
    MaxClients 150
    MaxRequestsPerChild 0
    

    Prefork Configuration Directives:

    1. StartServers: This directive defined the number of child server processes to create on Apache startup. The number of processes are dynamically increased based on server load, so you don’t need to change this value normally.

    2. MinSpareServers: This is minimum number of idle child processes runs by Apache, which always wait for incoming connection. If minimum idle processes is less than MinSpareServers value, Apache will start a child processes to maintain minimum spare servers.

    3. MaxSpareServers: This is maximum number of processes which can be in idle state. If any time idle processes are more than MaxSpareServers value, Parent process kills the extra idle child processes.

    4. MaxClients and MaxRequestWorkers: This is most important prefork directive. This defined maximum number of requests can be handled by Apache servers. If maximum number of connections or requests exceeds the value, All extra requests need to wait in queue.

    Keep this value as high as your hardware allows you. See below details, to how to set this value.

    a. Find of total number of RAM on your system.
    b. Find out how much RAM is available for Apache server.
    c. The average memory used by a single Apache process.

    Value <= ( Total Memory available for Apache) / ( Memory used by one process )5. MaxRequestsPerChild or MaxConnectionsPerChild: This is the maximum number of requests can be processed by a child process in its life. For example if you set this value to 100. Any new child process will serve up to 100 requests and then it killed by parent process. In that place Apache starts a new child processes.

    We recommend to keep this value higher ( At least greater than 0 ). Setting this parameter 0 means process will never expire, that may create memory leak issue and consume high memory.

    When to change StartServers, MinSpareServers and MinSpareServers Directives Values :

    You never need to change these directive on low traffic servers. If you are handling a server with thousands of requests per minute, Then only you need to change these values. But first you must know about frequency of new processes generation in Apache

      • Apache 2.2 can generate one processes per second.
      • Apache 2.4 can generate up to 32 processes in on second. When minimum idle spare processes are less than MinSpareServers value, Apache start 1 process and wait for one second, If it’s still less, Apache start 2 processes and wait a second, If it’s still less Apache starts 4 processes and wait for a second, similarly Apache can start-up to 32 spare child processes per second and it repeated until minimum spare process exceeded MinSpareServers value.
      • For example if your server is running with Apache 2.2, then Apache can only start one spare processes per second. It means if your server is getting more than 1 connection per second, then You need to adjust all these parameters to always keep running some idle processes. But it also depends of how much time a processes takes to complete.

        Similarly, If server is running with Apache 2.4, Your may need to change these parameters very rarely, because Apache 2.4 can start-up to 32 chiles processes per second.

    Apache httpd MPM Prefork
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install IIS on Windows 8
    Next Article How to flush Postfix Mail Queue

    Related Posts

    How To Install Apache Solr 9.0 on Fedora 36/35

    Updated:May 26, 20223 Mins Read

    How to Install Apache ActiveMQ on Ubuntu 22.04

    3 Mins Read

    How to Install Apache, MySQL, PHP (LAMP Stack) on Ubuntu 22.04

    Updated:June 28, 20225 Mins Read

    How To Disable HTTP Methods in Apache

    Updated:December 31, 20212 Mins Read

    How To Setup Apache, PHP & MongoDB in Ubuntu & Debian

    Updated:October 8, 20213 Mins Read

    Common Apache Commands on Ubuntu & Debian

    4 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • What is CPU? – Definition, Types and Parts
    • What is the /etc/aliases file
    • What is the /etc/nsswitch.conf file in Linux
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.