性能测试小工具之Siege

357 阅读11分钟

一款开源的压力测试工具,可以根据配置对一个WEB站点进行多用户的并发访问,记录每个用户所有请求过程的相应时间,并在一定数量的并发访问下重复进行。
官方: 下载自:www.joedog.org

Siege下载:soft.vpser.net/test/siege/…
解压: /是转义作用
/# tar -zxf siege-2.67.tar.gz
进入解压目录:
/# cd siege-2.67/
安装:
#./configure ; make
#make install
使用
siege -c 200 -r 10 -f example.url
-c是并发量,-r是重复次数。 url文件就是一个文本,每行都是一个url,它会从里面随机访问的。 example.url内容:
www.licess.cn
www.vpser.net
soft.vpser.net
结果说明
Lifting the server siege… done. Transactions: 3419263 hits //完成419263次处理
Availability: 100.00 % //100.00 % 成功率
Elapsed time: 5999.69 secs //总共用时
Data transferred: 84273.91 MB //共数据传输84273.91 MB
Response time: 0.37 secs //相应用时1.65秒:显示网络连接的速度
Transaction rate: 569.91 trans/sec //均每秒完成 569.91 次处理:表示服务器后 Throughput: 14.05 MB/sec //平均每秒传送数据 Concurrency: 213.42 //实际最高并发数
Successful transactions: 2564081 //成功处理次数 Failed transactions: 11 //失败处理次数
Longest transaction: 29.04 //每次传输所花最长时间
Shortest transaction: 0.00 //每次传输所花最短时间


[root@localhost /]# wget download.joedog.org/siege/siege…
--2014-11-03 20:29:24-- download.joedog.org/siege/siege…
Resolving download.joedog.org... 54.200.48.165
Connecting to download.joedog.org|54.200.48.165|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 496412 (485K) [application/x-gzip]
Saving to: `siege-3.0.8.tar.gz'

100%[============================================================================>] 496, 412108K/s in 4.5s

2014-11-03 20:29:30 (108 KB/s) - `siege-3.0.8.tar.gz' saved [496412/496412]

[root@localhost /]# tar zxvf siege-3.0.8.tar.gz
siege-3.0.8/
siege-3.0.8/AUTHORS siege-3.0.8/Makefile.am siege-3.0.8/INSTALL siege-3.0.8/MACHINES
siege-3.0.8/install-sh
siege-3.0.8/KNOWNBUGS
siege-3.0.8/ChangeLog
siege-3.0.8/README.https
siege-3.0.8/aclocal.m4
siege-3.0.8/NEWS
siege-3.0.8/README.solaris
siege-3.0.8/README
siege-3.0.8/Makefile.in
siege-3.0.8/lib/
siege-3.0.8/lib/Makefile.am siege-3.0.8/lib/joedog/
siege-3.0.8/lib/joedog/notify.c
siege-3.0.8/lib/joedog/perl.h
siege-3.0.8/lib/joedog/Makefile.am
siege-3.0.8/lib/joedog/snprintf.c
siege-3.0.8/lib/joedog/util.h
siege-3.0.8/lib/joedog/stralloc.c
siege-3.0.8/lib/joedog/stralloc.h
siege-3.0.8/lib/joedog/memory.h
siege-3.0.8/lib/joedog/snprintf.h
siege-3.0.8/lib/joedog/Makefile.in
siege-3.0.8/lib/joedog/notify.h
siege-3.0.8/lib/joedog/memory.c
siege-3.0.8/lib/joedog/perl.c
siege-3.0.8/lib/joedog/util.c
siege-3.0.8/lib/Makefile.in
siege-3.0.8/configure.ac
siege-3.0.8/configure
siege-3.0.8/html/
siege-3.0.8/html/Makefile.am
siege-3.0.8/html/basic.php
siege-3.0.8/html/cache-control.php
siege-3.0.8/html/README
siege-3.0.8/html/Makefile.in
siege-3.0.8/html/etag.php
siege-3.0.8/html/cookie-test.php
siege-3.0.8/html/login.php
siege-3.0.8/utils/
siege-3.0.8/utils/Makefile.am
siege-3.0.8/utils/ltmain.sh
siege-3.0.8/utils/install-sh
siege-3.0.8/utils/mkinstalldirs
siege-3.0.8/utils/missing
siege-3.0.8/utils/config.guess
siege-3.0.8/utils/Makefile.in
siege-3.0.8/utils/mdate-sh
siege-3.0.8/utils/siege.config.in
siege-3.0.8/utils/mkstamp
siege-3.0.8/utils/config.sub
siege-3.0.8/utils/siege2csv.in
siege-3.0.8/utils/bombardment.in
siege-3.0.8/utils/bootstrap
siege-3.0.8/src/
siege-3.0.8/src/md5.h
siege-3.0.8/src/getopt.c
siege-3.0.8/src/ftp.h
siege-3.0.8/src/setup.h
siege-3.0.8/src/eval.c
siege-3.0.8/src/Makefile.am
siege-3.0.8/src/url.h
siege-3.0.8/src/base64.h
siege-3.0.8/src/handler.c
siege-3.0.8/src/timer.h
siege-3.0.8/src/util.h
siege-3.0.8/src/main.c
siege-3.0.8/src/timer.c
siege-3.0.8/src/log.h
siege-3.0.8/src/crew.c
siege-3.0.8/src/client.h
siege-3.0.8/src/date.c
siege-3.0.8/src/array.c
siege-3.0.8/src/creds.c
siege-3.0.8/src/getopt1.c
siege-3.0.8/src/client.c
siege-3.0.8/src/load.c
siege-3.0.8/src/log.c
siege-3.0.8/src/version.c
siege-3.0.8/src/init.h
siege-3.0.8/src/sock.h
siege-3.0.8/src/auth.c
siege-3.0.8/src/init.c
siege-3.0.8/src/ssl.c
siege-3.0.8/src/data.h
siege-3.0.8/src/http.c
siege-3.0.8/src/crew.h
siege-3.0.8/src/cfg.c
siege-3.0.8/src/data.c
siege-3.0.8/src/auth.h
siege-3.0.8/src/Makefile.in
siege-3.0.8/src/ssl.h
siege-3.0.8/src/http.h
siege-3.0.8/src/date.h
siege-3.0.8/src/cookie.c
siege-3.0.8/src/cfg.h
siege-3.0.8/src/hash.h
siege-3.0.8/src/cookie.h
siege-3.0.8/src/url.c
siege-3.0.8/src/load.h
siege-3.0.8/src/ftp.c
siege-3.0.8/src/eval.h
siege-3.0.8/src/base64.c
siege-3.0.8/src/array.h
siege-3.0.8/src/hash.c
siege-3.0.8/src/version.h
siege-3.0.8/src/util.c
siege-3.0.8/src/creds.h
siege-3.0.8/src/handler.h
siege-3.0.8/src/sock.c
siege-3.0.8/src/md5.c
siege-3.0.8/include/
siege-3.0.8/include/Makefile.am
siege-3.0.8/include/config.h.in
siege-3.0.8/include/joedog/
siege-3.0.8/include/joedog/Makefile.am
siege-3.0.8/include/joedog/joedog.h
siege-3.0.8/include/joedog/getopt.h
siege-3.0.8/include/joedog/Makefile.in
siege-3.0.8/include/joedog/boolean.h
siege-3.0.8/include/joedog/defs.h
siege-3.0.8/include/Makefile.in
siege-3.0.8/COPYING
siege-3.0.8/doc/
siege-3.0.8/doc/Makefile.am
siege-3.0.8/doc/siege.1.in
siege-3.0.8/doc/urls_txt.5.in
siege-3.0.8/doc/layingsiege.7.in
siege-3.0.8/doc/siege2csv.1.in
siege-3.0.8/doc/urls.txt
siege-3.0.8/doc/Makefile.in
siege-3.0.8/doc/bombardment.1.in
siege-3.0.8/doc/siegerc.in
siege-3.0.8/doc/siege.config.1.in
siege-3.0.8/acinclude.m4
siege-3.0.8/acspecific.m4
[root@localhost /]# cd siege-3.0.8
[root@localhost siege-3.0.8]# ls -ll
total 1356
-rw-r--r-- 1 463 463 245899 Jan 30 2012 acinclude.m4
-rw-r--r-- 1 463 463 31147 Oct 31 2013 aclocal.m4
-rw-r--r-- 1 463 463 32730 Apr 18 2006 acspecific.m4
-rw-r--r-- 1 463 463 1254 Apr 18 2006 AUTHORS
-rw-r--r-- 1 463 463 9118 Sep 6 02:09 ChangeLog
-rwxr-xr-x 1 463 463 908998 Aug 20 21:17 configure
-rw-r--r-- 1 463 463 12431 Sep 12 2013 configure.ac
-rw-r--r-- 1 463 463 18092 Aug 19 2013 COPYING
drwxrwxrwx 2 463 463 4096 Sep 6 03:11 doc
drwxrwxrwx 2 463 463 4096 Sep 6 03:11 html
drwxrwxrwx 3 463 463 4096 Sep 6 03:10 include
-rw-r--r-- 1 463 463 9540 Mar 28 2007 INSTALL
-rwxr-xr-x 1 463 463 10970 Apr 3 2009 install-sh
-rw-r--r-- 1 463 463 1273 Jul 28 2009 KNOWNBUGS
drwxrwxrwx 3 463 463 4096 Sep 6 03:10 lib
-rw-r--r-- 1 463 463 2375 May 7 2007 MACHINES
-rw-r--r-- 1 463 463 1284 Aug 1 2013 Makefile.am
-rw-r--r-- 1 463 463 19095 Sep 6 02:17 Makefile.in
-rw-r--r-- 1 463 463 55 Apr 18 2006 NEWS
-rw-r--r-- 1 463 463 5394 Apr 2 2009 README
-rw-r--r-- 1 463 463 1979 Apr 18 2006 README.https
-rw-r--r-- 1 463 463 300 May 4 2006 README.solaris
drwxrwxrwx 2 463 463 4096 Sep 6 03:10 src
drwxrwxrwx 2 463 463 4096 Sep 6 03:11 utils
[root@localhost siege-3.0.8]# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets ?(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking dependency style of gcc... none
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for AIX... no
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ANSI C... (cached) none needed
checking dependency style of gcc... (cached) none
checking for a sed that does not truncate output... /bin/sed
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognise dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking dependency style of g++... none
checking how to run the C++ preprocessor... g++ -E
checking for g77... no
checking for f77... no
checking for xlf... no
checking for frt... no
checking for pgf77... no
checking for fort77... no
checking for fl32... no
checking for af77... no
checking for f90... no
checking for xlf90... no
checking for pgf90... no
checking for epcf90... no
checking for f95... no
checking for fort... no
checking for xlf95... no
checking for ifc... no
checking for efc... no
checking for pgf95... no
checking for lf95... no
checking for gfortran... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether accepts -g... no
checking the maximum length of command line arguments... 32768
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC
checking if gcc PIC flag -fPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
configure: creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
appending configuration tag "F77" to libtool
checking for perl... /usr/bin/perl
checking for a POSIX-compliant shell... /bin/sh
checking whether make sets $(MAKE)... (cached) yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for buggy pthread mutex initializers... no
checking for dlopen() in -ldld... no
checking for dlopen() in -ldl... yes
checking for random device... yes
checking for ssl support... yes
checking off/include/openssl/opensslv.h usability... no
checking off/include/openssl/opensslv.h presence... no
checking for off/include/openssl/opensslv.h... no
checking /usr/include/openssl/opensslv.h usability... yes
checking /usr/include/openssl/opensslv.h presence... yes
checking for /usr/include/openssl/opensslv.h... yes
checking for OpenSSL version... >= 0.9.8 (appropriate flag set)
checking for inline... inline
checking for int8_t... yes
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for uint8_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for u_int32_t... yes
checking for ssize_t... yes
checking for ANSI C header files... (cached) yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for unistd.h... (cached) yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/times.h usability... yes
checking sys/times.h presence... yes
checking for sys/times.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking netdb.h usability... yes
checking netdb.h presence... yes
checking for netdb.h... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for string.h... (cached) yes
checking for strings.h... (cached) yes
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking openssl/e_os.h usability... no
checking openssl/e_os.h presence... no
checking for openssl/e_os.h... no
checking openssl/e_os2.h usability... yes
checking openssl/e_os2.h presence... yes
checking for openssl/e_os2.h... yes
checking for an ANSI C-conforming const... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking return type of signal handlers... void
checking for working alloca.h... yes
checking for alloca... yes
checking for strchr... yes
checking for memcpy... yes
checking for strncpy... yes
checking for strstr... yes
checking for strlen... yes
checking for strncasecmp... yes
checking for strncmp... yes
checking for socket... yes
checking for gethostbyname... yes
checking for snprintf... yes
checking for strdup... yes
checking for rand_r... yes
checking for localtime_r... yes
checking for getipnodebyname... no
checking for freehostent... no
checking for getopt_long... yes
checking for socket in -lsocket... no
checking for pthread_attr_init in -lpthread... yes
PLATFORM: pc-i686-linux-gnu
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating doc/Makefile
config.status: creating html/Makefile
config.status: creating lib/Makefile
config.status: creating lib/joedog/Makefile
config.status: creating include/Makefile
config.status: creating include/joedog/Makefile
config.status: creating utils/Makefile
config.status: creating include/config.h
config.status: executing depfiles commands
config.status: executing default-1 commands
config.status: executing default-2 commands
config.status: executing default-3 commands
config.status: executing default-4 commands
config.status: executing default-5 commands
config.status: executing default-6 commands


Configuration is complete

Run the following commands to complete the installation:
make
make install

To upgrade an old siegerc file (optional):
mv ~/.siegerc.new ~/.siegerc

For complete documentation: www.joedog.org

我还没有 更改配置文件到指定目录之下
执行文件在/usr/local/bin
资源文件在/usr/local/share


可自行指定安装到指定目录(此部分非必须)
./configure --prefix=/usr/local/siege --mandir=/usr/local/man --with-ssl=/usr/local/ssl
mkdir -p /usr/local/siege/etc/
mkdir -p /usr/local/siege/var/
make
make install

创建.siegec.config配置文件到当前用户的家目录下
/usr/local/siege/bin/siege.config


[root@localhost share]# cd /usr/local/bin
[root@localhost bin]# ls -a
. faac ffserver gitk git-upload-archive lame MP4Client siege2csv.pl yasm
.. ffmpeg git git-receive-pack git-upload-pack mencoder mplayer siege.config ytasm
bombardment ffprobe git-cvsserver git-shell http_load MP4Box siege vsyasm
[root@localhost bin]# siege -C
CURRENT SIEGE CONFIGURATION
Mozilla/5.0 (pc-i686-linux-gnu) Siege/3.0.8
Edit the resource file to change the settings.

version: 3.0.8
verbose: true
quiet: false
debug: false
protocol: HTTP/1.1
get method: HEAD
connection: close
concurrent users: 15
time to run: n/a
repetitions: n/a
socket timeout: 30
accept-encoding: gzip
delay: 1 sec
internet simulation: false
benchmark mode: false
failures until abort: 1024
named URL: none
URLs file: /usr/local/etc/urls.txt
logging: true
log file: /usr/local/var/siege.log
resource file: /usr/local/etc/siegerc
timestamped output: false
comma separated output: false
allow redirects: true
allow zero byte data: true
allow chunked encoding: true
upload unique files: true

[root@localhost bin]# siege -c 10 -r 10 http://192.168.50.11/login?back_url=http%3A%2F%2F192.168.50.11%2F
** SIEGE 3.0.8
** Preparing 10 concurrent users for battle.
The server is now under siege...
HTTP/1.1 200 0.01 secs: 3184 bytes ==> GET /login?back_url=http%3A%2F%2F192.168.50.11%2F
HTTP/1.1 200 0.01 secs: 3184 bytes ==> GET /login?back_url=http%3A%2F%2F192.168.50.11%2F
…………
HTTP/1.1 200 0.01 secs: 3184 bytes ==> GET /login?back_url=http%3A%2F%2F192.168.50.11%2F
HTTP/1.1 200 0.01 secs: 3184 bytes ==> GET /login?back_url=http%3A%2F%2F192.168.50.11%2F
done.

Transactions: 100 hits
Availability: 100.00 %
Elapsed time: 8.11 secs
Data transferred: 0.30 MB
Response time: 0.05 secs
Transaction rate: 12.33 trans/sec
Throughput: 0.04 MB/sec
Concurrency: 0.60
Successful transactions: 100
Failed transactions: 0
Longest transaction: 3.01
Shortest transaction: 0.00

FILE: /usr/local/var/siege.log
You can disable this annoying message by editing
the .siegerc file in your home directory; change
the directive 'show-logfile' to false.(root下没有这个.siegerc,自己创建把内容show-logfile=false加进去,即可关掉显示post,get的过程)
[root@localhost ~]# vi .siegerc

[root@localhost ~]# ls -a
. .cshrc .gnome2 master .siegerc .Xauthority
.. Desktop .gnome2_private .metacity .tcshrc .xsession-errors
anaconda-ks.cfg .dmrc .gstreamer-0.10 .mysql_history tools yasm-1.3.0
.bash_history .eggcups .gtkrc-1.2-gnome2 .nautilus .Trash yasm-1.3.0.tar.gz .bash_logout .gconf .ICEauthority .openoffice.org .viminfo
.bash_profile .gconfd install.log .redhat VMwareTools-9.6.1-1378637.tar.gz
.bashrc .gnome install.log.syslog she vmware-tools-distrib

[root@localhost bin]# siege -c 10 -r 10 http://192.168.50.11/login?back_url=http%3A%2F%2F192.168.50.11%2F
** SIEGE 3.0.8
** Preparing 10 concurrent users for battle.
The server is now under siege.. done.

Transactions: 100 hits
Availability: 100.00 %
Elapsed time: 1.18 secs
Data transferred: 0.30 MB
Response time: 0.10 secs
Transaction rate: 84.75 trans/sec
Throughput: 0.26 MB/sec
Concurrency: 8.31
Successful transactions: 100
Failed transactions: 0
Longest transaction: 0.80
Shortest transaction: 0.01


删除文件就可以恢复日志显示post或者get过程 [root@localhost bin]# cd - /root [root@localhost ~]# ls -a . .cshrc .gnome2 master .siegerc .Xauthority
.. Desktop .gnome2_private .metacity .tcshrc .xsession-errors
anaconda-ks.cfg .dmrc .gstreamer-0.10 .mysql_history tools yasm-1.3.0
.bash_history .eggcups .gtkrc-1.2-gnome2 .nautilus .Trash yasm-1.3.0.tar.gz .bash_logout .gconf .ICEauthority .openoffice.org .viminfo
.bash_profile .gconfd install.log .redhat VMwareTools-9.6.1-1378637.tar.gz
.bashrc .gnome install.log.syslog she vmware-tools-distrib
[root@localhost ~]# rm .siegerc
rm: remove regular file `.siegerc'? Y
[root@localhost bin]# siege -c 10 -r 5 "http://192.168.50.11/login POST back_url=http%3A%2F%2F192.168.50.11%2F"
** SIEGE 3.0.8
** Preparing 10 concurrent users for battle.
The server is now under siege...
HTTP/1.1 422 0.02 secs: 2070 bytes ==> POST http://192.168.50.11/login POST back_url=http%3A%2F%2F192.168.50.11%2F
……
HTTP/1.1 422 0.01 secs: 2070 bytes ==> POST http://192.168.50.11/login POST back_url=http%3A%2F%2F192.168.50.11%2F
HTTP/1.1 422 0.00 secs: 2070 bytes ==> POST http://192.168.50.11/login POST back_url=http%3A%2F%2F192.168.50.11%2F
done.

Transactions: 50 hits
Availability: 100.00 %
Elapsed time: 5.25 secs
Data transferred: 0.10 MB
Response time: 0.14 secs
Transaction rate: 9.52 trans/sec
Throughput: 0.02 MB/sec
Concurrency: 1.35
Successful transactions: 0
Failed transactions: 0
Longest transaction: 3.22
Shortest transaction: 0.00
[root@localhost bin]# siege -c 2 -t 2s -f testurl.txt
** SIEGE 3.0.8
** Preparing 2 concurrent users for battle.
The server is now under siege...
HTTP/1.1 302 0.01 secs: 146 bytes ==> GET /projects/todo
HTTP/1.1 200 0.01 secs: 3197 bytes ==> GET /login?back_url=http%3A%2F%2F192.168.50.11%2Fprojects%2Ftodo
HTTP/1.1 302 0.01 secs: 157 bytes ==> GET /projects/todo/activity
HTTP/1.1 200 0.00 secs: 3206 bytes ==> GET /login?back_url=http%3A%2F%2F192.168.50.11%2Fprojects%2Ftodo%2Factivity
HTTP/1.1 302 0.01 secs: 161 bytes ==> GET /projects/todo/issues/new
HTTP/1.1 302 0.01 secs: 155 bytes ==> GET /projects/todo/issues
HTTP/1.1 200 0.01 secs: 3204 bytes ==> GET /login?back_url=http%3A%2F%2F192.168.50.11%2Fprojects%2Ftodo%2Fissues

Lifting the server siege... done.

Transactions: 6 hits
Availability: 100.00 %
Elapsed time: 1.14 secs
Data transferred: 0.01 MB
Response time: 0.01 secs
Transaction rate: 5.26 trans/sec
Throughput: 0.01 MB/sec
Concurrency: 0.05
Successful transactions: 7
Failed transactions: 0
Longest transaction: 0.01
Shortest transaction: 0.00


50个用户(每次并发量,注意不是每秒并发量) 重复100次 共产生 50 * 100 = 5000个请求
/usr/local/siege/bin/siege -c 50 -r 100  www.abc.com/a.php
50个用户 重复100次 发送GET参数
/usr/local/siege/bin/siege -c 50 -r 100  www.abc.com/a.php?name=…
50个用户 重复100次 发送POST参数 (注意引号)
/usr/local/siege/bin/siege -c 50 -r 100  "www.abc.com/a.php POST name=zhangsan"
50个用户 重复100次 发送POST参数(从文件中读取)
/usr/local/siege/bin/siege -c 50 -r 100  "www.abc.com/a.php POST < /root/ab_test/post.xml"
siege -c 2 -t 2s -f testurl.txt 从文件中读取 默认为get,testurl.txt为完整的URL列表
siege -c 2 -r 5 "http://192.168.50.11/projects POST <./testurl.txt"