杞�杞斤�https://blog.csdn.net/qq_21267705/article/details/70159594
涓���http_load
绋�搴���甯稿�锛�瑙e����涔�涓���100K
http_load浠ュ苟琛�澶��ㄧ���瑰�杩�琛�锛��ㄤ互娴�璇�web���″�ㄧ��������涓�璐�杞姐��浣���瀹�涓���浜�澶у��板����娴�璇�宸ュ�凤�瀹���浠ヤ互涓�涓���涓���杩�绋�杩�琛�锛�涓���涓�浼���瀹㈡�锋�烘��姝汇��杩���浠ユ�璇�HTTPS绫荤��缃�绔�璇锋���
涓�杞藉�板��锛�http://soft.vpser.net/test/http_load/http_load-12mar2006.tar.gz
瀹�瑁�
#tar zxvf http_load-12mar2006.tar.gz
#cd http_load-12mar2006
#make && make install
�戒护�煎�锛�http_load� -p 骞跺��璁块��杩�绋��奥� -s 璁块���堕�绰� ��瑕�璁块����URL��浠�
���板�跺����浠ヨ���辩���锛����颁��寸�����╁苟娌℃��浠�涔����躲��姣�濡�浣�����http_load -parallel 5 -seconds
300 urls.txt涔�����浠ョ������浠������扮�澶у�剁����璇存��涓�涓���
-parallel 绠���-p 锛���涔���骞跺�����ㄦ�疯�绋��般��
-fetches 绠���-f 锛���涔����昏�$��璁块��娆℃��
-rate��� 绠���-p 锛���涔���姣�绉���璁块��棰���
-seconds绠���-s 锛���涔����昏�$��璁块���堕��
��澶�URL��浠讹�urllist.txt锛���浠舵�煎���姣�琛�涓�涓�URL锛�URL��濂借�杩�50锛�100涓�娴�璇�����姣�杈�濂�.��浠舵�煎�濡�涓�锛�
http://www.vpser.net/uncategorized/choose-vps.html
http://www.vpser.net/vps-cp/hypervm-tutorial.html
http://www.vpser.net/coupons/diavps-april-coupons.html
http://www.vpser.net/security/vps-backup-web-mysql.html
渚�濡�锛�
http_load -p 30 -s 60� urllist.txt
���颁�瑙d�锛���浠��ョ��杩�琛�涓��″�戒护�ョ����瀹���杩���缁���
�戒护锛�% ./http_load -rate 5 -seconds 10 urls璇存���ц�浜�涓�涓���缁��堕��10绉���娴�璇�锛�姣�绉���棰���涓�5��
49 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds5916 mean bytes/connection4.89274
fetches/sec, 28945.5 bytes/secmsecs/connect: 28.8932 mean, 44.243 max, 24.488 minmsecs/first
-response: 63.5362 mean, 81.624 max, 57.803 minHTTP response codes: code 200 �� 49
缁�������锛�
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���� 璇存����寮���搴�椤甸�㈢��绫诲��锛�濡���403��绫诲��杩�澶�锛��e����
瑕�娉ㄦ������绯荤����颁��堕���
�规��璇存��锛�
娴�璇�缁���涓�涓昏��������� fetches/sec��msecs/connect 杩�涓���椤癸��虫���″�ㄦ��绉��藉���搴����ヨ�㈡�℃�帮��ㄨ�涓������ヨ ���ц�姐��浼间�姣� apache��ab��纭���瑕�楂�涓�浜�锛�涔��存��璇存����涓�浜���
Qpt-姣�绉���搴��ㄦ�锋�板��response time锛�姣�杩��ュ��搴��ㄦ�锋�堕�淬��
娴�璇���缁���涓昏�涔�����杩�涓や釜�笺��褰��朵���杩�涓や釜����骞朵��藉����瀵规�ц�界������锛���浠�杩���瑕�瀵规���″�ㄧ��cpu��men杩�琛�����锛����藉��虹�璁�
浜���webbench
webbench��Linux涓���涓�涓�缃�绔�����娴�璇�宸ュ�凤���澶���浠ユā��3涓�涓�骞跺��杩��ュ�绘�璇�缃�绔���璐�杞借�藉����涓�杞藉�板����浠ュ��google��锛���杩���缁��轰�涓�
涓�杞藉�板��锛�http://soft.vpser.net/test/webbench/webbench-1.5.tar.gz
杩�涓�绋�搴��村�锛�瑙e����涓���50K锛��靛��
瀹�瑁�
#tar zxvf webbench-1.5.tar.gz
#cd webbench-1.5
#make && make install
浼��ㄥ�����褰�����webbench���ц���浠讹��存�ュ��浠ヤ娇�ㄤ�
�ㄦ�锛�
webbench -c 骞跺���� -t 杩�琛�娴�璇��堕�� URL
濡�锛�
webbench -c 5000 -t 120http://www.163.com
涓���ab
��椤�
-A auth-username:password
瀵规���″�ㄦ��渚�BASIC璁よ��淇′换�� �ㄦ�峰����瀵����变�涓�:��寮�锛�骞朵互base64缂���褰㈠������� ��璁烘���″�ㄦ������瑕�(��, ��������浜�401璁よ����姹�浠g��)锛�姝ゅ��绗�涓查�戒�琚�������
-c concurrency
涓�娆′骇����璇锋�涓��般��榛�璁ゆ��涓�娆′�涓���
-C cookie-name=value
瀵硅�锋�����涓�涓�Cookie:琛��� �跺�稿��褰㈠���name=value��涓�涓����板�广�� 姝ゅ���板��浠ラ��澶���
-d
涓��剧ず"percentage served within XX [ms] table"��娑���(涓轰互����������渚�����)��
-e csv-file
浜х��涓�涓�浠ラ���峰������(CSV)��浠讹� �朵腑����浜�澶���姣�涓��稿��惧��姣���璇锋�����瑕�(浠�1%��100%)���稿��惧��姣���(浠ュ井濡�涓哄��浣�)�堕�淬�� �变�杩�绉��煎�宸茬���浜�杩��跺����锛���浠ユ��'gnuplot'�煎��存���ㄣ��
-g gnuplot-file
������娴�璇�缁������ヤ�涓�'gnuplot'����TSV (浠�Tab������)��浠躲�� 姝ゆ��浠跺��浠ユ�逛究�板�煎�ュ��Gnuplot, IDL, Mathematica, Igor����Excel涓��� �朵腑��绗�涓�琛�涓烘��棰���
-h
�剧ず浣跨�ㄦ�规���
-H custom-header
瀵硅�锋�����棰�澶���澶翠俊���� 姝ゅ���扮���稿��褰㈠���涓�涓�������澶翠俊��琛�锛��朵腑����浜�浠ュ���峰������瀛�娈靛���肩��瀵� (濡�, "Accept-Encoding: zip/zop;8bit").
-i
�ц�HEAD璇锋�锛���涓���GET��
-k
����HTTP KeepAlive���斤���, �ㄤ�涓�HTTP浼�璇�涓��ц�澶�涓�璇锋��� 榛�璁ゆ�讹�涓�����KeepAlive����.
-n requests
�ㄦ�璇�浼�璇�涓����ц���璇锋�涓��般�� 榛�璁ゆ�讹�浠��ц�涓�涓�璇锋�锛�浣���甯稿�剁���涓��锋��浠h〃��涔���
-p POST-file
����浜���瑕�POST���版������浠�.
-P proxy-auth-username:password
瀵逛�涓�涓�杞�浠g����渚�BASIC璁よ��淇′换�� �ㄦ�峰����瀵����变�涓�:��寮�锛�骞朵互base64缂���褰㈠������� ��璁烘���″�ㄦ������瑕�(��, ��������浜�401璁よ����姹�浠g��)锛�姝ゅ��绗�涓查�戒�琚�������
-q
濡���澶�����璇锋��板ぇ浜�150锛� ab姣�澶���澶х害10%����100涓�璇锋��讹�浼���stderr杈��轰�涓�杩�搴�璁℃�般�� 姝�-q��璁板��浠ユ���惰�浜�淇℃����
-s
�ㄤ�缂�璇�涓�(ab -h浼��剧ず�稿�充俊��)浣跨�ㄤ�SSL����淇��ょ��https锛� ��涓���http��璁����跺����姝ゅ���芥��瀹�楠��х��锛�涔���寰�绠���������濂戒�瑕��ㄣ���
-S
涓��剧ず涓��煎��������绂诲�硷� ��涓��ㄥ���煎��涓��间负������绂诲�肩��1��2���讹�涔�涓��剧ず璀������洪��淇℃���� 榛�璁ゆ�讹�浼��剧ず ��灏���/����/��澶у�肩���板�笺��(涓轰互����������渚�����).
-t timelimit
娴�璇���杩�琛�����澶х��般���跺���ㄩ�����兼��-n 50000�� 瀹���浠ヤ娇瀵规���″�ㄧ��娴�璇����跺�ㄤ�涓��哄�����绘�堕�翠互����榛�璁ゆ�讹�娌℃���堕�撮���躲��
-T content-type
POST�版����浣跨�ㄧ��Content-type澶翠俊����
-v verbosity
璁剧疆�剧ず淇℃����璇�缁�绋�搴� - 4���村ぇ�间��剧ず澶翠俊��锛� 3���村ぇ�煎��浠ユ�剧ず��搴�浠g��(404, 200绛�), 2���村ぇ�煎��浠ユ�剧ず璀������朵�淇℃����
-V
�剧ず�����峰苟���恒��
-w
浠�HTML琛ㄧ���煎�杈��虹�����榛�璁ゆ�讹�瀹����借�茶������涓ゅ��瀹藉害��涓�寮�琛ㄣ��
-x -attributes
璁剧疆灞��х��瀛�绗�涓层�� 姝ゅ��ц�濉���.
-X proxy[:port]
瀵硅�锋�浣跨�ㄤ唬�����″�ㄣ��
-y -attributes
璁剧疆灞��х��瀛�绗�涓�.
-z -attributes
璁剧疆灞��х��瀛�绗�涓�.
缂洪��
绋�搴�涓�����绉�����澹版�����哄���垮害��缂��插�恒�� ��澶�锛�瀵瑰�戒护琛����般�����″�ㄧ����搴�澶村���朵�澶��ㄨ��ョ��瑙f��涔�寰�绠���锛�杩����戒���涓���������
瀹�娌℃��瀹��村�板����HTTP/1.x; 浠��ュ����浜�'棰���'����搴��煎��� strstr(3)��棰�绻�浣跨�ㄥ���戒�甯��ユ�ц�介��棰�锛���, 浣����芥���ㄦ�璇�ab��涓������″�ㄧ���ц�姐��
���板�澶�,涓�����浠��� -c �� -n ���板氨��浠ヤ�. 渚�濡�:
./ab -c 1000 -n 1000 http://127.0.0.1/index.php
杩�涓�琛ㄧず���跺���1000涓�璇锋�骞惰�琛�1000娆�index.php��浠�.
#/usr/local/xiaobai/apache2054/bin/ab -c 1000 -n 1000 http://127.0.0.1/index.html.zh-cn.gb2312
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (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 1000 requests
Server Software: Apache/2.0.54
//骞冲��apache ����2.0.54
Server Hostname: 127.0.0.1
//���″�ㄤ富�哄��
Server Port: 80
//���″�ㄧ����
Document Path: /index.html.zh-cn.gb2312
//娴�璇���椤甸�㈡��妗�
Document Length: 1018 bytes
//��妗eぇ灏�
Concurrency Level: 1000
//骞跺����
Time taken for tests: 8.188731 seconds
//�翠釜娴�璇���缁����堕��
Complete requests: 1000
//瀹�����璇锋��伴��
Failed requests: 0
//澶辫触��璇锋��伴��
Write errors: 0
Total transferred: 1361581 bytes
//�翠釜�烘��涓���缃�缁�浼�杈���
HTML transferred: 1055666 bytes
//�翠釜�烘��涓���HTML��瀹逛�杈���
Requests per second: 122.12 [#/sec] (mean)
//澶у�舵���冲�������涔�涓�锛��稿�浜� LR 涓��� 姣�绉�浜��℃�� 锛����㈡���蜂腑�� mean 琛ㄧず杩���涓�涓�骞冲����
Time per request: 8188.731 [ms] (mean)
//澶у�舵���冲�������涔�浜�锛��稿�浜� LR 涓��� 骞冲��浜��″��搴��堕�� 锛����㈡���蜂腑�� mean 琛ㄧず杩���涓�涓�骞冲����
Time per request: 8.189 [ms] (mean, across all concurrent requests)
//姣�涓�璇锋�瀹���杩�琛��堕�寸��骞冲����
Transfer rate: 162.30 [Kbytes/sec] received
//骞冲��姣�绉�缃�缁�涓���娴���锛���浠ュ府�╂���ゆ����瀛��ㄧ�缁�娴���杩�澶у�艰�村��搴��堕�村欢�跨����棰�
Connection Times (ms)
min mean[+/-sd] median max
Connect: 4 646 1078.7 89 3291
Processing: 165 992 493.1 938 4712
Waiting: 118 934 480.6 882 4554
Total: 813 1638 1338.9 1093 7785
//缃�缁�涓�娑������堕�寸����瑙o���椤规�版�����蜂�绠�娉�杩�涓���寰�娓�妤�
Percentage of the requests served within a certain time (ms)
50% 1093
66% 1247
75% 1373
80% 1493
90% 4061
95% 4398
98% 5608
99% 7368
100% 7785 (longest request)
//�翠釜�烘��涓�����璇锋�����搴����点���ㄥ�烘��涓�姣�涓�璇锋��芥��涓�涓���搴��堕�达��朵腑50锛����ㄦ�峰��搴��堕�村�浜�1093 姣�绉�锛�60锛� ���ㄦ�峰��搴��堕�村�浜�1247 姣�绉�锛���澶х����搴��堕�村�浜�7785 姣�绉�
�变�瀵逛�骞跺��璇锋�锛�cpu瀹���涓�骞朵������跺�����锛��������ф��涓�璇锋��峰����堕�寸����涓�杞�杞�澶�����锛���浠ュ�烘��涓�绗�涓�涓�Time per request�堕�寸害绛�浜�绗�浜�涓�Time per request�堕�翠�浠ュ苟��璇锋���
����Siege
涓�娆惧�婧�������娴�璇�宸ュ�凤���浠ユ�规����缃�瀵逛�涓�WEB绔��硅�琛�澶��ㄦ�风��骞跺��璁块��锛�璁板�姣�涓��ㄦ�锋����璇锋�杩�绋����稿��堕�达�骞跺�ㄤ�瀹��伴����骞跺��璁块��涓���澶�杩�琛���
瀹��癸�http://www.joedog.org/
Siege涓�杞斤�http://soft.vpser.net/test/siege/siege-2.67.tar.gz
瑙e��锛�
# 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��瀹�:
http://www.licess.cn
http://www.vpser.net
http://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 //姣�娆′�杈����辨�����堕��