ab for windows

Windows上安装和使用ab压测

Apachebench是一款压力测试工具,用于测试http服务请求的性能情况

1 下载

http://httpd.apache.org/docs/current/platform/windows.html#down

 

#管理员模式进入CMD

 

C:>d:

 

 D:\>cd apache

 

 D:\apache>cd Apache24

 

 D:\apache\Apache24>cd bin

 

 D:\apache\Apache24\bin>

 

 

#修改配置文件httpd.conf

#39行修改

Define SRVROOT "D:\apache\Apache24"

#67行修改

Listen 8080

 

#在管理员模式下CMD执行

httpd.exe -k install -a "Apache" 安装服务

 

#启动

 

httpd.exe-k start -n "Apache24"

#CMD查看本机地址【本地是无线联网模式】

ipconfig /all

 

 

#加端口8080访问

 

 

#命令集合

 

httpd.exe-k start -n "Apache24"    启动

 

httpd.exe-k stop -n "Apache24"    停止

 

httpd.exe-k restart -n "Apache24"  重启

 

httpd.exe-k uninstall -n "Apache24"  卸载

 

 

 

#ab常用参数的介绍

 

-r  指定接收到错误信息时不退出程序

 

-k  使用HTTP的KeepAlive特性

 

-c  即concurrency,用于指定的并发数。

 

-n  即requests,用于指定压力测试总共的执行次数

 

-t  测试进行总时间,秒级单位

 

-p  POST时的数据文件

 

-w HTML表格输出结果

 

####################################################

 

##安装报错[mpm_winnt:error] [pid 4512:tid 428] (OS 2)系统找不到指定的文件

 

##解决办法

 

Bin目录下

 

 httpd.exe -k install -n Apache2.4

 

 Httpd.exe -k restart

 

#再次访问就可以了

 

posted @ 2024-07-10 11:06  uksmd  阅读(3)  评论(0编辑  收藏  举报