原文: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/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
在命令行中执行如下命令:
(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命令:
本文提供了使用LogParser2.2和WCAT6.3进行负载测试的完整指南,包括安装软件、处理不同验证类型、生成测试脚本、设置测试机与控制机以及查看测试结果的方法。

643

被折叠的 条评论
为什么被折叠?



