Appendix F. Multi-processing modules (MPMs)


Red Hat JBoss Core Services includes a variety of multi-processing modules (MPMs). You can use these MPMs to customize how the Apache HTTP Server responds to incoming requests.

Note

MPMs are mutually exclusive. You may only enable and use one MPM at any specific time.

F.1. MPMs overview

Multi-processing modules (MPMs) are available for both Red Hat Enterprise Linux (RHEL) and Windows Server. On RHEL, the default MPM varies depending on the operating system version.

MPMs for RHEL

prefork

The prefork MPM implements a non-threaded, pre-forking web server. The prefork MPM uses a single control process, which launches child processes that listen for and service incoming connections. A single process handles a specific request, which ensures that each request is isolated and does not affect any other requests.

Note

The prefork MPM is the default MPM on RHEL 7.

worker
The worker MPM implements a hybrid multi-process, multi-threaded server. Each child process creates a fixed number of server threads, which allows the server to handle a large number of requests with fewer system resources.
event

The event MPM is based on the worker MPM. The event MPM allows additional requests to be served simultaneously by delegating some processing work to the listener threads, which frees up the worker threads to serve new requests.

Note

The event MPM is the default MPM on RHEL versions 8 and 9.

MPMs for Microsoft Windows

winnt
The winnt MPM is the only MPM that is available for Windows systems. The winnt MPM uses a single control process, which launches another process that creates threads for incoming requests.

F.2. Switching the MPM

The server selects the MPM based on the LoadModule directives in the 00-mpm.conf file on the Apache HTTP Server host. You can select a specific MPM by removing the comment character (#) from the LoadModule directive for that MPM in the 00-mpm.conf file.

Depending on the Apache HTTP Server distribution that you are using, the location of the 00-mpm.conf file varies:

  • If you are using the JBCS Apache HTTP Server, the 00-mpm.conf file is in the JBCS_HOME/httpd/conf.modules.d directory.
  • If you are using the RHEL Apache HTTP Server, the 00-mpm.conf file is in the /etc/httpd/conf.modules.d directory.

Depending on the operating system version that you are using, consider the following guidelines:

  • On RHEL versions 8 and 9, the event MPM is selected by default. For example:

    # event MPM: A variant of the worker MPM with the goal of consuming
    # threads only for connections with active processing
    # See: http://httpd.apache.org/docs/2.4/mod/event.html
    #
    LoadModule mpm_event_module modules/mod_mpm_event.so

    The event MPM is multi-threaded and designed to provide optimized performance. If you are using RHEL version 8 or 9, switching to another MPM such as prefork might lead to performance issues.

  • On RHEL 7, the prefork MPM is selected by default. For example:

    # prefork MPM: Implements a non-threaded, pre-forking web server
    # See: http://httpd.apache.org/docs/2.4/mod/prefork.html
    LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

    If you are using RHEL 7, consider switching to another MPM such as worker or event to avoid possible performance issues.

Note

For illustrative purposes, the following procedure describes how to switch from the prefork MPM to the worker MPM.

Procedure

  1. Go to the directory that contains the 00-mpm.conf file:

    • If you are using the JBCS Apache HTTP Server, go to the JBCS_HOME/httpd/conf.modules.d directory.
    • If you are using the RHEL Apache HTTP Server, go to the /etc/httpd/conf.modules.d directory.
  2. Edit the 00-mpm.conf to add a comment (#) character to the LoadModule directive for the prefork MPM.

    For example:

    # prefork MPM: Implements a non-threaded, pre-forking web server
    # See: http://httpd.apache.org/docs/2.4/mod/prefork.html
    #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
  3. In the same 00-mpm.conf file, remove the comment (#) character from the LoadModule directive for the MPM that you want to switch to. These lines are located immediately below the prefork MPM.

    For example, to load the worker MPM, remove the comment (#) character from the LoadModule directive for the worker MPM:

    # worker MPM: Multi-Processing Module implementing a hybrid
    # multi-threaded multi-process web server
    # See: http://httpd.apache.org/docs/2.4/mod/worker.html
    LoadModule mpm_worker_module modules/mod_mpm_worker.so

Verification

  • To verify that the MPM is configured correctly, enter the following command:

    $ sbin/apachectl -V

    The preceding command displays the current MPM.

    For example:

    Server MPM:     worker

F.3. MPM performance settings

For each type of MPM, you can configure various settings to optimize the MPM performance.

Types of MPM performance settings

MPM performance settings specify the following types of criteria:

  • Initial number of server processes to create at startup
  • Minimum and maximum number of idle threads or server processes
  • Maximum number of threads or server processes available to handle requests
  • Maximum number of requests an individual server process can handle
  • Number of threads each server process creates (worker and event MPMs only)
  • Upper limit for the maximum number of server processes that can start during the lifetime of the server (prefork MPM only)

Configuration file for MPM performance settings

In JBCS 2.4.51 or later, you can configure MPM performance settings in the mpm.conf file. Depending on the Apache HTTP Server distribution that you are using, the location of the mpm.conf file varies:

  • If you are using the JBCS Apache HTTP Server, the mpm.conf file is in the JBCS_HOME/httpd/conf.d directory.
  • If you are using the RHEL Apache HTTP Server, the mpm.conf file is in the /etc/httpd/conf.d directory.
Important

In JBCS 2.4.37 or earlier releases, the conf.modules.d/00-mpm.conf file contained the MPM performance settings. From JBCS 2.4.57 onward, the conf.d/mpm.conf file contains these settings.

If you are upgrading from JBCS 2.4.37 or earlier, ensure that you configure the conf.d/mpm.conf file for your upgraded 2.4.57 installation to match any customized settings that you previously configured in conf.modules.d/00-mpm.conf. Otherwise, your upgraded JBCS 2.4.57 installation automatically uses the default settings in the conf.d/mpm.conf file, which might lead to unexpected performance issues.

For more information about the available performance settings and associated default values, see the conf.d/mpm.conf file in your Apache HTTP Server installation.

Additional resources

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.