使用LogParser和WCAT进行iis压力测试
2013-08-24 20:16
316 查看
原文:http://theether.net/kb/100128
许多文章都在讲如何根据iis log 进行模拟测试,不幸的是这些文章要么不正确、不完整或者有表述错误,就是没有对应当前的产品版本,或者没有处理windows 验证,下面的流程已经成功应用于产生重复的负载测试
一下案例使用了log parser2.2和WCAT 6.3
方案:
1) 安装Log Parser 2.2
http://theether.net/download/Microsoft/IIS/LogParser.msi
将下面的的模板文件和sql命令copy到 %ProgramFiles%\Log Parser 2.2 目录下:
http://theether.net/download/Microsoft/IIS/wcat.sql
http://theether.net/download/Microsoft/IIS/wcat.tpl
http://theether.net/download/Microsoft/IIS/wcat.NTLM.tpl
copy iis log文件到 %ProgramFiles%\Log Parser 2.2 目录下.
2) 生成 WCAT 脚本
2a) IIS中使用了匿名验证 Using Anonymous Authentication on IIS
在命令行中执行如下命令:
(missing -i:IISW3C parameter courtesy Scott Stafford)
2b) IIS中使用windows 验证的
编辑wcat.NTLM.tpl并更新domain,user和password
Edit wcat.NTLM.tpl and update DOMAIN, user and password.
命令行中执行:
3) 在测试机上安装 WCAT
在控制机上安装WCAT
http://theether.net/download/Microsoft/IIS/wcat.x86.msi
http://theether.net/download/Microsoft/IIS/wcat.amd64.msi
拷贝 "%ProgramFiles%\Log Parser 2.2\CurrentLog.ubr" 脚本文件到 %ProgramFiles%\wcat 目录下.
在客户机上安装WCAT:
命令上执行
注意:这个命令会把wcclient安装在控制机和Test1这台客户机上,并会立即重启所有的客户端
Note: This will install the WCAT client (wcclient.exe) on the controller and the Test1 host. This will reboot all clients immediately.
4) 启动WCAT控制器
命令行中执行:
注释:-c 参数定义了控制器要等待几个客户机连接
Note: The -c parameter specifies the number of clients to wait for.
5) 启动客户端
在控制机上启动客户端:
在客户机上启动客户端:
6) 查看测试结果
控制机上执行如下cmd命令:
许多文章都在讲如何根据iis log 进行模拟测试,不幸的是这些文章要么不正确、不完整或者有表述错误,就是没有对应当前的产品版本,或者没有处理windows 验证,下面的流程已经成功应用于产生重复的负载测试
一下案例使用了log parser2.2和WCAT 6.3
方案:
1) 安装Log Parser 2.2
http://theether.net/download/Microsoft/IIS/LogParser.msi
将下面的的模板文件和sql命令copy到 %ProgramFiles%\Log Parser 2.2 目录下:
http://theether.net/download/Microsoft/IIS/wcat.sql
SELECT OUT_ROW_NUMBER() as ID, STRCAT(cs-uri-stem, REPLACE_IF_NOT_NULL(cs-uri-query,STRCAT('?', realQueryString))) AS URI, count(*) AS WEIGHT, case sc-status when 304 then 200 when 206 then 200 else sc-status end as STATUSCODE using extract_token(cs-uri-query,0,'|') as realQueryString INTO %outfile% FROM %logfile% WHERE cs-method = 'GET' and STATUSCODE = 200 GROUP BY URI, STATUSCODE ORDER BY WEIGHT DESC
http://theether.net/download/Microsoft/IIS/wcat.tpl
<LPHEADER> scenario { name = "Generated Using Log Parser"; warmup = 30; duration = 120; cooldown = 10; default { setheader { name = "Host"; value = "intranet"; } setheader { name = "Connection"; value = "keep-alive"; } setheader { name = "User-Agent"; value = " Mozilla/4.0 (compatible; MSE 6.0; Windows NT 5.1; SV1)"; } version = HTTP11; close = ka; } </LPHEADER> <LPBody> transaction { id = "URL %ID%"; weight = %WEIGHT%; request { url = "%URI%"; statuscode = %STATUSCODE%; } } </LPBODY> <LPFOOTER> } </LPFOOTER>
http://theether.net/download/Microsoft/IIS/wcat.NTLM.tpl
<LPHEADER> scenario { name = "Generated Using Log Parser"; warmup = 30; duration = 120; cooldown = 10; default { setheader { name = "Host"; value = "intranet"; } setheader { name = "Connection"; value = "keep-alive"; } setheader { name = "User-Agent"; value = " Mozilla/4.0 (compatible; MSE 6.0; Windows NT 5.1; SV1)"; } version = HTTP11; close = ka; } </LPHEADER> <LPBody> transaction { id = "URL %ID%"; weight = %WEIGHT%; request { url = "%URI%"; statuscode = 401; } request { url = "%URI%"; authentication = NTLM; username = "DOMAIN\\user"; password = "password"; statuscode = %STATUSCODE%; } } </LPBODY> <LPFOOTER> } </LPFOOTER>
copy iis log文件到 %ProgramFiles%\Log Parser 2.2 目录下.
2) 生成 WCAT 脚本
2a) IIS中使用了匿名验证 Using Anonymous Authentication on IIS
在命令行中执行如下命令:
CD "\Program Files\Log Parser 2.2" Logparser file:WCat.sql?logfile=*.log+outfile=CurrentLog.ubr -i:IISW3C -o:tpl -tpl:WCat.tpl
(missing -i:IISW3C parameter courtesy Scott Stafford)
2b) IIS中使用windows 验证的
编辑wcat.NTLM.tpl并更新domain,user和password
Edit wcat.NTLM.tpl and update DOMAIN, user and password.
命令行中执行:
CD "\Program Files\Log Parser 2.2" Logparser file:WCat.sql?logfile=*.log+outfile=CurrentLog.ubr -i:IISW3C -o:tpl -tpl:WCat.NTLM.tpl
3) 在测试机上安装 WCAT
在控制机上安装WCAT
http://theether.net/download/Microsoft/IIS/wcat.x86.msi
http://theether.net/download/Microsoft/IIS/wcat.amd64.msi
拷贝 "%ProgramFiles%\Log Parser 2.2\CurrentLog.ubr" 脚本文件到 %ProgramFiles%\wcat 目录下.
在客户机上安装WCAT:
命令上执行
CD "\Program Files\wcat" cscript wcat.wsf -update -clients localhost Test1
注意:这个命令会把wcclient安装在控制机和Test1这台客户机上,并会立即重启所有的客户端
Note: This will install the WCAT client (wcclient.exe) on the controller and the Test1 host. This will reboot all clients immediately.
4) 启动WCAT控制器
命令行中执行:
CD "\Program Files\wcat" start wcctl.exe -t currentlog.ubr -s webserver.domain.com -c 2 -v 500
注释:-c 参数定义了控制器要等待几个客户机连接
Note: The -c parameter specifies the number of clients to wait for.
5) 启动客户端
在控制机上启动客户端:
CD "\Program Files\wcat" start wcclient.exe localhost
在客户机上启动客户端:
CD "%windir%\wcat" start wcclient.exe controller.domain.com
6) 查看测试结果
控制机上执行如下cmd命令:
iexplore %ProgramFiles%\wcat\log.xml
相关文章推荐
- wcat 进行iis 压力测试
- 用WCAT进行IIS压力测试
- 使用免费工具WCAT为Web应用程序进行压力测试
- 用WCAT进行IIS压力测试(转)
- 用WCAT进行IIS压力测试(转)
- 如何理解、使用Android LogCat以及通过Monkey进行压力测试
- MonkeyRunner_使用MonkeyRunner对Calculator进行简单的压力测试(脚本示例)
- 使用ab进行页面的压力测试
- 使用ab进行页面的压力测试
- 使用Microsoft Web Application Stress Tool对web进行压力测试
- JAVA使用Microsoft Web Application Stress Tool对web进行压力测试
- tomcat使用ab.exe进行压力测试
- 使用Microsoft Web Application Stress Tool对web进行压力测试
- 使用Apache的ab工具进行压力测试
- 使用TestNG进行模块自动化压力测试
- 使用SIPP来进行SIP压力测试(一)
- apache使用ab进行页面的压力测试,并发测试,性能测试,中文注释
- 使用Jmeter进行基本压力测试
- 使用Microsoft Web Application Stress Tool对web进行压力测试
- 使用ab进行页面的压力测试