2010年3月28日星期日

apache web server 實驗

項目需要, 做了一個 apache baseline的實驗, 發現再PC上, 我的測試機器是dell optiplex 755 , apache mpm worker mode 並沒有 pre-fork mode 的效率高,可能是multi-core的優勢沒有顯示出來吧,留一個記錄備查!

[root@LB1 bin]# uname -at
Linux LB1.localdomain 2.6.18-164.el5 #1 SMP Thu Sep 3 04:15:13 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
[root@LB1 bin]#

[root@LB1 bin]# free
total used free shared buffers cached
Mem: 2015392 1099068 916324 0 131880 582036
-/+ buffers/cache: 385152 1630240
Swap: 4063224 0 4063224
[root@LB1 bin]#



[root@LB1 proc]# cat cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Duo CPU E8200 @ 2.66GHz
stepping : 6
cpu MHz : 2000.000
cache size : 6144 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx smx est tm2 cx16 xtpr lahf_lm
bogomips : 5319.97
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 23
model name : Intel(R) Core(TM)2 Duo CPU E8200 @ 2.66GHz
stepping : 6
cpu MHz : 2000.000
cache size : 6144 KB
physical id : 0
siblings : 2
core id : 1
cpu cores : 2
apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx lm constant_tsc pni monitor ds_cpl vmx smx est tm2 cx16 xtpr lahf_lm
bogomips : 5319.98
clflush size : 64
cache_alignment : 64
address sizes : 36 bits physical, 48 bits virtual
power management:





[root@LB1 httpd-2.2.15]# ./configure --with-mpm=prefork --prefix=/usr/local/apache_prefork --with-included-apr --with-expat=builtin

[root@LB1 httpd-2.2.15]# make -j 10

-j [jobs], --jobs[=jobs]
Specifies the number of jobs (commands) to run simultaneously. If
there is more than one -j option, the last one is effective. If
the -j option is given without an argument, make will not limit
the number of jobs that can run simultaneously.


[root@LB1 httpd-2.2.15]# make install




第二组


[root@LB1 httpd-2.2.15]# ./configure --with-mpm=worker --prefix=/usr/local/apache_worker --with-included-apr --with-expat=builtin


[root@LB1 httpd-2.2.15]# make -j 10


[root@LB1 httpd-2.2.15]# make install




分别配置参数


StartServers 5
MinSpareServers 5
MaxSpareServers 75
MaxClients 150
MaxRequestsPerChild 0






StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0

[root@LB1 conf]#



测试第一组: prefork mode

[root@LB1 bin]# ./apachectl start
[root@LB1 bin]# netstat -tln |grep 80
tcp 0 0 :::80 :::* LISTEN
[root@LB1 bin]#



[root@LB1 bin]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 16039
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) 16039
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[root@LB1 bin]# ulimit -n 102400
[root@LB1 bin]#




[root@LB1 bin]# ./ab -n 10000 -c 10 http://172.16.1.222/index.html
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.1.222 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software: Apache/2.2.15
Server Hostname: 172.16.1.222
Server Port: 80

Document Path: /index.html
Document Length: 44 bytes

Concurrency Level: 10
Time taken for tests: 0.737 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2950000 bytes
HTML transferred: 440000 bytes
Requests per second: 13565.19 [#/sec] (mean)
Time per request: 0.737 [ms] (mean)
Time per request: 0.074 [ms] (mean, across all concurrent requests)
Transfer rate: 3907.94 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 0 1 0.1 1 8
Waiting: 0 0 0.1 0 1
Total: 0 1 0.2 1 8

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 1
99% 1
100% 8 (longest request)
[root@LB1 bin]#





第二组 worker

[root@LB1 bin]# ./ab -n 10000 -c 10 http://172.16.1.222/index.html
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 172.16.1.222 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests


Server Software: Apache/2.2.15
Server Hostname: 172.16.1.222
Server Port: 80

Document Path: /index.html
Document Length: 44 bytes

Concurrency Level: 10
Time taken for tests: 0.790 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 2950295 bytes
HTML transferred: 440044 bytes
Requests per second: 12660.63 [#/sec] (mean)
Time per request: 0.790 [ms] (mean)
Time per request: 0.079 [ms] (mean, across all concurrent requests)
Transfer rate: 3647.71 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 0 1 0.5 1 16
Waiting: 0 0 0.4 0 15
Total: 0 1 0.5 1 16

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 2
98% 2
99% 2
100% 16 (longest request)
[root@LB1 bin]#

没有评论:

发表评论