关键字 |
---|
Makefile、http_load、https |
使用方法:
http_load -p 并发访问进程数 -s 访问时间 需要访问的URL文件
http_load -r 5 -s 10 urls.txt
参数说明:
-parallel (-p): 并发的用户进程数
-fetches (-f): 总计的访问次数
-rate (-r): 每秒的访问频率
-seconds (-s): 总计的访问时间
结果说明:
1. 49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
说明在上面的测试中运行了49个请求,最大的并发进程数是2,总计传输的数据是289884bytes,运行的时间是10.0148 秒
2. 5916 mean bytes/connection
说明每一连接平均传输的数据量289884/49=5916
3. 4.89274 fetches/sec, 28945.5 bytes/sec
说明每秒的响应请求为4.89274,每秒传递的数据为28945.5 bytes/sec
4. msecs/connect: 28.8932 mean, 44.243 max, 24.488 min
说明每连接的平均响应时间是28.8932 msecs,最大的响应时间44.243 msecs,最小的响应时间24.488 msecs
5. msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min
6. HTTP response codes: code 200 — 49
说明打开响应页面的类型
修改Makefile使其支持https
SSL_TREE = /usr/local/ssl
SSL_DEFS = -DUSE_SSL
SSL_INC = -I$(SSL_TREE)/include
SSL_LIBS = -L$(SSL_TREE)/lib -lssl -lcrypto
LDFLAGS = -s $(SSL_LIBS) $(SYSV_LIBS) -rdynamic -ldl
完整Makefile
# Makefile for http_load
# CONFIGURE: If you are using a SystemV-based operating system, such as
# Solaris, you will need to uncomment this definition.
#SYSV_LIBS = -lnsl -lsocket -lresolv
# CONFIGURE: If you want to compile in support for https, uncomment these
# definitions. You will need to have already built OpenSSL, available at
# http://www.openssl.org/ Make sure the SSL_TREE definition points to the
# tree with your OpenSSL installation - depending on how you installed it,
# it may be in /usr/local instead of /usr/local/ssl.
SSL_TREE = /usr/local/ssl
SSL_DEFS = -DUSE_SSL
SSL_INC = -I$(SSL_TREE)/include
SSL_LIBS = -L$(SSL_TREE)/lib -lssl -lcrypto
BINDIR = /usr/local/bin
MANDIR = /usr/local/man/man1
CC = gcc -Wall
CFLAGS = -O $(SRANDOM_DEFS) $(SSL_DEFS) $(SSL_INC)
#CFLAGS = -g $(SRANDOM_DEFS) $(SSL_DEFS) $(SSL_INC)
# LDFLAGS = -s $(SSL_LIBS) $(SYSV_LIBS)
LDFLAGS = -s $(SSL_LIBS) $(SYSV_LIBS) -rdynamic -ldl
#LDFLAGS = -g $(SSL_LIBS) $(SYSV_LIBS)
all: http_load
http_load: http_load.o timers.o
$(CC) $(CFLAGS) http_load.o timers.o $(LDFLAGS) -o http_load
http_load.o: http_load.c timers.h port.h
$(CC) $(CFLAGS) -c http_load.c
timers.o: timers.c timers.h
$(CC) $(CFLAGS) -c timers.c
install: all
rm -f $(BINDIR)/http_load
cp http_load $(BINDIR)
rm -f $(MANDIR)/http_load.1
cp http_load.1 $(MANDIR)
clean:
rm -f http_load *.o core core.* *.core
tar:
@name=`sed -n -e '/define VERSION /!d' -e 's,.*http_load ,http_load-,' -e 's,",,p' version.h` ; \
rm -rf $$name ; \
mkdir $$name ; \
tar cf - `cat FILES` | ( cd $$name ; tar xfBp - ) ; \
chmod 644 $$name/Makefile ; \
tar cf $$name.tar $$name ; \
rm -rf $$name ; \
gzip $$name.tar