步骤:
1.测试端 Webbench 安装
[root@centos ~] yum install ctags -y
[root@centos ~] cd /usr/local/src
[root@centos ~] wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz
[root@centos ~] tar zxvf webbench-1.5.tar.gz
[root@centos ~] cd webbench-1.5
[root@centos ~] mkdir -p /usr/local/man
[root@centos ~] make && make install
2.服务端运行状态查看,保持运行
[root@centos ~] top
top - 15:34:56 up 1 min, 1 user, load average: 0.29, 0.20, 0.08
Tasks: 116 total, 2 running, 114 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.0 us, 0.3 sy, 0.0 ni, 98.3 id, 1.0 wa, 0.0 hi, 0.0 si, 0.3 st
KiB Mem : 1014984 total, 271264 free, 411612 used, 332108 buff/cache
KiB Swap: 2096124 total, 2096124 free, 0 used. 424336 avail Mem
3.测试端 模拟60秒内100个连接数(速度是每分钟获得1832个页面,每秒读取61618字节数据,共1832个成功请求,0个失败请求)
[root@centos ~] webbench -c 100 -t 60 http://laravel.vicowong.com/
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://laravel.vicowong.com/
100 clients, running 60 sec.
Speed=1832 pages/min, 61618 bytes/sec.
Requests: 1832 susceed, 0 failed.
服务端运行状态
top - 15:36:49 up 3 min, 1 user, load average: 12.50, 4.05, 1.44
Tasks: 131 total, 2 running, 129 sleeping, 0 stopped, 0 zombie
%Cpu(s): 79.0 us, 12.0 sy, 0.0 ni, 8.3 id, 0.0 wa, 0.0 hi, 0.7 si, 0.0 st
KiB Mem : 1014984 total, 86120 free, 552380 used, 376484 buff/cache
KiB Swap: 2096124 total, 2096124 free, 0 used. 267740 avail Mem
4.测试端 模拟60秒内200个连接数(速度是每分钟获得6809个页面,每秒读取90691字节数据,共6809个成功请求,0个失败请求)
[root@centos ~] webbench -c 200 -t 60 http://laravel.vicowong.com/
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://laravel.vicowong.com/
200 clients, running 60 sec.
Speed=6809 pages/min, 90691 bytes/sec.
Requests: 6809 susceed, 0 failed.
服务端运行状态查看
[root@centos ~] top
top - 15:39:53 up 6 min, 1 user, load average: 12.79, 7.18, 3.14
Tasks: 126 total, 5 running, 121 sleeping, 0 stopped, 0 zombie
%Cpu(s): 81.5 us, 14.8 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 3.7 si, 0.0 st
KiB Mem : 1014984 total, 65004 free, 558128 used, 391852 buff/cache
KiB Swap: 2096124 total, 2096124 free, 0 used. 259148 avail Mem
5.测试端 模拟60秒内500个连接数(速度是每分钟获得6696个页面,每秒读取90166字节数据,共6656个成功请求,40个失败请求)
[root@centos ~] webbench -c 500 -t 60 http://laravel.vicowong.com/
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://laravel.vicowong.com/
500 clients, running 60 sec.
Speed=6696 pages/min, 90166 bytes/sec.
Requests: 6656 susceed, 40 failed.
服务端运行状态查看
top - 15:42:10 up 8 min, 1 user, load average: 14.33, 9.19, 4.43
Tasks: 127 total, 5 running, 122 sleeping, 0 stopped, 0 zombie
%Cpu(s): 83.8 us, 14.6 sy, 0.0 ni, 0.0 id, 0.0 wa, 0.0 hi, 1.3 si, 0.3 st
KiB Mem : 1014984 total, 65968 free, 558060 used, 390956 buff/cache
KiB Swap: 2096124 total, 2096124 free, 0 used. 256280 avail Mem
top: 系统运行的时间,user 当前登录用户数,load average系统在之前1min、5min和15min内cpu的平均负载值
Tasks:total 统计周期内进程总数、running运行状态进程数、sleeping休眠状态进程数、stopped停止状态进程数、zombie僵死状态进程数
Cpu(s):us 用户态下进程、sy 系统态下进程占用cpu时间比,ni nice值大于0的进程在用户态下占用cpu时间比,
id cpu处于idle状态、wa wait状态的时间比,hi 处理硬中断、si 软中断的时间比
Mem:total 包括物理内存总量、free 空闲内存、used 已用内存、buff/cache 用作缓冲区的内存量
Swap:total 虚存交换空间总量、free 空闲交换区大小、used 已用交换区大小、avail Mem 用作缓存的交换空间大小
PID: 进程pid
USER: 拉起进程的用户
PR: 该列值加100为进程优先级,若优先级小于100,则该进程为实时(real-time)进程,否则 为普通(normal)进程,实时进程的优先级更高,更容易获得cpu调度,
以上输出结果中,java进程优先级为120,是普通进程,had进程优先级 为2,为实时进程,migration 进程的优先级RT对应于0,为最高优先级
NI: 进程的nice优先级值,该列中,实时进程的nice值为0,普通进程的nice值范围为-20~19
VIRT: 进程所占虚拟内存大小(默认单位kB)
RES: 进程所占物理内存大小(默认单位kB)
SHR: 进程所占共享内存大小(默认单位kB)
S: 进程的运行状态
%CPU: 采样周期内进程所占cpu百分比
%MEM: 采样周期内进程所占内存百分比
TIME+: 进程使用的cpu时间总计
COMMAND: 拉起进程的命令