Apache MaxRequestWorkers 계산기

서버 RAM, MySQL·PHP-FPM·OS 예약 메모리, 실측 Apache 프로세스 크기로 prefork·worker·event별 MaxRequestWorkers와 ServerLimit을 계산하고 설정 블록을 바로 복사하세요.

Server & MPM

Apache MPM

Check yours with: apachectl -V | grep MPM (httpd -V on RHEL).

Reserved for other services (MB)

MySQL은 InnoDB 버퍼 풀 계산기로, PHP-FPM은 pm.max_children 계산기로 구하세요. mod_php를 쓰면 PHP-FPM은 0으로 두세요 (PHP가 Apache 프로세스 안에서 실행됨).

Kept free for spikes and memory growth. 10% is typical; max 90% (higher values are reset to 90).

ps -o rss= -C apache2 | awk '{ s+=$1; n++ } END { printf "%d processes, avg %.0f MB\n", n, s/n/1024 }'

RHEL/Alma/Rocky: replace apache2 with httpd. Run it under real traffic; ps -ylC apache2 --sort:rss lists each process if you want the largest one.

Recommended limits

57 MaxRequestWorkers

ServerLimit57
StartServers

Formula

Memory breakdown at peak

Apache peak
MySQL / MariaDB
OS + PHP-FPM + other
Total vs RAM
Left free

Leave empty to chart the recommended value. Enter the number from your config to see whether it fits in RAM.

MPM config



Reverse: RAM needed for a target number of concurrent requests

Uses the same MPM, reservations, headroom and process size as above.

More server tools

All VPS & Server tools

사용 방법

1. MPM 고르기

apachectl -V | grep MPM (또는 httpd -V)으로 Apache가 prefork, worker, event 중 무엇을 쓰는지 확인하세요. mod_php 환경은 보통 prefork이고, PHP-FPM을 쓰는 최신 Debian·Ubuntu·RHEL은 event가 기본입니다.

2. RAM과 예약 메모리 입력

총 RAM을 넣고 OS, MySQL/MariaDB, PHP-FPM 등 다른 서비스가 쓰는 메모리를 입력하세요. free -m, htop으로 실제 사용량을 확인하면 Apache에 정말 남는 메모리만 배정할 수 있습니다.

3. Apache 프로세스 크기 측정

ps 한 줄 명령을 복사해 평소 트래픽이 있을 때 실행하세요. prefork + mod_php 프로세스는 보통 30–100MB지만 모듈과 PHP 코드에 따라 크게 달라지므로 추측하지 말고 직접 측정하세요.

4. 설정 복사 후 로그 확인

IfModule 블록을 MPM 설정 파일에 붙여넣고 apachectl configtest로 확인한 뒤 Apache를 재시작하세요. 에러 로그에 "server reached MaxRequestWorkers"가 보이면 역계산기로 더 높은 값에 필요한 RAM을 확인하세요.

자주 묻는 질문

총 RAM에서 OS, MySQL·MariaDB, PHP-FPM 등 다른 서비스가 쓰는 메모리를 빼고, 10% 정도 여유를 남긴 뒤 Apache 프로세스 1개 크기로 나누고 내림합니다. 예: 4GB, prefork, OS 512MB, MySQL 1GB, 프로세스 40MB → floor((4096 − 1536) × 0.9 ÷ 40) = 57. worker·event는 프로세스 수에 ThreadsPerChild를 곱합니다.
MaxRequestWorkers는 Apache가 동시에 처리하는 요청 수이고, ServerLimit은 자식 프로세스 수의 상한입니다. prefork는 프로세스 하나가 요청 하나를 처리하므로 ServerLimit이 MaxRequestWorkers 이상이어야 하고, 기본값 256을 넘기려면 ServerLimit도 올려야 합니다. worker·event는 ServerLimit이 MaxRequestWorkers ÷ ThreadsPerChild(올림) 이상이어야 합니다.
스레드 방식인 worker·event MPM은 ThreadsPerChild개 스레드를 가진 자식 프로세스를 통째로 띄웁니다. Apache 2.4 문서는 MaxRequestWorkers를 ThreadsPerChild의 정수배로 두라고 하며, 아니면 내림하고 경고를 남깁니다. 기본값은 프로세스 16개 × 스레드 25개 = 400입니다.
프로세스 크기 입력란 아래의 ps + awk 한 줄 명령을 평소 트래픽이 있을 때 실행하세요. 모든 apache2 프로세스의 상주 메모리(RSS) 평균을 MB로 보여줍니다. RHEL·CentOS·AlmaLinux·Rocky Linux는 프로세스 이름이 httpd입니다. 더 안전하게 잡으려면 ps -ylC apache2 --sort:rss로 목록을 보고 가장 큰 값을 쓰세요.
너무 크면: 트래픽이 몰릴 때 RAM에 다 들어가지 않을 만큼 프로세스가 늘어 스왑이 생기고, 리눅스 OOM killer가 MySQL을 종료시킬 수 있습니다. 너무 작으면: 에러 로그에 "server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting"이 찍히고 새 연결이 대기열에서 기다려 페이지가 느려집니다. 계산값을 출발점으로 삼고 메모리와 에러 로그를 보며 조정하세요.
Sponsor
Get started on Vultr
Get $300 free credit — valid for 30 days (limited-time offer)
Claim your credit →