ab

本文通过使用ab命令进行并发及大规模请求的负载测试,并展示了如何解析netstat命令的输出来评估服务器的连接状态,同时提供了内存使用情况的检查方法。

 

[root@ok ok]# ab -c 10 -n 100000000 http://www.zhirs.com/index.html
#-c 10 表示并发用户数为10
#-n 100000000 这行表示同时处理100000000个请求并运行10次index.html文件

 

[root@app02 ~]# netstat -an|awk '/tcp/ {++S[$NF]}END{for (a in S)print a,S[a]}'
TIME_WAIT 4058
FIN_WAIT1 2
ESTABLISHED 1
SYN_RECV 2
LISTEN 6
[root@app02 ~]# free -h
             total       used       free     shared    buffers     cached
Mem:          237M       233M       4.1M       268K       5.8M       114M
-/+ buffers/cache:       113M       124M 
Swap:         991M       2.7M       989M 

 

[root@ok 线下人员照片 - 副本]# for i in $(seq 10);do curl http://www.zhirs.com;done
app02 ip:10.100.2.178
app01 ip:10.100.2.177
app01 ip:10.100.2.177
app02 ip:10.100.2.178
app01 ip:10.100.2.177
app01 ip:10.100.2.177
app01 ip:10.100.2.177
app02 ip:10.100.2.178
app02 ip:10.100.2.178
app01 ip:10.100.2.177

 ab命令的包:

yum install httpd-tools
# rpm -ql httpd-tools
/usr/bin/ab
/usr/bin/htdbm
/usr/bin/htdigest
/usr/bin/htpasswd
/usr/bin/httxt2dbm
/usr/bin/logresolve
/usr/share/doc/httpd-tools-2.4.6
/usr/share/doc/httpd-tools-2.4.6/LICENSE
/usr/share/doc/httpd-tools-2.4.6/NOTICE
/usr/share/man/man1/ab.1.gz
/usr/share/man/man1/htdbm.1.gz
/usr/share/man/man1/htdigest.1.gz
/usr/share/man/man1/htpasswd.1.gz
/usr/share/man/man1/httxt2dbm.1.gz
/usr/share/man/man1/logresolve.1.gz

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值