lnmp压力测试
硬件环境
CPU
[root@web1 vh]# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 45
model name : Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz
stepping : 7
cpu MHz : 2194.750
cache size : 15360 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush mmx fxsr sse sse2 ht syscall nx lm up rep_good unfair_spinlock pni ssse3 cx16 sse4_1 sse4_2 popcnt aes hypervisor lahf_lm
bogomips : 4389.50
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:
内存
[root@web1 vh]# free -mo
total used free shared buffers cached
Mem: 1877 1234 643 0 156 269
Swap: 0 0 0
软件环境
操作系统
[root@web1 vh]# uname -a
Linux web1 2.6.32-358.6.2.el6.x86_64 #1 SMP Thu May 16 20:59:36 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
数据库
5.6.13-log MySQL Community Server (GPL)
应用程序
nginx version: nginx/1.5.6
php:5.4
php-fpm配置参数
pm = dynamic #使用动态进程pm.max_children = 5 #最大静态进程数为5
pm.start_servers = 2 #动态方式起始进程数为2
pm.min_spare_servers = 1 #动态方式最小进程为1
pm.max_spare_servers = 3 #动态方式最大动态进程为3
使用apache的ab进行测试
测试一
10000个请求每次生成10个
[root@web1 vh]# ab -n 10000 -c 10 http://127.0.0.1/forum.php
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (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: nginx
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /forum.php
Document Length: 12936 bytes
Concurrency Level: 10
Time taken for tests: 490.101 seconds
Complete requests: 10000
Failed requests: 5
(Connect: 0, Receive: 0, Length: 5, Exceptions: 0)
Write errors: 0
Total transferred: 137630005 bytes
HTML transferred: 129360005 bytes
Requests per second: 20.40 [#/sec] (mean)
Time per request: 490.101 [ms] (mean)
Time per request: 49.010 [ms] (mean, across all concurrent requests)
Transfer rate: 274.24 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 11
Processing: 136 490 71.0 464 797
Waiting: 126 477 69.2 452 781
Total: 139 490 71.0 464 797
Percentage of the requests served within a certain time (ms)
50% 464
66% 472
75% 480
80% 489
90% 595
95% 674
98% 731
99% 747
100% 797 (longest request)
cpu使用情况
TCP链接数磁盘IO,基本属于mysql
测试二
[root@web1 vh]# ab -n 10000 -c 1 http://127.0.0.1/forum.php
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (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: nginx
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /forum.php
Document Length: 12937 bytes
Concurrency Level: 1
Time taken for tests: 474.863 seconds
Complete requests: 10000
Failed requests: 9998
(Connect: 0, Receive: 0, Length: 9998, Exceptions: 0)
Write errors: 0
Total transferred: 137630002 bytes
HTML transferred: 129360002 bytes
Requests per second: 21.06 [#/sec] (mean)
Time per request: 47.486 [ms] (mean)
Time per request: 47.486 [ms] (mean, across all concurrent requests)
Transfer rate: 283.04 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 42 47 11.8 44 492
Waiting: 40 46 11.1 43 486
Total: 42 47 11.8 44 493
Percentage of the requests served within a certain time (ms)
50% 44
66% 45
75% 46
80% 46
90% 49
95% 81
98% 88
99% 90
100% 493 (longest request)
测试三
1000个请求,每次发起一个
[root@web1 vh]# ab -n 1000 -c 1 http://127.0.0.1/forum.php
This is ApacheBench, Version 2.3
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests
Server Software: nginx
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /forum.php
Document Length: 12937 bytes
Concurrency Level: 1
Time taken for tests: 45.206 seconds
Complete requests: 1000
Failed requests: 998
(Connect: 0, Receive: 0, Length: 998, Exceptions: 0)
Write errors: 0
Total transferred: 13763002 bytes
HTML transferred: 12936002 bytes
Requests per second: 22.12 [#/sec] (mean)
Time per request: 45.206 [ms] (mean)
Time per request: 45.206 [ms] (mean, across all concurrent requests)
Transfer rate: 297.32 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 0
Processing: 41 45 5.8 44 90
Waiting: 40 44 5.5 42 84
Total: 42 45 5.8 44 90
Percentage of the requests served within a certain time (ms)
50% 44
66% 45
75% 45
80% 45
90% 47
95% 51
98% 70
99% 81
100% 90 (longest request)