Linux网络性能测试总结Word格式.docx
《Linux网络性能测试总结Word格式.docx》由会员分享,可在线阅读,更多相关《Linux网络性能测试总结Word格式.docx(12页珍藏版)》请在冰豆网上搜索。
------------------------------------------------------------
ServerlisteningonUDPport5001
Receiving1470bytedatagrams
UDPbuffersize:
208KByte(default)
[3]10.0-12.0sec1.72MBytes7.22Mbits/sec0.022ms55728/137802(40%)
[3]12.0-14.0sec1.79MBytes7.49Mbits/sec0.016ms52637/137735(38%)
[3]14.0-16.0sec1.74MBytes7.30Mbits/sec0.040ms53247/136227(39%)
[3]16.0-18.0sec1.74MBytes7.32Mbits/sec0.071ms54608/137771(40%)
[3]18.0-20.0sec1.79MBytes7.52Mbits/sec0.021ms52133/137632(38%)
[3]20.0-22.0sec1.75MBytes7.32Mbits/sec0.021ms54418/137616(40%)
[3]22.0-24.0sec1.74MBytes7.32Mbits/sec0.020ms54508/137672(40%)
[3]24.0-26.0sec1.79MBytes7.51Mbits/sec0.022ms52519/137838(38%)
[3]26.0-28.0sec1.72MBytes7.20Mbits/sec0.019ms55779/137599(41%)
[3]28.0-30.0sec1.72MBytes7.23Mbits/sec0.016ms55504/137640(40%)
[3]30.0-32.0sec1.77MBytes7.41Mbits/sec0.017ms52849/137002(39%)
[3]32.0-34.0sec1.74MBytes7.31Mbits/sec0.022ms54785/137842(40%)
[3]34.0-36.0sec1.74MBytes7.30Mbits/sec0.019ms54717/137710(40%)
2使用http_load测试HTTPServer吞吐和并发
2.1安装Apache服务器
1、安装并启动
yum-yinstallhttpd
servicehttpdstart
2、在Apache服务端准备好各字节大小的页面
(页面大小:
64、128、256、512、768、1024、1280、1518)
cd/var/www/html/
vi64.html#在这个文件里输入64个英文字符
3、输入如下命令启动服务:
chkconfighttpdon#启动服务
chkconfig--listhttpd#查看确认2--5是启动
etc/rc.d/init.d/httpdstart#开机启动
2.2在客户端安装http_load
1、到下载软件
2、解压并安装
tar-xzvfhttp_load-14aug2014.tar.gz
cdhttp_load-14aug2014
3、修改Linux的TCP配置
编辑vi/etc/sysctl.conf文件,增加:
net.ipv4.tcp_tw_reuse=1(允许将TIME-WAITsockets重新用于新的TCP连接)
net.ipv4.tcp_tw_recycle=1(开启TCP连接中TIME-WAITsockets的快速回收)
4、在当前路径创建各字节大小页面的获取文件,填写服务器URL,以便执行时使用
[root@localhostmy_linux]#caturl.txt
http:
//170.0.0.100/64.html
2.3测试
确保安装好Apache即可。
通过调整/var/www/html/index.html文件内容来
改变get页面的大小。
操作如下命令
http_load-p100-f10000url.txt#100个并发执行10000次
http_load-p100-s3600url.txt#100个并发执行1小时
http_load-r100-f10000url.txt#每秒100个请求,请求10000次
http_load-r100-s3600url.txt#每秒100个请求频率执行1小时
-parallel简写-p:
含义是并发的用户进程数。
-fetches简写-f:
含义是总计的访问次数
-rate简写-r:
含义是每秒的访问频率
-seconds简写-s:
含义是总计的访问时间
【其它参数】
-nrequests全部请求数
-cconcurrency并发数
-ttimelimit最传等待回应时间
-ppostfilePOST数据文件
-Tcontent-typePOSTContent-type
-vverbosityHowmuchtroubleshootinginfotoprint
-wPrintoutresultsinHTMLtables
-iUseHEADinsteadofGET
-xattributesStringtoinsertastableattributes
-yattributesStringtoinsertastrattributes
-zattributesStringtoinsertastdorthattributes
-Cattribute加入cookie,eg.'
Apache=1234.(repeatable)
-Hattribute加入http头,eg.'
Accept-Encoding:
gzip'
Insertedafterallnormalheaderlines.(repeatable)
-Aattributehttp验证,分隔传递用户名及密码
-PattributeAddBasicProxyAuthentication,theattributes
areacolonseparatedusernameandpassword.
-Xproxy:
port代理服务器
-V查看ab版本
-kUseHTTPKeepAlivefeature
-dDonotshowpercentilesservedtable.
-SDonotshowconfidenceestimatorsandwarnings.
-gfilenameOutputcollecteddatatognuplotformatfile.
-efilenameOutputCSVfilewithpercentagesserved
-hDisplayusageinformation(thismessage)
2.4确认结果
[root@Clinet/]#http_load-rate100-fetches50000064
#64是之前已经创建的文件
5000fetches,40maxparallel,30000bytes,in5.00342seconds
#执行了5000个请求,最大并发(新建)进程数40,共传输30000字节,共用5.00342秒
6meanbytes/connection
#每次请求平均传输6字节
999.316fetches/sec,5995.9bytes/sec
#每秒的响应请求数量为999.316,传输速率为5995.9bytes/sec(每秒HTTP吞吐)
msecs/connect:
1.25845mean,24.945max,0.16min
#每连接的平均响应时间是1.25845ms
#最大响应时间24.945ms
#最小响应时间0.16ms
msecs/first-response:
1.28438mean,26.471max,0.289min
HTTPresponsecodes:
code200–5000
#打开响应页面的类型,如果403的类型过多,那可能要注意是否系统遇到了瓶颈。
注:
通过调整服务器端文件大小,可以测试不同字节的HTTP吞吐
3使用ab测试HTTP吞吐
3.1安装Apache服务器
Server和Client端均安装Apache服务器,提供几种大小的页面
[root@localhost~]#ls/var/www/html/
1024.html1280.html128.html1518.html256.html512.html64.html
3.2测试
客户端输入ab-n100-c10http:
//170.0.0.100/64.html命令,获取64字节HTTP页面
并发客户端数量
-n:
总请求数量
查看结果:
[root@localhostmy_linux]#ab-n100-c10http:
ThisisApacheBench,Version2.3<
$Revision:
1430300$>
Copyright1996AdamTwiss,ZeusTechnologyLtd,
LicensedtoTheApacheSoftwareFoundation,http:
//www.apache.org/
Benchmarking170.0.0.100(bepatient).....done
ServerSoftware:
Apache/2.4.6
ServerHostname:
170.0.0.100
ServerPort:
80
DocumentPath:
/64.html
DocumentLength:
64bytes
ConcurrencyLevel:
10//每秒测试并发数
Timetakenfortests:
9.920seconds
Completerequests:
100//成功的请求数
Failedrequests:
0//失败的请求数
Writeerrors:
0
Totaltransferred:
45100bytes
HTMLtransferred:
6400bytes
Requestspersecond:
10.08[#/sec](mean)//每秒事物处理,mean表示平均值
Timeperrequest:
992.027[ms](mean)//平均事物响应时间
99.203[ms](mean,acrossallconcurrentrequests)
Transferrate:
4.44[Kbytes/sec]received//传输为4.44字节每秒
吞吐为4.44*8=35.52Mbit/s
3.3其他参数
-ppostfilePOST数据文件
3使用sendip发原地址跳变的数据包(并发)
3.1安装
1、到http:
//www.earth.li/projectpurple/progs/sendip.html下载软件
tar-xzvfsendip-2.5.tar.gz
cdsendip-2.5
make时会报错,是因为软件与操作系统的变量传参不一致。
下面的附件是网上找到的解决方法,不同的系统可能报错略微不一致,但大体相同,已经验证通过。
原文:
3.2发包命令
发包命令:
sendip-v-dr64-pipv4-iv4-ih5-il128-is223.0.0.18-id223.0.0.17-ptcp-ts12345-td80-tt8223.0.0.17
-v:
运行时输出详细运行信息,如不指定,运行时不输出信息
-dr64:
用64字节的随机数值填充IP包中的数据段
-pipv4:
指定协议类型为IP协议(IP协议有自己的相应参数,以i开头)
-iv4:
协议版本为4,即IPv4
-ih5:
指定IP头的长度为5*4=20字节
-il128:
指定IP包的总长度为128字节
-is223.0.0.18:
指定IP包的源地址
-id223.0.0.17:
指定IP包的目的地址
-ptcp:
指定IP包中封装的包的协议类型(TCP协议有自己的相应参数,以t开头)
-ts123456:
指定TCP包的源端口
-td80:
指定TCP包的目的端口
-tt8:
指定TCP包的偏移量即TCP头的长度,没有TCP选项时为5,即20字节,有TCP
选项时需要增加。
223.0.0.17:
指定发包的目的主机
3.3全部参数
Argumentsformoduleipv4:
-isxSourceIPaddress(seeREADME)
Default:
127.0.0.1
-idxDesitnationIPaddress
Correct
-ihxIPheaderlength(seeREADME)
-ivxIPversion(youalmostdefinatelydon'
twanttochangethis)
Default:
4
-iyxIPtypeofservice
-ilxTotalIPpacketlength(seeREADME)
-iixIPpacketID(seeREADME)
Random
-ifrxIPreservcedflag(seeREADME)
0(optionsare0,1,r)
-ifdxIPdon'
tfragmentflag(seeREADME)
-ifmxIPmorefragmentsflag(seeREADME)
-ifxIPfragmentoffset
-itxIPtimetolive
255
-ipxIPprotcol
0,orsetbyunderlyingprotocol
-icxIPchecksum(seeREADME)
-ionumxIPoptionasstringofhexbytes(lengthisalwayscorrect)
(nooptions)
-ioeolIPoption:
endoflist
-ionopIPoption:
no-op
-iorrxIPoption:
recordroute.Format:
pointer:
addr1:
addr2:
...
-iotsxIPoption:
timestamp.Format:
overflow:
flag:
(ip1:
)ts1:
(ip2:
)ts2:
-iolsrxIPoption:
loosesourceroute.Format:
-iosidxIPoption:
streamidentifier
-iossrxIPoption:
strictsourceroute.Format:
Argumentsformoduleudp:
-usxUDPsourceport
-udxUDPdestinationport
-ulxUDPpacketlegnth
-ucxUDPchecksum
Argumentsformoduletcp:
-tsxTCPsourceport
-tdxTCPdestinationport
-tnxTCPsequencenumber
-taxTCPacknumber
-ttxTCPdataoffset
-trxTCPheaderreservedfieldEXCLUDINGECNandCWRbits
-tfexTCPECNbit(rfc2481)
-tfcxTCPCWRbit(rfc2481)
-tfuxTCPURGbit
0,or1if-tuspecified(optionsare0,1,r)
-tfaxTCPACKbit
0,or1if-taspecified(optionsare0,1,r)
-tfpxTCPPSHbit
-tfrxTCPRSTbit
-tfsxTCPSYNbit
1(optionsare0,1,r)
-tffxTCPFINbit
-twxTCPwindowsize
65535
-tcxTCPchecksum
-tuxTCPurgentpointer
-tonumxTCPoption