分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 软件开发

linux AB web 性能测试工具

发布时间:2023-09-06 02:00责任编辑:沈小雨关键词:暂无标签
ab(选项)(参数)

选项

-A:指定连接服务器的基本的认证凭据;-c:指定一次向服务器发出请求数;-C:添加cookie;-g:将测试结果输出为“gnuolot”文件;-h:显示帮助信息;-H:为请求追加一个额外的头;-i:使用“head”请求方式;-k:激活HTTP中的“keepAlive”特性;-n:指定测试会话使用的请求数;-p:指定包含数据的文件;-q:不显示进度百分比;-T:使用POST数据时,设置内容类型头;-v:设置详细模式等级;-w:以HTML表格方式打印结果;-x:以表格方式输出时,设置表格的属性;-X:使用指定的代理服务器发送请求;-y:以表格方式输出时,设置表格属性。

安装nginx 以及tomcat
192.168.10.145 nginx
192.168.10.135 tomcat

[root@localhost code]# cat /etc/nginx/conf.d/jsp.conf 
server {
server_name local;
listen 80;
location / {
root /soft/code;
try_files $uri @java_page;
index index.jsp index.html;
}
location @java_page{
proxy_pass http://192.168.10.135:8080;
}
}

nginx  的test.html

tomcat 的test.html

nginx 性能测试

Server Software: nginx/1.14.0  ##nginx 版本
Server Hostname: 192.168.10.145  #IP
Server Port: 80   #监听端口

Document Path: /test.html  #请求源
Document Length: 19 bytes  #文档返回的长度,不包括头部

Concurrency Level: 1000  #并发个数
Time taken for tests: 0.311 seconds  #总请求时间
Complete requests: 1000  #请求个数
Failed requests: 0  #请求失败个数
Write errors: 0   
Total transferred: 250000 bytes 
HTML transferred: 19000 bytes
Requests per second: 3216.98 [#/sec] (mean)    ###平均每秒的请求数
Time per request: 310.851 [ms] (mean)    #平均每个请求消耗的时间
Time per request: 0.311 [ms] (mean, across all concurrent requests)  #上面的请求除以并发数
Transfer rate: 785.39 [Kbytes/sec] received   #传输速率

移除nginx当前的test页面, 让nginx通过代理请求到tomcat的test.html

Server Software: nginx/1.14.0
Server Hostname: 192.168.10.145
Server Port: 80

Document Path: /test.html
Document Length: 27 bytes

Concurrency Level: 1000
Time taken for tests: 3.398 seconds
Complete requests: 1000
Failed requests: 118
(Connect: 0, Receive: 0, Length: 118, Exceptions: 0)
Write errors: 0
Non-2xx responses: 118
Total transferred: 275620 bytes
HTML transferred: 46588 bytes
Requests per second: 294.32 [#/sec] (mean)
Time per request: 3397.638 [ms] (mean)
Time per request: 3.398 [ms] (mean, across all concurrent requests)
Transfer rate: 79.22 [Kbytes/sec] received

 这样就可以对比当前nginx所面临的压力,可以针对性的进行调优。

linux AB web 性能测试工具

原文地址:https://www.cnblogs.com/zoulixiang/p/9198488.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved