压力测试工具ab及centos下单独安装方法 nginx和tomcat静态资源的性能测试
2023-09-14 09:00:09 时间
Apache安装包中自带的压力测试工具Apache Benchmark(简称ab)简单易用,这里采用ab作为压国测试工具.
独立安装:
ab运行需要信赖apr-util包:
# yum install apr-util
安装信赖yum-utils中的yumdownload工具如果没有找到yumdownload
# yum install yum-utils
安装完成执行以下指令
[root@localhost opt]# cd /opt/ [root@localhost opt]# mkdir abtmp [root@localhost opt]# cd abtmp/ [root@localhost abtmp]# yum install yum-utils.noarch
[root@localhost abtmp]# yumdownloader httpd-tools* Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.163.com * extras: mirrors.tuna.tsinghua.edu.cn * updates: mirrors.tuna.tsinghua.edu.cn httpd-tools-2.4.6-45.el7.centos.4.x8 | 84 kB 00:00 [root@localhost abtmp]# ls httpd-tools-2.4.6-45.el7.centos.4.x86_64.rpm
安装:
[root@localhost abtmp]# rpm -ihv httpd-tools-2.4.6-45.el7.centos.4.x86_64.rpm Preparing... ################################# [100%] Updating / installing... 1:httpd-tools-2.4.6-45.el7.centos.4 ################################# [100%]
下面对NGINX做测试:
# ab -n 1000 -c100 123.57.36.227/index.html This is ApacheBench, Version 2.3 <$Revision: 1430300 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 123.57.36.227 (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 #处理1000个请求 Server Software: nginx/1.6.2 Server Hostname: 123.57.36.227 Server Port: 80 Document Path: /index.html Document Length: 13 bytes #与Tomcat请求页面的节数大小一致 Concurrency Level: 100 Time taken for tests: 2.539 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 242000 bytes HTML transferred: 13000 bytes Requests per second: 393.82 [#/sec] (mean)#吞吐量:393.82/s Time per request: 253.920 [ms] (mean)#每个请求的平均处理时间 Time per request: 2.539 [ms] (mean, across all concurrent requests) Transfer rate: 93.07 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 2 110 308.8 4 1144 Processing: 2 76 126.9 4 619 Waiting: 2 76 126.9 4 619 Total: 5 186 337.1 9 1624 Percentage of the requests served within a certain time (ms) 50% 9 66% 211 75% 212 80% 213#80%的请求在213ms之内完成 90% 1007 95% 1010 98% 1213 99% 1214 100% 1624 (longest request)#1624ms完成100%的请求
下面对tomcat做测试:
# ab -n 1000 -c100 123.57.36.227:8080/index.jsp This is ApacheBench, Version 2.3 <$Revision: 1430300 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking 123.57.36.227 (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: Apache-Coyote/1.1 Server Hostname: 123.57.36.227 Server Port: 8080 Document Path: /index.jsp Document Length: 13 bytes Concurrency Level: 100 Time taken for tests: 4.101 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 254000 bytes HTML transferred: 13000 bytes Requests per second: 243.84 [#/sec] (mean) Time per request: 410.111 [ms] (mean) Time per request: 4.101 [ms] (mean, across all concurrent requests) Transfer rate: 60.48 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 2 46 201.0 4 1007 Processing: 3 266 610.4 68 3232 Waiting: 3 255 609.2 57 3232 Total: 6 312 628.6 83 3238 Percentage of the requests served within a certain time (ms) 50% 83 66% 149 75% 217 80% 295 90% 1010 95% 1449 98% 3164 99% 3191 100% 3238 (longest request)
对比两数值除理1000个请求tomcat所用的时间是nginx的(3238/1624=1.99)2倍时间!
相关文章
- 在系统下文件上传报错:The temporary upload location [/tmp/tomcat.xxx/work/Tomcat/localhost/ROOT] is not valid
- Linux/CentOS 服务安装/卸载,开机启动chkconfig命令详解|如何让MySQL、Apache开机启动?
- centos双机热备份
- centos添加环境变量
- Centos 7.6搭建Tomcat 环境,发布Java项目
- centos上一键安装jdk、tomcat脚本
- 管理多tomcat服务shell脚本(CentOS)
- CentOS报错:Could not retrieve mirrorlist http://mirrorlist.centos.org
- CentOS完美搭建Redis3.0集群并附测试
- Tomcat详解(二)——tomcat安装与配置
- Tomcat详解(一)——tomcat基础知识
- Linux CentOS安装Python全过程
- CentOS Netcat 用法
- Centos 下安装tomcat多实例
- Centos 下部署tomcat多实例
- eclipse tomcat add时提示The Tomcat server configuration at ServersTomcat v6.0 Server at localhost-
- 锁定文件失败,打不开磁盘“D:biehlcentostaotaotaotao-dubbo-registerCentOS-000001.vmdk”或它所依赖的某个快照磁盘。模块“Disk”启动失败。未能启动虚拟机
- Linux系统之Centos安装epel源
- CentOS在安装配置 Ngnix_tomcat_PHP_Mysql
- KVM虚拟机管理工作二(虚拟机磁盘优化,Centos进入dracut模式,报 /dev/centos/swap does not exist,如何恢复)
- tomcat Context容器(中):Tomcat如何隔离Web应用?
- Tomcat tomcat-users.xml帮你登录Server Status
- Centos 7.5 新磁盘创建和挂载XFS文件系统
- Centos 安装 helm3
- Centos 7 安装 tomcat