외국 블로그를 보다가 Apache 2.x 버전에서 Prefork와 Worker 방식의 성능 비교를 올려 놓은 포스트가 있어 소개 한다.
블로그 원문은 여기를 클릭하면은 된다. 원문 보고 싶으신 분들은 링크 클릭해서 보세요. ^^ 참고로 불필요한 부분은 제외 했습니다.
솔라리스 10(06/06 U10)에서 Apache 2.2.4를 하나는 prefork MPM으로(-- with-mpm=prefork) 컴파일하고 다른 하나는 worker MPM으로(--with-mpm=worker)로 컴파일을 했다.
Prefork는 일반적으로 Single CPU 또는 Dual CPU에서 성능이 좋고 Worker는 일반적으로 멀티 CPU 시스템에서 성능이 좋다.
각 MPM은 기본 설정을 사용하였다.
Prefork에서 Apache Bench 결과(원문 그대로 사용)
% ./ab -n 10000 -c 10 http://192.168.1.80/index.html
...
Server Software: Apache/2.2.4
Server Hostname: 192.168.1.80
Server Port: 80
Document Path: /index.html
Document Length: 44 bytes
Concurrency Level: 10
Time taken for tests: 478.185521 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 3160000 bytes
HTML transferred: 440000 bytes
Requests per second: 20.91 [#/sec] (mean)
Time per request: 478.185 [ms] (mean)
Time per request: 47.819 [ms] (mean, across all concurrent requests)
Transfer rate: 6.45 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 95.4 0 3380
Processing: 1 472 1178.0 2 10139
Waiting: 0 41 389.2 0 1013
Total: 1 475 1182.0 2 10139
Percentage of the requests served within a certain time (ms)
50% 2
66% 2
75% 3
80% 4
90% 3372
95% 3377
98% 3379
99% 3381
100% 10139 (longest request)
Prefork에서 Siege 결과(원문)
Lifting the server siege... done.
Transactions: 6045 hits
Availability: 100.00 %
Elapsed time: 300.38 secs
Data transferred: 0.25 MB
Response time: 0.50 secs
Transaction rate: 20.12 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 9.97
Successful transactions: 6045
Failed transactions: 0
Longest transaction: 10.13
Shortest transaction: 0.00
Worker 아파치 벤치(원문)
% ./ab -n 10000 -c 10 http://192.168.1.80/index.html
...
Server Software: Apache/2.2.4
Server Hostname: 192.168.1.80
Server Port: 80
Document Path: /index.html
Document Length: 44 bytes
Concurrency Level: 10
Time taken for tests: 244.283673 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 3160000 bytes
HTML transferred: 440000 bytes
Requests per second: 40.94 [#/sec] (mean)
Time per request: 244.284 [ms] (mean)
Time per request: 24.428 [ms] (mean, across all concurrent requests)
Transfer rate: 12.63 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 75.4 0 3378
Processing: 1 239 870.1 1 11898
Waiting: 0 16 229.6 0 3388
Total: 1 241 872.9 1 11898
Percentage of the requests served within a certain time (ms)
50% 1
66% 2
75% 2
80% 2
90% 4
95% 3373
98% 3379
99% 3380
100% 11898 (longest request)
Worker에서 Siege 결과(원문
Lifting the server siege... done.
Transactions: 11024 hits
Availability: 100.00 %
Elapsed time: 300.24 secs
Data transferred: 0.46 MB
Response time: 0.27 secs
Transaction rate: 36.72 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 9.91
Successful transactions: 1102
Failed transactions: 0
Longest transaction: 11.92
Shortest transaction: 0.00
MPM을 Worker로 했을때가 Prefork보다 약 두배정도 빠른 결과가 나왔다.
위의 결과를 봤을때 성능상의 이유로 Apache의 MPM을 Worker로 하는가 Prefork로 하는가 하는 결정을 해야될때 Worker방식으로 설정을 하는 것이 고성능을 얻을 수 있을거 같다.
블로그 원문은 여기를 클릭하면은 된다. 원문 보고 싶으신 분들은 링크 클릭해서 보세요. ^^ 참고로 불필요한 부분은 제외 했습니다.
솔라리스 10(06/06 U10)에서 Apache 2.2.4를 하나는 prefork MPM으로(-- with-mpm=prefork) 컴파일하고 다른 하나는 worker MPM으로(--with-mpm=worker)로 컴파일을 했다.
Prefork는 일반적으로 Single CPU 또는 Dual CPU에서 성능이 좋고 Worker는 일반적으로 멀티 CPU 시스템에서 성능이 좋다.
각 MPM은 기본 설정을 사용하였다.
- Prefork
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule> - Worker
<IfModule mpm_worker_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
- Concurrent = 10
- Time = 5M
- Benchmark = true
Prefork에서 Apache Bench 결과(원문 그대로 사용)
% ./ab -n 10000 -c 10 http://192.168.1.80/index.html
...
Server Software: Apache/2.2.4
Server Hostname: 192.168.1.80
Server Port: 80
Document Path: /index.html
Document Length: 44 bytes
Concurrency Level: 10
Time taken for tests: 478.185521 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 3160000 bytes
HTML transferred: 440000 bytes
Requests per second: 20.91 [#/sec] (mean)
Time per request: 478.185 [ms] (mean)
Time per request: 47.819 [ms] (mean, across all concurrent requests)
Transfer rate: 6.45 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 95.4 0 3380
Processing: 1 472 1178.0 2 10139
Waiting: 0 41 389.2 0 1013
Total: 1 475 1182.0 2 10139
Percentage of the requests served within a certain time (ms)
50% 2
66% 2
75% 3
80% 4
90% 3372
95% 3377
98% 3379
99% 3381
100% 10139 (longest request)
Prefork에서 Siege 결과(원문)
Lifting the server siege... done.
Transactions: 6045 hits
Availability: 100.00 %
Elapsed time: 300.38 secs
Data transferred: 0.25 MB
Response time: 0.50 secs
Transaction rate: 20.12 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 9.97
Successful transactions: 6045
Failed transactions: 0
Longest transaction: 10.13
Shortest transaction: 0.00
Worker 아파치 벤치(원문)
% ./ab -n 10000 -c 10 http://192.168.1.80/index.html
...
Server Software: Apache/2.2.4
Server Hostname: 192.168.1.80
Server Port: 80
Document Path: /index.html
Document Length: 44 bytes
Concurrency Level: 10
Time taken for tests: 244.283673 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 3160000 bytes
HTML transferred: 440000 bytes
Requests per second: 40.94 [#/sec] (mean)
Time per request: 244.284 [ms] (mean)
Time per request: 24.428 [ms] (mean, across all concurrent requests)
Transfer rate: 12.63 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 75.4 0 3378
Processing: 1 239 870.1 1 11898
Waiting: 0 16 229.6 0 3388
Total: 1 241 872.9 1 11898
Percentage of the requests served within a certain time (ms)
50% 1
66% 2
75% 2
80% 2
90% 4
95% 3373
98% 3379
99% 3380
100% 11898 (longest request)
Worker에서 Siege 결과(원문
Lifting the server siege... done.
Transactions: 11024 hits
Availability: 100.00 %
Elapsed time: 300.24 secs
Data transferred: 0.46 MB
Response time: 0.27 secs
Transaction rate: 36.72 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 9.91
Successful transactions: 1102
Failed transactions: 0
Longest transaction: 11.92
Shortest transaction: 0.00
MPM을 Worker로 했을때가 Prefork보다 약 두배정도 빠른 결과가 나왔다.
위의 결과를 봤을때 성능상의 이유로 Apache의 MPM을 Worker로 하는가 Prefork로 하는가 하는 결정을 해야될때 Worker방식으로 설정을 하는 것이 고성능을 얻을 수 있을거 같다.




