网站性能测试:页面测试工具 + Web服务器压力测试工具

【网站页面速度测试工具(网页性能优化)】

该系列工具主要用于测试网页加载速度,以了解页面速度瓶颈,方便对页面进行优化。

推荐的测试工具

Mozilla Firefox + Firebug + Yahoo! YSlow

YSlow: http://developer.yahoo.com/yslow/

返回测试结果并根据YSlow rules建议优化策略。另:YSlow包含的图片无损减肥工具smushit:http://developer.yahoo.com/yslow/smushit/非常有用。

Mozilla Firefox + Firebug + Google Page Speed

http://code.google.com/speed/page-speed/

Google Chrome + Google Speed Tracer

http://code.google.com/webtoolkit/speedtracer/

Mozilla Firefox + Firebug + Hammerhead

http://stevesouders.com/hammerhead/

其他在线测试工具(有些支持从不同地理位置测试):

Pingdom WebPagetest Gomez Instant Test Pro Resource Expert Droid Web Caching Tests Port80 Compression Check A simple online web page compression / deflate / gzip test tool Web Page Analyzer

【网站服务器性能压力测试工具(stress/performance testing for web server)】

该系列工具主要用于测试Web服务器的负载能力,以了解当前Web服务器在高并发高负载情况下的响应状况和速度,方便对Web服务器进行优化和重构。

测试指标

指定并发用户数(how many clients)(有些还包括requests/client),并运行指定时间长度,获得测试结果:

requests/second : 每秒钟所能处理的请求数; milliseconds/request : 平均每个请求需要的时间; bytes/second :每秒钟处理的字节数;

常用的压力测试工具

ApacheBench(ab)

和Apache HTTP Server一起安装的(例如Ubuntu下安装成功位于/usr/bin/ab),使用参考:http://httpd.apache.org/docs/2.2/programs/ab.html,可以用来测试任何web server。

使用实例:

ab -c 100 -n 2 -t 10 http://54min.com/index.php (-c 并发数;-n 每个client的请求次数;-t 运行时间;)

更多参数可以参考如上介绍,ab功能较为强大。

webbench

http://freshmeat.net/projects/web-bench/;使用可以参考:http://blog.s135.com/post/288/

例如:webbench -c 500 -t 10 http://54min.com/index.php (-c表示并发数,-t表示时间(秒)),测试结果:

    Webbench – Simple Web Benchmark 1.5

    Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

    Benchmarking: GET http://54min.com/index.php

    500 clients, running 10 sec.

    Speed=84 pages/min, 348 bytes/sec.

    Requests: 14 susceed, 0 failed.

更多的压力测试工具

详见:http://en.wikipedia.org/wiki/Web_server_benchmarking

脚本使用简介: /******************************************************************************** void tcc_tell_user(long len,const char *fmt,...) void tcc_init_stochastic() int tcc_produce_stochastic(int a,int b) tcc_sscanf tcc_sprintf tcc_strcpy tcc_strcmp tcc_strstr tcc_strcat tcc_memcpy tcc_memcmp tcc_memset tcc_strlen tcc_malloc tcc_free *********************************************************************************/ void get_hex_string(unsigned char *in_dat,int in_len,char *ou_hex) { int i; char *t=(char*)tcc_malloc(8); ou_hex[0]=0; for(i=0;i<in_len;i++) { if(i%0x04==0 && i!=0) tcc_strcat(ou_hex," "); if(i%0x10==0 && i!=0) tcc_strcat(ou_hex,"\n"); tcc_sprintf(t,"X ",in_dat[i]); tcc_strcat(ou_hex,t); } tcc_free(t); } void msg_init() { // tcc_init_stochastic(); } void *msg_short_connect_form_data(long t,long s,long c,long *len) { char *data=(char*)tcc_malloc(128); *len=128; *(long*)(data+0x00)=128; *(long*)(data+0x04)=1; *(long*)(data+0x08)=0; *(long*)(data+0x0C)=0; int n=tcc_produce_stochastic(100,50000); tcc_sprintf(data+0x10,"hello%d",n); tcc_strcpy(data+0x20,"123456"); return data; } int msg_short_connect_recv_data(long s,long c,void *dat,long len) { unsigned char *ou_dat=(unsigned char*)tcc_malloc(5120); get_hex_string(dat,len,ou_dat); tcc_tell_user(5120,"s:%d c:%d len:%d\n%s\n\n",s,c,len,ou_dat); tcc_free(ou_dat); return 1; } void *msg_long_connect_form_data(long op,long s,long c,long *len) { char *data=(char*)tcc_malloc(128); *len=128; *(long*)(data+0x00)=128; *(long*)(data+0x04)=1; *(long*)(data+0x08)=0; *(long*)(data+0x0C)=0; int n=tcc_produce_stochastic(100,50000); tcc_sprintf(data+0x10,"hello%d",n); tcc_strcpy(data+0x20,"123456"); return data; } int msg_long_connect_recv_data(long s,long c,void *dat,long len) { unsigned char *ou_dat=(unsigned char*)tcc_malloc(5120); get_hex_string(dat,len,ou_dat); tcc_tell_user(5120,"s:%d c:%d len:%d\n%s\n\n",s,c,len,ou_dat); tcc_free(ou_dat); return 1; } void msg_free_data(void *arg) { tcc_free(arg); }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值