|
公司要求对交易系统做压力测试,在测试中发现,LoadRunner11测得的响应时间总是比实际响应时间慢300毫秒左右,压力测试的结果也是比实际慢这么多
是不是我脚本有什么问题啊,请各位大神帮忙分析一下,参数化选择随机数,实际响应时间是通过服务器日志查看的,服务端日志记录了接收请求的时间点和返回相应的时间点,两个时间差就是响应时间。脚本如下:
#include "lrs.h"
Action()
{
char *recvbuf;
int recvlen=0;
int rc1;
int rc2;
//lr_rendezvous("集合点");
lr_start_transaction("Trans");
lr_start_transaction("Conn");
lrs_set_connect_timeout(30,0);
rc1 = lrs_create_socket("socket1", "TCP", "LocalHost=0", "RemoteHost=10.7.111.229:7701", LrsLastArg); //RemoteHost处填入被测程序所在服务器IP:端口
lr_output_message("%d",rc1);
if(rc1!=0)
{
lr_end_transaction("Conn",LR_FAIL);
lr_end_transaction("Trans",LR_FAIL);
return 0;
}
lr_end_transaction("Conn",LR_PASS);
//lr_rendezvous("集合点");
lrs_send("socket1","buf0",LrsLastArg);
lrs_set_recv_timeout2(10, 0);
lrs_receive("socket1", "buf1", LrsLastArg);
lrs_get_last_received_buffer("socket1",&recvbuf,&recvlen);
switch (recvlen)
{
case 131:
lr_message("交易成功");
lr_end_transaction("Trans",LR_PASS);
break;
case 81:
lr_message("交易批次号错误");
lr_end_transaction("Trans",LR_PASS);
break;
case 97:
lr_message("消费交易第三方系统故障");
lr_end_transaction("Trans",LR_PASS);
break;
case 92:
lr_message("转加密失败,数据未到外联结构");
lr_end_transaction("Trans",LR_FAIL);
break;
default:
lr_message("交易失败");
lr_end_transaction("Trans",LR_FAIL);
break;
}
rc2 = lrs_close_socket("socket1");
if (rc2==0)
lr_output_message("Socket 1 was successfully closed ");
else
lr_output_message("An error occurred while closing the socket, Error Code: %d", rc2);
return 0;
}
data.ws如下:
;WSRData 2 1
send buf0 187
"\x00\xbb\x60\x09\x01\x00\x00\x02\x00"
"\x70\x20\x04\x80\x30\xc0\x98\x15"
"\x16\x62\x00\x10\x00\x61\x21\x52\x35" //2
"\x00\x00\x00" //3
"\x00\x00\x00\x00\x12\x34" //4
"\x<no1><no2>\x<no3><no4>\x<no5><no6>" //11
"\x00\x21" //22
"\x00" //25
"\x37\x62\x00\x10\x00\x61\x21\x52\x35\xd4\x91\x21\x20\x44\x21"
"\x70\x00\x10\x00\x00"
//35
"\x01\x04\x99\x62\x00\x10\x00\x61\x21\x52\x35"
"\xd1\x56\x15\x60\x00\x00\x00\x00\x00\x00\x00\x30\x00\x00\x00\x00"
"\x00\x00\x49\x12\x1d\x00\x00\x00\x00\x00\x00\xd0\x00\x00\x00\x00"
"\x00\x0d\x00\x00\x00\x00\x44\x21\x70\x00\x00"
//36
"\x30\x30\x32\x39\x32\x32\x37\x33" //41
"\x38\x32\x32\x32\x39\x30\x30\x35\x39\x37\x37\x30\x30\x37\x37" //42
"\x31\x35\x36" //49
"\xEB\xFB\x15\x58\x6A\xE3\xE9\xDA" //52
"\x26\x00\x00\x00\x00\x00\x00\x00" //53
"\x00\x08\x30\x31\x30\x30\x30\x30\x35\x30" //60
"\x00\x12\x30\x30\x3<batno4>\x3<batno3>\x3<batno2>\x3<batno1>\x3<no1>\x3<no2>\x3<no3>\x3<no4>\x3<no5>\x3<no6>" //62
"\x31\x44\x33\x35\x45\x43\x41\x44" //64
recv buf1 131
.-1
|
|