长连接和短连接性能测试结果差异Word格式文档下载.docx

上传人:b****1 文档编号:912963 上传时间:2023-04-29 格式:DOCX 页数:12 大小:18.65KB
下载 相关 举报
长连接和短连接性能测试结果差异Word格式文档下载.docx_第1页
第1页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第2页
第2页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第3页
第3页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第4页
第4页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第5页
第5页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第6页
第6页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第7页
第7页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第8页
第8页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第9页
第9页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第10页
第10页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第11页
第11页 / 共12页
长连接和短连接性能测试结果差异Word格式文档下载.docx_第12页
第12页 / 共12页
亲,该文档总共12页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

长连接和短连接性能测试结果差异Word格式文档下载.docx

《长连接和短连接性能测试结果差异Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《长连接和短连接性能测试结果差异Word格式文档下载.docx(12页珍藏版)》请在冰点文库上搜索。

长连接和短连接性能测试结果差异Word格式文档下载.docx

8G

windows

loadrunner

2.2测试脚本简述:

在LR中开发JAVA脚本,直接发送字符串并成功接受返回的字符串。

2.4测试结果对比:

并发线程

连接类型

TPS

响应时间

内存

20

长连接

6766

0.015S

APR

780%

DB:

23%

APP

36%

85%

短连接

7292

0.011S

740%

14%

57%

DB:

83%

2.5测试结果分析:

线程并发数一样,但是长连接的TPS低于短连接的TPS相差大概在6%左右,长连接的应用服务器的APP的资源利用稍微大点,但是短连接的内存消耗明显比长连接的高,高出了大概58%左右。

之所以消耗怎么高是因为,短连接不停的忙着建立连接,不停的建立握手,这样频繁的操作,造成内存资源上的很大消耗。

3■总结

虽然短连接的测试结果TPS以及相应时间是好于长连接的测试结果,但是不符合线上环境。

最重要的一点是,测试人员,做测试脚本以及设计测试场景的时候,一定谨记不要把测试数据发送到服务器端,压力上去后,就不去分析了写的测试脚本以及测试场景是否是满足线上需要的,这样得出的测试结果会给开发人员造成一定的误解。

测试的场景单一,没有去分析线程并发在不同的情况下的,性能结果差异是

多少,如果谁有兴趣可以在分不同的线程并发,多尝试几次,看看性能数据的差异是多少?

4.测试代码附上,4.1长连接代码:

/*

*LoadRunnerJavascript.(Build:

3020)

*

*ScriptDescription:

*/

importlrapi」r;

importjava.io.DataInputStream;

importjava.io.DataOutputStream;

importjava.io.IOException;

importjava.net.Socket;

publicclassActions

{

Socketsocket=null;

DataOutputStreamout;

DataInputStreamin;

publicintinit()throwsThrowable{

13888);

socket=newSocket("

10.20.136.23"

out=newDataOutputStream(socket.getOutputStream());

in=new

DataInputStream(socket.getInputStream());

sendConnect(out,"

10.16.200.119"

"

performance_test"

);

Stringtext=readMessage(in);

System.out.println(text);

return0;

}//endofinit

publicintaction()throwsThrowable{

send_memory(out);

send_jvm(out);

send_gc(out);

send_threading(out);

}//endofaction

publicintend()throwsThrowable{if(socket!

=null){socket.close();

}return0;

}//endofend

publicStringreadMessage(DataInputStreamin)throws

IOException{

shorttype=in.readShort();

if(type!

=1){

thrownewIOException("

not

supporttype"

+type);

}

intlength=in.readInt();

byte[]bytes=newbyte[length];

in.readFully(bytes);

returnnewString(bytes,"

UTF-8"

publicvoidsendConnect(DataOutputStreamout,Stringip,

Stringhostname)throwsIOException{

Stringmessage="

[{/"

T/"

:

/"

Connect/"

/"

S/"

1},{/"

MAC_ADDR/"

[/"

00-26-c6-8f-d8-2c/"

00-50-56-c0-00-08/"

],/"

IP/"

+ip

+

192.168.64.1/"

VERSON/"

2.5/"

SERVICE_TAG/"

wenshao-pc-service-tag/"

HOST_NAME/"

+hostname+"

CLIENT_SESSION/"

[]}]"

;

sendMessage(out,message);

publicvoidsend_memory(DataOutputStreamout)throwsException{

longdate=System.currentTimeMillis();

MonitorItemData/"

39},{/"

D/"

{/"

UsedPhysicalMemorySize/"

1908174848,/"

MemoryNonHeapCommitted/"

41943040,/"

MemoryHeapCommitted/"

122224640,/"

MemoryHeapUsed/"

101766328,/"

TotalPhysicalMemorySize/"

2036363264,/"

UsedSwapSpaceSize/"

2582024192,/"

TotalSwapSpaceSize/"

4072726528,/"

MemoryNonHeapUsed/"

41367072},/"

APP_NUM/"

demo/"

INST_NUM/"

null},/"

TS/"

+date+"

MID/"

548691}]"

publicvoidsend_jvm(DataOutputStreamout)throwsException{longdate=System.currentTimeMillis();

42},{/"

AvailableProcessors/"

2,/"

JavaHome/"

C:

//Program

Files//Java//jdk1.6.0_19//jre/"

JavaVersion/"

1.6.0_19/"

PID/"

3112/"

OSVersion/"

6.1/"

UnloadedClassCount/"

0,/"

TotalCompilationTime/"

6089,/"

OSName/"

Windows7/"

JavaSpecificationVersion/"

1.6/"

Arch/"

amd64/"

LoadedClassCount/"

5006,/"

JVM/"

JavaHotSpot(TM)64-BitServer

VM(16.2-b04,mixedmode)/"

StartTime/"

1288273090499,/"

InputArguments/"

-agentlib:

jdwp=transport=dt_socket,suspend=y,address=localhost:

55785/n-Dcatalina.base=D:

//java//workspace-dragoon-25//.metadata//.plugins//org.eclipse.wst.server.core//tmp0/n-Dcatalina.home=D:

//java//apache-tomcat-6.0.26/n-Dwtp.deploy=D:

//java//workspace-dragoon-25//.metadata//.plugins//org.eclipse.wst.server.core//tmp0//wtpwebapps/n-Djava.endorsed.dirs=D:

//java//apache-tomcat-6.0.26//endorsed/n-Dfile.encoding=UTF-8/"

TotalLoadedClassCount/"

:

JavaLibraryPath/"

Files//Java//jdk1.6.0_19//bin;

.;

//Windows//Sun//Java//bin;

//Windows//system32;

//Windows;

Files//Java//jdk1.6.0_19//jre//bin;

//product//11.1.0//client_1;

//Windows//system32;

//Windows//System32//Wbem;

//Windows//System32//WindowsPowerShell//v1.0//;

//ProgramFiles

(x86)//TortoiseSVN//bin;

D:

//java//apache-maven-2.2.1//bin;

//ProgramFiles(x86)//Subversion//bin;

//ProgramFiles(x86)//SSHCommunicationsSecurity//SSHSecureShell;

//ProgramFiles(x86)//Subversion//bin;

//Python25;

//java//diffutils-2.8.7-1-bin//bin/"

},/"

TS/"

554891}]"

publicvoidsend_gc(DataOutputStreamout)throwsException{longdate=System.currentTimeMillis();

41},{/"

YoungGCCollectionTime/"

107,/"

FullGCCollectionTime/"

141,/"

FullGCCollectionCount/"

11,/"

PermGenUsed/"

39267864,/"

SurvivorSpaceUsed/"

7201080,/"

EdenSpaceUsed/"

85454816,/"

YoungGCCollectionCount/"

10,/"

OldGenUsed/"

11791088},/"

null},/"

552091}]"

publicvoidsend_threading(DataOutputStreamout)throwsException{

43},{/"

RunnableThreadCount/"

15,/"

ProcessCpuTimeRate/"

0.901,/"

NewThreadCount/"

0,/"

TotalStartedThreadCount/"

49,/"

BlockedThreadCount/"

DeadLockedThreadCount/"

FullGCCollectionTimeRate/"

DaemonThreadCount/"

17,/"

WaitingThreadCount/"

TeminatedThreadCount/"

0,/"

ThreadCount/"

48,/"

TimedWaitingThreadCount/"

25},/"

APP_NUM/"

550191}]"

privatevoidsendMessage(DataOutputStreamout,Stringtext)throwsIOException{

byte[]bytes=text.getBytes("

out.writeShort

(1);

out.writeInt(bytes.length);

out.write(bytes);

4.2短连接代码

*LoadRunnerJavascript.(Build:

*ScriptDescription:

importlrapi.lr;

importjava.io.DataInputStream;

importjava.io.IOException;

import.Socket;

test_connect();

publicintend()throwsThrowable{

publicvoidtest_connect()throwsException{

//10.249.168.152:

18001

try{

13888);

DataOutputStreamout=new

DataOutputStream(socket.getOutputStream());

DataInputStreamin=new

"

Stringtext=readMessage(in);

}finally{

if(socket!

=null){

socket.close();

notsupporttype"

byte[]bytes=newbyte[length];

in.readFully(bytes);

Stringmessage=

//ProgramFiles//Java//jdk1.6.0_19//jre/"

JavaHotSpot(TM)64-BitServerVM(16.2-b04,mixedmode)/"

TotalLoadedClassCount

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 总结汇报 > 学习总结

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2