아파치 Worker 컴파일
– 기본적으로 RPM으로 아파치를 설치하게되면 기본설정이 prefork입니다.
prefork 말고 아파치에서 worker방식을 사용하기 위해 아파치 컴파일을 진행하였습니다.
httpd-2.2.17.tar
OS : RHEL5.5 64BIT
/httpd-2.2.17/server/mpm/worker/worker.c
– 아래 부분 수정 #Ifndef DEFAULT_SERVER_LIMIT #define DEFAULT_SERVER_LIMIT 16 -> 128 <= 변경 #endif |
위의 부분만 설정 후 컴파일을 하면 됩니다.
./configure \ –prefix=/usr/local/apache2 \ –enable-so \ –enable-ssl \ –with-mpm=worker \ make |
컴파일후
/usr/local/apache2/bin/apachectl -V를 입력하면 worker 방식으로 동작하는 것을 확인할 수 있습니다.
Server version: Apache/2.2.17 (Unix) Server built: Apr 5 2011 12:21:49 Server’s Module Magic Number: 20051115:25 Server loaded: APR 1.4.2, APR-Util 1.3.10 Compiled using: APR 1.4.2, APR-Util 1.3.10 Architecture: 64-bit Server MPM: Worker threaded: yes (fixed thread count) forked: yes (variable process count) Server compiled with…. -D APACHE_MPM_DIR=”server/mpm/worker” -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=128 -D HTTPD_ROOT=”/usr/apache2″ -D SUEXEC_BIN=”/usr/apache2/bin/suexec” -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” |
Worker 환경설정
/usr/local/apache2/conf/extra/httpd-mpm.conf
# worker MPM # StartServers: initial number of server processes to start # MaxClients: maximum number of simultaneous client connections # MinSpareThreads: minimum number of worker threads which are kept spare # MaxSpareThreads: maximum number of worker threads which are kept spare # ThreadsPerChild: constant number of worker threads in each server process # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule mpm_worker_module> StartServers 2 MaxClients 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25 MaxRequestsPerChild 0 |
상황에 맞게 위의 수치를 변경하여 사용하실 수 있습니다.