블로그 이미지
redkite

카테고리

분류 전체보기 (291)
00.SI프로젝트 산출물 (0)
00.센터 운영 문서 (0)
01.DBMS ============.. (0)
01.오라클 (117)
01.MS-SQL (15)
01.MySQL (30)
01.PostgreSql (0)
01.DB튜닝 (28)
====================.. (0)
02.SERVER ==========.. (0)
02.서버-공통 (11)
02.서버-Linux (58)
02.서버-Unix (12)
02.서버-Windows (2)
====================.. (0)
03.APPLICATION =====.. (11)
====================.. (0)
04.ETC =============.. (0)
04.보안 (5)
====================.. (0)
05.개인자료 (1)
06.캠핑관련 (0)
07.OA관련 (1)
Total
Today
Yesterday

달력

« » 2024.5
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

공지사항

최근에 올라온 글

요약하자면 worker 방식이 prefork 방식에 비해 평균 2배 가량의 반응시간 단축 효과가 있다고 함

Apache prefork vs. worker

 
Tags:

I compiled 2 different versions of apache 2.2.4 on Solaris 10 (06/06, on a crappy U10, but...) one using the prefork MPM (compile --with-mpm=prefork) and the other using the worker MPM (compile --with-mpm=worker). Prefork is supposed to generally be better for single or dual cpu systems, and worker is supposed to be generally better for multi-CPU systems. The following are the Apache Bench results run against each build on an old Sun Ultra 10 with a single 440mhz CPU and 512m RAM. The server isn't impressive, but it works for bench-testing the MPMs...

I used the default settings for each MPM:

-------------------------------------------------------------
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>
-------------------------------------------------------------

and the siege tests were run with the following settings:

-------------------------------------------------------------
concurrent = 10
time = 5M
benchmark = true
-------------------------------------------------------------


Apache Bench results for prefork:

-------------------------------------------------------------
% ./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   10138
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)
-------------------------------------------------------------

Siege results for prefork:

-------------------------------------------------------------
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
-------------------------------------------------------------

Apache Bench results for 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)
-------------------------------------------------------------

Siege results for worker:

-------------------------------------------------------------
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:       11024
Failed transactions:               0
Longest transaction:           11.92
Shortest transaction:           0.00
-------------------------------------------------------------


So for this setup, the worker MPM was almost twice as fast as the prefork.
I'm going to run these same tests on a multi-cpu server and see what the results look like.


My server(2ghz opteron) ran prefork apache and it was sometimes being
overloaded with 500 concurrent processes. The cpu usage was low which was
puzzling. I tried changing over to worker MPM and its been running great.

Unfortunately, PHP5 does not work with the Worker MPM. On my Ubuntu server, PHP5 can only be installed with the Prefork MPM. Meaning that my server, which has 4 dual-core Opterons, is not being used optimally if I've understood correctly :-(

PHP5 can work with MPM Worker too. But you have to use CGI or FastCGI instead of Apache module. I've written some instructions on how to do it: Install Apache2 MPM Worker and PHP5 using mod_fcgid.

Compile PHP after installing your apache and it will quite happily work with the MPM Worker.

Does fcgi is different from cgi, So if i run cgi script i dont want to specify the path anymore. Is it so?

Nice work, thanks.

Have you finished benchmarks with multire core cpu?

I've been dragged away on other projects and haven't had the chance yet.

I installed apache 2.2 on Sun5.9 with worker mpm. The machine has 2G RAM on it and one 1.2Ghz processor. How many MaxClients do you think I can go with? I specified 500 and it is working okay so far.

-SK

A "typical" apache process uses between 5mg and 8mg of RAM.

I found results for big multicore machine on this page: http://www.thrull.com/corner/webserver/prefork-vs-worker/

If you switch from Ubuntu (a medium grade OS) to this (NetBSD/UnixWorld) which supposed to be (an high-end, enterprise Grade OS),
you fill find that:
- Apache with MPM worker deals great with PHP 5.2.9
- It is the fastest ever server (the kernel has no limits as they built in the linux kernel).

I know :-) as I participated into tests...

(see this article, I am talking about)
http://www.unix-world.org/index.php?page=_news_events&id=6730792567

They use the MySQL Enterprise GPL sourcecode :-)
which is different from MySQL Community !
(un unix-world server)

 

Posted by redkite
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함