亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Table of Contents
Confirm the current MPM
How to switch to Event MPM
If you are installing it with a system package (such as CentOS/RHEL or Ubuntu)
If you are compiling and installing Apache from source code
Configuration optimization suggestions
Home Operation and Maintenance Apache How to switch from Prefork to Event MPM?

How to switch from Prefork to Event MPM?

Jul 27, 2025 am 01:32 AM
switch mpm

It is recommended to switch from Prefork to Event MPM to improve high concurrency performance. If your website has a large number of visits or wants to optimize Apache performance, you should confirm whether the current MPM is Prefork (viewed via httpd -V | grep MPM), and ensure that the Apache version is 2.4 and above. If you use the system package installation, edit the configuration file to enable mpm-event and disable mpm-prefork; if it is a source code installation, specify --enable-mpms-shared=all --with-mpm=event when reconfigure. Note that modules such as mod_php need to be replaced with FastCGI methods such as php-fpm. After switching, you also need to adjust the Event MPM related parameters, such as StartServers, ThreadsPerChild, MaxRequestWorkers, etc. After the setting is completed, use apachectl configtest to verify the configuration and restart the service. The entire process requires attention to module compatibility and configuration details. It is recommended to verify it first in the test environment.

Apache's MPM (Multi-Processing Module) determines how the server handles concurrent requests. Prefork is a relatively traditional model, each request is processed by one process, which is stable but has high resource consumption; Event MPM is more suitable for high concurrency scenarios and can use system resources more efficiently. If your website has increased visits or you want to optimize performance, switching from Prefork to Event MPM is a great option.

Confirm the current MPM

Before you start, confirm whether you are currently using Prefork and whether your Apache supports Event MPM.

You can view it by:

 httpd -V | grep MPM

If the output is similar to Server MPM: prefork , it means that you are indeed running in Prefork mode now.

Also, make sure your Apache version is 2.4 and above, because Event MPM may be incomplete or unavailable in earlier versions.

How to switch to Event MPM

The switching method depends on whether you install Apache through source code or using a system package manager (such as yum or apt).

If you are installing it with a system package (such as CentOS/RHEL or Ubuntu)

  1. Edit Apache's configuration file, usually /etc/sysconfig/httpd (CentOS) or create /etc/apache2/conf-available/mpm-event.conf (Ubuntu)

  2. Find the place where the MPM is set and change the default prefork to event

  3. Disable the Prefork module and enable the Event module:

     a2dismod mpm_prefork
    a2enmod mpm_event
  4. Restart Apache:

     systemctl restart apache2 # Ubuntu
    systemctl restart httpd # CentOS

Note: Some modules (such as mod_php) can only be run under Prefork. If you use these modules, you have to switch to FastCGI methods such as php-fpm to smoothly switch.

If you are compiling and installing Apache from source code

  1. Add parameters when rerunning the configure script:

     ./configure --enable-mpms-shared=all --with-mpm=event
  2. Recompile and install:

     make && make install
  3. Check whether it is effective before starting:

     httpd -V | grep MPM

Configuration optimization suggestions

After switching to Event MPM, some default configurations may not be suitable for the new model and need to be adjusted appropriately.

  • StartServers : You can keep the default value unless you have special requirements.
  • MinSpareThreads / MaxSpareThreads : Controls the number of idle threads, generally does not need to be adjusted too high.
  • ThreadsPerChild : How many threads can each child process handle, usually set to between 25 and 75.
  • MaxRequestWorkers : This value is equal to ThreadsPerChild × the number of child processes, and should be adjusted according to memory and load conditions.

The place where these parameters are modified is usually in the main configuration file of Apache, such as:

  • CentOS/RHEL: /etc/httpd/conf/httpd.conf
  • Ubuntu: /etc/apache2/sites-enabled/000-default.conf or a separate configuration file

For example, you can set it like this:

 <IfModule mpm_event_module>
    StartServers 2
    MinSpareThreads 25
    MaxSpareThreads 75
    ThreadsPerChild 50
    MaxRequestWorkers 250
    MaxConnectionsPerChild 0
</IfModule>

Remember to test whether the configuration is correct after modification:

 apachectl configtest

Restart the service again without any problem.


Basically that's it. The switch itself is not too complicated, but pay attention to module compatibility and configuration details. If you are not sure whether some modules support Event MPM, it is best to check the documentation first or do a test environment to verify it.

The above is the detailed content of How to switch from Prefork to Event MPM?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

PHP Tutorial
1488
72
How to switch between 4g and 5g on Xiaomi Mi 14Ultra? How to switch between 4g and 5g on Xiaomi Mi 14Ultra? Feb 23, 2024 am 11:49 AM

Xiaomi 14Ultra is one of the most popular Xiaomi models this year. Xiaomi 14Ultra not only upgrades the processor and various configurations, but also brings many new functional applications to users. This can be seen from the sales of Xiaomi 14Ultra mobile phones. It is very popular, but there are some commonly used functions that you may not know yet. So how does Xiaomi 14Ultra switch between 4g and 5g? Let me introduce the specific content to you below! How to switch between 4g and 5g on Xiaomi 14Ultra? 1. Open the settings menu of your phone. 2. Find and select the "Network" and "Mobile Network" options in the settings menu. 3. In the mobile network settings, you will see the "Preferred network type" option. 4. Click or select this option and you will see

How to implement dual system switching in Win10 system How to implement dual system switching in Win10 system Jan 03, 2024 pm 05:41 PM

Many friends may not be used to the win system when they first come into contact with it. There are dual systems in the computer. At this time, you can actually switch between the two systems. Let's take a look at the detailed steps for switching between the two systems. How to switch between two systems in win10 system 1. Shortcut key switching 1. Press the "win" + "R" keys to open Run 2. Enter "msconfig" in the run box and click "OK" 3. In the open "System Configuration" In the interface, select the system you need and click "Set as Default". After completion, "Restart" can complete the switch. Method 2. Select switch when booting 1. When you have dual systems, a selection operation interface will appear when booting. You can use the keyboard " Up and down keys to select the system

Operation tutorial for switching from win11 home version to professional version_Operation tutorial for switching from win11 home version to professional version Operation tutorial for switching from win11 home version to professional version_Operation tutorial for switching from win11 home version to professional version Mar 20, 2024 pm 01:58 PM

How to convert Win11 Home Edition to Win11 Professional Edition? In Win11 system, it is divided into Home Edition, Professional Edition, Enterprise Edition, etc., and most Win11 notebooks are pre-installed with Win11 Home Edition system. Today, the editor will show you the steps to switch from win11 home version to professional version! 1. First, right-click on this computer on the win11 desktop and properties. 2. Click Change Product Key or Upgrade Windows. 3. Then click Change Product Key after entering. 4. Enter the activation key: 8G7XN-V7YWC-W8RPC-V73KB-YWRDB and select Next. 5. Then it will prompt success, so you can upgrade win11 home version to win11 professional version.

I cannot use alt+tab to switch interfaces in win11. What is the reason? I cannot use alt+tab to switch interfaces in win11. What is the reason? Jan 02, 2024 am 08:35 AM

Win11 supports users to use the alt+tab shortcut key to bring up the desktop switching tool, but recently a friend encountered the problem that win11 alt+tab cannot switch the interface. I don’t know the reason or how to solve it. Why can't win11 alt+tab switch the interface? Answer: Because the shortcut key function is disabled, here is the solution: 1. First, we press "win+r" on the keyboard to open the run. 2. Then enter "regedit" and press Enter to open the group policy. 3. Then enter "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer"

Switch the dual system boot mode of Apple computer Switch the dual system boot mode of Apple computer Feb 19, 2024 pm 06:50 PM

How to switch between Apple dual systems when starting up Apple computers are powerful devices. In addition to their own macOS operating system, you can also choose to install other operating systems, such as Windows, to achieve dual system switching. So how do we switch between the two systems when booting? This article will introduce to you how to switch between dual systems on Apple computers. First of all, before installing dual systems, we need to confirm whether our Apple computer supports dual system switching. Generally speaking, Apple computers are based on

Understanding full-width and half-width: a look at switching techniques Understanding full-width and half-width: a look at switching techniques Mar 25, 2024 pm 01:36 PM

In daily life, we often encounter the problem of full-width and half-width, but few people may have a deep understanding of their meaning and difference. Full-width and half-width are actually concepts of character encoding methods, and they have special applications in computer input, editing, typesetting, etc. This article will delve into the differences between full-width and half-width, switching techniques, and real-life applications. First of all, the definitions of full-width and half-width in the field of Chinese characters are: a full-width character occupies one character position, and a half-width character occupies half a character position. In a computer, pass

How to switch dual system settings on Huawei mobile phones How to switch dual system settings on Huawei mobile phones Feb 20, 2024 am 10:09 AM

With the rapid development of smartphones, Huawei, as a leading technology company, has launched many popular mobile phone products. Among them, Huawei dual system is a feature that makes many users excited. Through Huawei dual system, users can run two operating systems, such as Android and HarmonyOS, on the same mobile phone at the same time. This feature allows for greater flexibility and convenience. So, how to switch settings between Huawei dual systems? Let’s find out together. First, before switching to dual system setup on your Huawei phone,

Unable to use Alt+Tab to switch interfaces in Win11 Unable to use Alt+Tab to switch interfaces in Win11 Jan 05, 2024 pm 12:21 PM

Sometimes when using shortcut keys to switch computer software screens, you will not be able to switch. This is because the shortcut keys are disabled. However, we can also restore this function. Let’s take a look below. Win11 alt+tab cannot switch interfaces: 1. First, we "win+r" to enter the run. 2. Enter “regedit” in the run interface. 3. Then enter "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer". 4. Double-click to open the "AltTabSettings" settings on the right. 5. If not, create a new AltTabSet

See all articles