Pages: 12/21 First page Previous page 7 8 9 10 11 12 13 14 15 16 Next page Final page [ View by Articles | List ]

用httping测试web页面响应时间

[不指定 2008/06/27 11:23 | by askwan ]
性能测试是软件测试中很重要的工程工程,有时候我们需要测试的一项内容便是web页面响应时间,httping就是
这样一种专门用来测试web页面响应时间的开源软件。

在freebsd下安装
Quotation
#cd /usr/ports/net/httping
#make install clean
#rehash


用法如下
Quotation
#httping -h



httping: option requires an argument -- h
HTTPing v1.2.6, (C) 2003-2008 folkert@vanheusden.com
SSL support included

-g url          url (e.g. -g http://localhost/)
-h hostname     hostname (e.g. localhost)
-p portnr       portnumber (e.g. 80)
-x host:port    hostname+portnumber of proxyserver
-c count        how many times to connect
-i interval     delay between each connect
-t timeout      timeout (default: 30s)
-s              show statuscodes
-S             split time in connect-time and processing time
-G              do a GET request instead of HEAD (read the
                contents of the page as well)
-b              show transfer speed in KB/s (use with -G)
-B              like -b but use compression if available
-L x            limit the amount of data transferred (for -b)
                to 'x' (in bytes)
-X              show the number of KB transferred (for -b)
-l              connect using SSL
-z              show fingerprint (SSL)
-f              flood connect (no delays)
-a              audible ping
-m              give machine parseable output (see
                also -o and -e)
-o rc,rc,...    what http results codes indicate 'ok'
                coma seperated WITHOUT spaces inbetween
                default is 200, use with -e
-e str          string to display when http result code
                doesn't match
-I str          use 'str' for the UserAgent header
-R str          use 'str' for the Referer header
-r              resolve hostname only once (usefull when
                pinging roundrobin DNS: also takes the first
                DNS lookup out of the loop so that the first
                measurement is also correct)
-n warn,crit    Nagios-mode: return 1 when avg. response time
                >= warn, 2 if >= crit, otherwhise return 0
-N x            Nagios mode 2: return 0 when all fine, 'x'
                when anything failes
-y ip[:port]   bind to ip-address (and thus interface) [/port]
-q              quiet, only returncode
-V              show the version


每一个选项都有注释 比较好懂

下面就用他来测试本地到sina的页面响应时间吧
由于网络延时 堵塞等原因 可能出现不稳定的结果
测试10次取平均值

Quotation
#httping -c10 -g http://www.sina.com.cn


PING www.sina.com.cn:80 (http://www.sina.com.cn):
connected to www.sina.com.cn:80, seq=0 time=8.76 ms
connected to www.sina.com.cn:80, seq=1 time=4.81 ms
connected to www.sina.com.cn:80, seq=2 time=5005.72 ms
connected to www.sina.com.cn:80, seq=3 time=6204.22 ms
connected to www.sina.com.cn:80, seq=4 time=5.45 ms
connected to www.sina.com.cn:80, seq=5 time=5.63 ms
connected to www.sina.com.cn:80, seq=6 time=7.44 ms
connected to www.sina.com.cn:80, seq=7 time=5006.06 ms
connected to www.sina.com.cn:80, seq=8 time=5.16 ms
connected to www.sina.com.cn:80, seq=9 time=5.01 ms
--- http://www.sina.com.cn ping statistics ---
10 connects, 10 ok, 0.00% failed
round-trip min/avg/max = 4.8/1625.8/6204.2 ms

平均值为1625.8ms,也就是1.63s

如果是测试本网段的某个主机,则测试结果就比较可以信任了
Quotation
#httping -c10 -g http://www.askwan.com


PING www.askwan.com:80 (http://www.askwan.com):
connected to www.askwan.com:80, seq=0 time=17.11 ms
connected to www.askwan.com:80, seq=1 time=23.52 ms
connected to www.askwan.com:80, seq=2 time=18.72 ms
connected to www.askwan.com:80, seq=3 time=19.37 ms
connected to www.askwan.com:80, seq=4 time=107.02 ms
connected to www.askwan.com:80, seq=5 time=19.70 ms
connected to www.askwan.com:80, seq=6 time=31.35 ms
connected to www.askwan.com:80, seq=7 time=21.85 ms
connected to www.askwan.com:80, seq=8 time=19.67 ms
connected to www.askwan.com:80, seq=9 time=19.52 ms
--- http://www.askwan.com ping statistics ---
10 connects, 10 ok, 0.00% failed
round-trip min/avg/max = 17.1/29.8/107.0 ms
测试结果出来了
最小web页面响应时间:17.1  ms
平均web页面响应时间:29.8  ms
最大web页面响应时间:107.0 ms


一般来说 对我们有意义的数据是是平均值

可以用shell直接取到这个值得
Quotation
#httping -c5 -g http://www.askwan.com | tail -n1 | awk '{print $4}' | cut -d/ -f2


还可以配合shell和rrdtool可以画出一张完美的web响应时间图来,还不错,^_^^_^

----------------------------------------EOF--------------------------------------------------------

freebsd 7.0 之内核编译

[不指定 2008/06/25 16:00 | by askwan ]
   今天把一台freebsd7.0的web服务器重新编译了下内核,写下来备忘

Quotation
#cd /usr/src/sys/i386/conf/
#cp GENERIC askwan20080625


编辑askwan20080625,内核中各种选项意义都有相应注释,下面是我为这台机器编辑的内核配置文件




########            askwan kernel confiuration        ###########

# $FreeBSD: src/sys/i386/conf/GENERIC,v 1.474.2.2.2.1 2008/02/06 03:24:28 scottl Exp $

#cpu    I486_CPU
#cpu    I586_CPU
cpu    I686_CPU
ident    askwan20080625
#现在机器基本上用不着486和586的了


# To statically compile in device wiring instead of /boot/device.hints
#hints    "GENERIC.hints"    # Default places to look for devices.

makeoptions  DEBUG=-g    # Build kernel with gdb(1) debug symbols

#options   SCHED_4BSD    # 4BSD scheduler
options         SCHED_ULE
# SCHED_ULE新的freebsd的调度器,转为SMP设计的,不过还处于试验性阶段
options   PREEMPTION    # Enable kernel thread preemption
options   INET      # InterNETworking
#options   INET6      # IPv6 communications protocols
#options   SCTP      # Stream Control Transmission Protocol
#不需要ipv6了

     起初,很想体验一下ESX 最新版本3.5 update 1的强大功能 ,便有了下文
     开始在一台裸机上装 ,配置 是 双 CPU XEON 2.4 KHZ + SCSI 73G + 2G RAM +2千兆网卡
启动后 ,发现无法识别硬盘 ,倒了 ,再看看vm的内核是基于linux2.4的,机器很老,先想到
用软盘加载硬盘驱动,无果。接着啃 vm esx install guide ,最后发现只有vmware 测试支持的硬件
才可以通过安装,猜想我的这机器貌似真的很老了,机器的硬件不在vmware支持之列,遗憾啊……
    既然裸机不可以装,我就想用workstation装,用的vm workstation6.0 ,设置好后,修改vmx配置文件
将网卡类型修改了,有兄弟要问了,为什么要修改网卡? 你试试就知道了,呵呵
网卡修改成这个是可以通过的 ethernet0.virtualDev = "e1000",在加上
monitor_control.restrict_backdoor = TRUE,monitor_control.vt32 = TRUE   ,我的是intel的
amd的用这个 monitor_control.enable_svm = TRUE   ,就这样装是装起来了,可是启动速度慢的
不是一般人可以承受的,这也难怪,本身esx就是裸机装的,装到虚拟机上,跑得慢也是正常,不过,有个
好消息是Workstation 6.5 貌似可以很好支持ESX,启动速度也比较快,有兄弟做过,等不忙了,俺也测试测试

这张我最后胜利安装的截图
Open in new window
Tags: ,
继上次写的
Freebsd 7.0 下用squid做本地Web加速代理

这次写下Freebsd 7.0 下用squid做多台Web加速代理
freebsd安装配置不说了 可以参考上一篇
直接给出我的squid.conf 文件
http_port 192.168.0.14:80 vhost vport

hierarchy_stoplist cgi-bin ?
hierarchy_stoplist -i ^https:\\ ?
acl QUERY urlpath_regex cgi-bin \?
acl denyssl urlpath_regex -i ^https:\\
no_cache deny QUERY
no_cache deny denyssl

acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
collapsed_forwarding on

cache_mem  384 MB
cache_swap_low 85
cache_swap_high 95
maximum_object_size  10 MB
maximum_object_size_in_memory 8192 KB

ipcache_size 4096
ipcache_low 90
ipcache_high 95
fqdncache_size 4096


cache_replacement_policy lru
memory_replacement_policy lru

cache_dir ufs /disk01/cache1 4096 16 256

cache_access_log /usr/local/squid/var/logs/access.log
cache_log /usr/local/squid/var/logs/cache.log
cache_store_log /usr/local/squid/var/logs/store.log
pid_filename /usr/local/squid/var/logs/squid.pid

forward_timeout 20 seconds
connect_timeout 15 seconds
read_timeout 3 minutes
request_timeout 1 minutes

persistent_request_timeout 15 seconds
client_lifetime 15 minutes
half_closed_clients off

shutdown_lifetime 5 seconds

visible_hostname cache.askwan.com
cache_mgr askwan@askwan.com
visible_hostname Askwan-Squid-Cache-Server

cache_effective_user squid
cache_effective_group squid

logfile_rotate 0

client_persistent_connections off
server_persistent_connections on

vary_ignore_expire on
strip_query_terms on

acl OverConnLimit maxconn 10
http_access deny OverConnLimit

acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl localhost src 127.0.0.1/255.255.255.255 192.168.0.0/24
acl Srvip   dst 192.168.0.14/32 202.108.22.43/32 64.233.189.104/32 209.131.36.158/32
acl Srvdm   dstdomain .askwan.com baidu.com .yahoo.com .google.com
acl to_localhost dst 127.0.0.0/8 192.168.0.14/32
acl purgehost src   127.0.0.0/8 192.168.0.14/32
acl purgemethod method PURGE
acl SSL_ports port 443 563
acl Safe_ports port 80        
acl Safe_ports port 81      
acl CONNECT method CONNECT

always_direct allow Srvdm
never_direct allow !Srvdm
http_access allow manager localhost
http_access deny manager
http_access allow purgemethod purgehost
http_access deny !Safe_ports
http_access deny CONNECT all
http_access allow localhost
http_access allow Srvip
http_access allow Srvdm
http_access deny all
http_reply_access allow all
icp_access deny all
icp_port 0
Tags: , , ,
Pages: 12/21 First page Previous page 7 8 9 10 11 12 13 14 15 16 Next page Final page [ View by Articles | List ]