apache 2.4 mpm모듈 확인 및 event 모듈로 변경

//apache 2.4 mpm모듈 확인 및 event 모듈로 변경

apache 2.4 mpm모듈 확인 및 event 모듈로 변경

apache 2.4 버전부터는 MPM 모듈이 3가지 방식을 지원합니다

기존의 prefork , worker   그리고 apache 2.4 부터 제공된 event 모듈입니다

각 모듈마다 장단점이 있습니다만

대부분 prefork 방식을 이용하며 접속자가 많은 경우 worker 방식을 사용하기도 합니다

[PHP의 경우는 prefork 방식을 사용하도록 권장하고 있습니다]

 

 

아파치 정보 및 mpm모듈 확인

httpd -V

[root@servblog ~]# httpd -V
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 5 2018 01:47:09
Server’s Module Magic Number: 20120211:24
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with….
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT=”/etc/httpd”
-D SUEXEC_BIN=”/usr/sbin/suexec”
-D DEFAULT_PIDLOG=”/run/httpd/httpd.pid”
-D DEFAULT_SCOREBOARD=”logs/apache_runtime_status”
-D DEFAULT_ERRORLOG=”logs/error_log”
-D AP_TYPES_CONFIG_FILE=”conf/mime.types”
-D SERVER_CONFIG_FILE=”conf/httpd.conf”

 

httpd -V | grep MPM

[root@servblog ~]# httpd -V | grep MPM
Server MPM: prefork

 

mpm 모듈 변경

mpm_event 로 변경

vi /etc/httpd/conf.modules.d/00-mpm.conf

vi /etc/httpd/conf.modules.d/00-mpm.conf

 

# Select the MPM module which should be used by uncommenting exactly
# one of the following LoadModule lines:

# 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

# 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

# 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

기존의 mod_mpm_prefork.so 라인을 주석처리하고

#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

mod_mpm_event.so 주석제거

LoadModule mpm_event_module modules/mod_mpm_event.so

 

아파치 재시작

service httpd restart

[root@servblog ~]# httpd -V
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 5 2018 01:47:09
Server’s Module Magic Number: 20120211:24
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: event
threaded: no
forked: yes (variable process count)
Server compiled with….
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT=”/etc/httpd”
-D SUEXEC_BIN=”/usr/sbin/suexec”
-D DEFAULT_PIDLOG=”/run/httpd/httpd.pid”
-D DEFAULT_SCOREBOARD=”logs/apache_runtime_status”
-D DEFAULT_ERRORLOG=”logs/error_log”
-D AP_TYPES_CONFIG_FILE=”conf/mime.types”
-D SERVER_CONFIG_FILE=”conf/httpd.conf”

 

Server MPM: event 로 변경되었습니다

 

About the Author: