http,https,TCP,UDP,apache 的ab,压测工具

对于http,https使用apache 的ab:

对于http/2使用nghttp2的h2load:

压测http

ab -k -t 180 -c 6 -n 1000000 http://172.16.37.66/index.html

http2.0之压测

h2load -c 6 -T 180 -n 1000000 https://172.16.37.66/index.html

TCP/UDP压测工具 (https://wiki.swoole.com/wiki/page/197.html)

php run.php -c 100 -n 10000 -s tcp://127.0.0.1:9501 -f long_tcp

测试完成后,打印的结果为:

concurrency:    100 //并发数量
request num:    10000 //请求总数
lost num:   0 //失败次数
success num:    10000 //成功次数
total time: 0.157 //总耗时
req per second: 63558 //qps,每秒处理的请求数
one req use(ms):    0.015  //单个请求的平均时长,此结果目前不准确,请勿作为参考

ab测压工具安装:

yum -y install httpd-tools
 
ab -V
 
-n 即requests,用于指定压力测试总共的执行次数。缺省是1;
 
-c 即concurrency,用于指定的并发数。缺省是1;
 
-t:测试所进行的总时间,秒为单位,缺省50000s
 
-k 启用HTTP KeepAlive功能,即在一个HTTP会话中执行多个请求。默认时,不启用KeepAlive功能。
 
-t 即timelimit,等待响应的最大时间(单位:秒),其内部隐含值是-n 50000,它可以使对服务器的测试限制在一个固定的总时间以内。默认时,没有时间限制。
 
-p:POST时的数据文件
 
-w: 以HTML表的格式输出结果
 
执行测试用例:ab -n 1000 -c 100 -w http://localhost/index.php >>d:miss.html
性能测试:
 
swoole、nginx、Golang web 性能比较100 个并发,100万http请求基准测试
swoole、swoole (mysql 线程池)、nginx + fastCGI + php QPS性能比较
#swoole、nginx、Golang  web 性能比较
# nginx helloworld 测试
ab -c 100 -n 1000000 -k http://127.0.0.1:9508/
# golang hello,world 测试
ab -c 100 -n 1000000 -k http://127.0.0.1:8080/
# swoole helloworld 测试
php http-server.php > /dev/null 2>&1
ab -c 100 -n 1000000 -k http://127.0.0.1:9505/
 
#swoole、swoole (mysql 线程池)、nginx + fastCGI + php
 
#swoole 同步mysql
php swoole-mysql.php > /dev/null 2>&1
ab -c 2000 -n 20000 http://192.168.132.128:9502/
 
#swoole mysql 线程池
php swoole-mysql-pool.php > /dev/null 2>&1
ab -c 2000 -n 20000 http://192.168.132.128:9501/
#nginx + fastCGI
ab -c 2000 -n 20000 http://192.168.132.128:9508/pool/sync-mysql.php

同类型的压力测试工具还有: webbench、siege、http_load 等

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值