
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、三种压力测试工具 http在测试站点性能时找到个不错的解释式文章 from: 到 下载http_load ,安装也很容易挺直make;make instlall 就行。 http_load 的标准的两个例子是: http_load -parallel 5 -fetches 1000 ur.txt http_load -rate 2 -seconds 300 urls.txt 例子只是个参考,参数其实可以自由组合,参数之间的挑选并没有什么限制。比如你写成http_load -parallel 5 -seconds 300 urls.txt 也是可以的。我们把参数给大家容易解释一下。 -paral
2、lel 简写 -p : 含义是并发的用户进程数。 -fetches 简写 -f : 含义是总计的拜访次数 -rate 简写 -p : 含义是每秒的拜访频率 -seconds 简写 -s : 含义是总计的拜访时光 urls.txt 是一个url 列表,每个url 单独的一行。固然也可以挺直跟一个url 而不是url 列表文件。 实例: http_load -rate 5 -seconds 10 urls 49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds 5916 mean bytes/connection 4.89274 f
3、etches/sec, 28945.5 bytes/sec msecs/connect: 28.8932 mean, 44.243 max, 24.488 min msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min http response codes: code 200 49 分析: 149 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds 解释在上面的测试中运行了49个哀求,最大的并发进程数是2,总计传输的数据是289884bytes,运行的时光是10.01
4、48秒 25916 mean bytes/connection 解释每一衔接平均传输的数据量289884/49=5916 34.89274 fetches/sec, 28945.5 bytes/sec 解释每秒的响应哀求为4.89274,每秒传递的数据为28945.5 bytes/sec 4msecs/connect: 28.8932 mean, 44.243 max, 24.488 min 解释每衔接的平均响应时光是28.8932 msecs,最大的响应时光44.243 msecs,最小的响应时光24.488 msecs 5msecs/first-response: 63.5362 mean
5、, 81.624 max, 57.803 min 6、http response codes: code 200 49 解释打开响应页面的类型,假如403的类型过多,那可能要注重是否系统碰到了瓶颈。 特别解释:这里,我们普通会关注到的指标是fetches/sec、msecs/connect 他们分离对应的常用性能指标参数qpt-每秒响应用户数和response ,每衔接响应用户时光。测试的结果主要也是看这两个值。固然仅有这两个指标并不能完成对性能的分析,我们还需要对服务器的u、men举行分析,才干得出结论 sample run: % ./http_load -rate 5 -seconds 1
6、0 urls 49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds 5916 mean bytes/connection 4.89274 fetches/sec, 28945.5 bytes/sec msecs/connect: 28.8932 mean, 44.243 max, 24.488 min msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min http response codes: code 200 49 4.89274 fetches/sec 这个
7、值得就是说服务器每秒能够响应的查询次数为4.8左右 这个值得是按照 49 fetches / 10.0148 seconds 秒计算出来的 测试网站每秒所能承受的平均拜访量 http_load -parallel 5 -fetches 1000 urls.txt 这段行是同时用法5个进程,随机拜访urls.txt中的网址列表,总共拜访1000次。运行之后的结果: 1000 fetches, 5 max parallel, 6e+06 bytes, in 58.1026 seconds 6000 mean bytes/connection 17.2109 fetches/sec , 103266
8、 bytes/sec msecs/connect: 0.403263 mean, 68.603 max, 0.194 min msecs/first-response: 284.133 mean, 5410.13 max, 55.735 min http response codes: code 200 1000 从上面的运行结果来看,目标网站仅仅能够承受每秒17次拜访,不够强壮。 测试网站是否能承受住预期的拜访压力 http_load -rate 2 -seconds 300 urls.txt 在300秒内保持一定的频率拜访目标url。 假如你需要测试https,你必需将 make中 con
9、figure: if you want to compile in pport for https, uomment these definitions. you will ne to have already built openssl, available at / make sure the ssl_tree definition points to the ee with your openssl installation depending on how you installed it, it may be in /usr/local in
10、stead of /usr/local/ssl. ssl_tree = /usr ssl_defs = -duse_ssl ssl_inc = -i$(ssl_tree)/include ssl_libs = -l$(ssl_tree)/lib -lssl -lcrypto 因为用法到openssl,你必需安装openssl和相应的开发环境 apt-get install openssl apt-get install libssl-dev -name ssl.h /usr /include/openssl/ssl.h 所以上面红色字体部分必需修改 http_load常见问题 平时用法http
11、_load过程中的一些总结,共享出来,大家可以一起补充; 1.提醒:bytes count wrong 假如_load猎取到的页面数据和上次不全都则会报错byte count wrong 假如是动态页面,此报错可以忽视; 2.报错:too many open files 系统限制的open files太小, -n 修改open files值即可; 3.无法发送大哀求 (哀求长度 600个字符) 默认接受哀求的buf大小 http_load.c 912 ic vo 913 handle_connect( int cnum, struct tim* nowp, int double_check )
12、 914 915 int url_num; 916 char buf600; /按照需要修改,如:char buf4096 917 int bytes, r; 重新编译即可得到可发送大哀求 4.cannot assign requested aress 客户端常见的连服务器,因为每次衔接都在很短的时光内结束,导致无数的time_wait,以至于用光了可用的端口号,所以新的衔接没方法绑定端口,所以要改客户端机器的配置, 在sysctl.conf里加: net.ipv4.tcp_tw_reuse = 1 表示开启重用。允许将time-wait sockets重新用于新的tcp衔接,默认为0,表示关
13、闭; net.ipv4.tcp_timestamps=1 开启对于tcp时光戳的支持,若该项设置为0,则下面一项设置 不起作用 net.ipv4.tcp_tw_recycle=1 表示开启tcp衔接中time-wait sockets的迅速回收 apache ab压力测试 以前安装好apache总是不知道该如何测试apache的性能,现在总算找到一个测试工具了。就是apache自带的测试工具ab(apache benchmark).在apache的bin名目下。 格式: ./ab options http:/hostname:port/path 参数: -n requests number o
14、f requests to perfo /在测试会话中所执行的哀求个数。默认时,仅执行一个哀求 -c concurrency number of multiple requests to make /一次产生的哀求个数。默认是一次一个。 -t timelimit seconds to max. wait for responses /测试所举行的最大秒数。其内部隐含值是-n 50000。它可以使对服务器的测试限制在一个固定的总时光以内。默认时,没有时光限制。 -p postfile file containing data to post /包含了需要post的数据的文件. -t conten
15、t-type content-type header for posting /post数据所用法的content-type头信息。 -v verbosity how much troubleshooting info to print /设置显示信息的具体程度 4或更大值会显示头信息, 3或更大值可以显示响应代码(404, 200等), 2或更大值可以显示警告和其他信息。 -v 显示版本号并退出。 -w print out results in html tables /以html表的格式输出结果。默认时,它是白色背景的两列宽度的一张表。 -i use head instead of get
16、 / 执行head哀求,而不是get。 -x attributes string to insert as table attributes / -y attributes string to insert as tr attributes / -z attributes string to insert as td or th attributes / -c attribute add cookie, eg. apache=1234. (repeatable) /-c cookie-name=value 对哀求附加一个cookie:行。 其典型形式是name=value的一个参数对。此参数可
17、以重复。 -h attribute add arbitrary header line, eg. accept-encoding: g inserted after all normal header lines. (repeatable) -a attribute add basic www authentiion, the attributes are a on separated username and password. -p attribute add basic proxy authentication, the attributes are a colon separated
18、username and password. /-p proxy-auth-username:password 对一个中转代理提供basic认证相信。用户名和密码由一个:隔开,并以base64编码形式发送。无论服务器是否需要(即, 是否发送了401认证需求代码),此字符串都会被发送。 -x proxy:port proxyserver and port number to use -v print version number and it -k use http keepalive feature -d do not show percentiles served table. -s do
19、not show confidence estimators and warnings. -g filename output collected data to gnuplot format file. -e filename output csv file with percentages served -h display usage information (this message) /-attributes 设置 属性的字符串. 缺陷程序中有各种静态声明的固定长度的缓冲区。另外,对指令行参数、服务器的响应头和其他外部输入的解析也很容易,这可能会有不良后果。它没有完整地实现 http
20、/1.x; 仅接受某些预想的响应格式。 strstr(3)的频繁用法可能会带来性能问题,即, 你可能是在测试ab而不是服务器的性能。 参数无数,普通我们用 -c 和 -n 参数就可以了. 例如: ./ab -c 1000 -n 1000 /index. 这个表示同时处理1000个哀求并运行1000次index.php文件. /usr/local/xiaobai/apache2054/bin/ab -c 1000 -n 1000 /index.html.zh-cn.gb2312 this is apachebench, version
21、2.0.41-dev $revision: 2 $ apache-2.0 copyright (c) 1996 adam twiss, zeus technology ltd, copyright (c) 1998-2002 the apache software foundation, / benchmarking (be patient) completed 100 requests completed 200 requests completed 300 requests completed 400 requests completed 500 requests completed 600 requests completed 700 requests completed 800 requests completed 900 requests finished 1
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 叉车转让合同协议书范本
- 菜鸟驿站入股合同协议书
- 合火生意合同协议书
- 影视设备租赁合同协议书
- 新股东入股协议书合同
- 旅游计调合同协议书模板
- 如何写合同和协议书
- 文案策划外包合同协议书
- 早餐培训合同协议书范本
- 简单版转让合同协议书
- 中考语文课内文言文知识点梳理+三年中考真题+模拟题 专题10 《唐雎不辱使命》三年中考+模拟题(原卷版+解析)
- 四川省2023年小升初语文试卷汇总六(含答案)
- 电梯钢丝绳安全检查与更换标准
- 口暴服务流程
- 合伙买大货车协议书
- SOAP病历冠心病介绍
- 中建机电样板专项施工方案
- 小学一年级新生入学手册
- 宠物app创业计划书
- 《大数据财务分析-基于Python》教学大纲
- 中国古典园林-留园调研分析
评论
0/150
提交评论