锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
瑕佹埑鐮磋繖涓敊璇粨璁? 鍙互浠庣悊璁哄拰瀹炶返涓ゆ柟闈㈡潵.
緋葷粺閫氳繃涓涓洓鍏冪粍鏉ュ敮涓鏍囪瘑涓鏉CP榪炴帴. 榪欎釜鍥涘厓緇勭殑緇撴瀯鏄瘂local ip, local port, remote ip, remote port}, 瀵逛簬IPv4, 緋葷粺鐞嗚涓婃渶澶氬彲浠ョ鐞?^(32+16+32+16), 2鐨?6嬈℃柟涓繛鎺? 濡傛灉涓嶄粎浠呰冭檻TCP, 鍒欐槸涓涓簲鍏冪粍, 鍔犱笂鍗忚鍙?TCP, UDP鎴栬呭叾瀹?.
鏈嶅姟鍣ㄧ粦瀹氫竴涓猧p:port, 鐒跺悗accept榪炴帴, 鎵鏈塧ccept鐨勮繛鎺ヤ嬌鐢ㄧ殑鏈湴鍦板潃涔熸槸鍚屾牱鐨刬p:port.
濡傛灉鏌愪釜瀹㈡埛绔悜鍚屼竴涓猅CP绔偣(ip:port)鍙戣搗涓誨姩榪炴帴, 閭d箞姣忎竴鏉¤繛鎺ラ兘蹇呴』浣跨敤涓嶅悓鐨勬湰鍦癟CP绔偣, 濡傛灉瀹㈡埛绔彧鏈変竴涓狪P鍒欐槸浣跨敤涓嶅悓鐨勬湰鍦扮鍙? 璇ョ鍙g殑鑼冨洿鍦?nix緋葷粺涓婄殑涓涓緥瀛愭槸32768鍒?1000, 鍙互閫氳繃濡備笅鍛戒護鏌ョ湅:
[root@benegg.com ~]# cat /proc/sys/net/ipv4/ip_local_port_range 32768 61000
涔熷氨鏄, 涓涓鎴風榪炴帴鍚屼竴涓湇鍔″櫒(姣斿榪涜鍘嬪姏嫻嬭瘯), 鏈澶氬彲浠ュ彂璧?0000涓乏鍙崇殑榪炴帴.
TCP瀹㈡埛绔?TCP鐨勪富鍔ㄥ彂璧瘋?鍙互鍦ㄥ悓涓ip:port涓婂悜涓嶅悓鐨勬湇鍔″櫒鍙戣搗涓誨姩榪炴帴, 鍙渶鍦╞ind涔嬪墠瀵箂ocket璁劇疆SO_REUSEADDR閫夐」.
緋葷粺鏀寔鐨勬渶澶ф墦寮鏂囦歡鎻忚堪絎︽暟(鍖呮嫭socket榪炴帴):
[root@benegg.com ~]# cat /proc/sys/fs/file-max 580382
鍗曚釜榪涚▼鎵鑳芥墦寮鐨勬渶澶ф枃浠舵弿榪扮鏁?
[root@benegg.com ~]# ulimit -n 1024
鏃犺鏄浜庢湇鍔″櫒榪樻槸瀹㈡埛绔? 璁や負”涓鍙版満鍣ㄦ渶澶氬緩绔?5536涓猅CP榪炴帴”鏄病鏈夋牴鎹殑, 鐞嗚涓婅繙榪滆秴榪囪繖涓?
涓銆乭ttp_load
紼嬪簭闈炲父灝忥紝瑙e帇鍚庝篃涓嶅埌100K
http_load浠ュ茍琛屽鐢ㄧ殑鏂瑰紡榪愯錛岀敤浠ユ祴璇晈eb鏈嶅姟鍣ㄧ殑鍚炲悙閲忎笌璐熻澆銆備絾鏄畠涓嶅悓浜庡ぇ澶氭暟鍘嬪姏嫻嬭瘯宸?/p>
鍏鳳紝瀹冨彲浠ヤ互涓涓崟涓鐨勮繘紼嬭繍琛岋紝涓鑸笉浼氭妸瀹㈡埛鏈烘悶姝匯傝繕鍙互嫻嬭瘯HTTPS綾葷殑緗戠珯璇鋒眰銆?/p>
涓嬭澆鍦板潃錛?a style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://soft.vpser.net/test/http_load/http_load-12mar2006.tar.gz
瀹夎寰堢畝鍗?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> #tar zxvf http_load-12mar2006.tar.gz
#cd http_load-12mar2006
#make && make install
鍛戒護鏍煎紡錛歨ttp_load -p 騫跺彂璁塊棶榪涚▼鏁?nbsp; -s 璁塊棶鏃墮棿 闇瑕佽闂殑URL鏂囦歡
鍙傛暟鍏跺疄鍙互鑷敱緇勫悎錛屽弬鏁頒箣闂寸殑閫夋嫨騫舵病鏈変粈涔堥檺鍒躲傛瘮濡備綘鍐欐垚http_load -parallel 5 -seconds
300 urls.txt涔熸槸鍙互鐨勩傛垜浠妸鍙傛暟緇欏ぇ瀹剁畝鍗曡鏄庝竴涓嬨?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> -parallel 綆鍐?p 錛氬惈涔夋槸騫跺彂鐨勭敤鎴瘋繘紼嬫暟銆?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> -fetches 綆鍐?f 錛氬惈涔夋槸鎬昏鐨勮闂鏁?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> -rate 綆鍐?p 錛氬惈涔夋槸姣忕鐨勮闂鐜?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> -seconds綆鍐?s 錛氬惈涔夋槸鎬昏鐨勮闂椂闂?/p>
鍑嗗URL鏂囦歡錛歶rllist.txt錛屾枃浠舵牸寮忔槸姣忚涓涓猆RL錛孶RL鏈濂借秴榪?0錛?00涓祴璇曟晥鏋滄瘮杈冨ソ.鏂囦歡鏍煎紡
濡備笅錛?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> 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
渚嬪錛?/p>
http_load -p 30 -s 60 urllist.txt
鍙傛暟浜嗚В浜嗭紝鎴戜滑鏉ョ湅榪愯涓鏉″懡浠ゆ潵鐪嬬湅瀹冪殑榪斿洖緇撴灉
鍛戒護錛? ./http_load -rate 5 -seconds 10 urls璇存槑鎵ц浜嗕竴涓寔緇椂闂?0縐掔殑嫻嬭瘯錛屾瘡縐掔殑棰戠巼涓?銆?/p>
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
緇撴灉鍒嗘瀽錛?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> 1錛?9 fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
璇存槑鍦ㄤ笂闈㈢殑嫻嬭瘯涓繍琛屼簡49涓姹傦紝鏈澶х殑騫跺彂榪涚▼鏁版槸2錛屾昏浼犺緭鐨勬暟鎹槸289884bytes錛岃繍琛岀殑鏃墮棿鏄?0.0148縐?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> 2錛?916 mean bytes/connection璇存槑姣忎竴榪炴帴騫沖潎浼犺緭鐨勬暟鎹噺289884/49=5916
3錛?.89274 fetches/sec, 28945.5 bytes/sec
璇存槑姣忕鐨勫搷搴旇姹備負4.89274錛屾瘡縐掍紶閫掔殑鏁版嵁涓?8945.5 bytes/sec
4錛巑secs/connect: 28.8932 mean, 44.243 max, 24.488 min璇存槑姣忚繛鎺ョ殑騫沖潎鍝嶅簲鏃墮棿鏄?8.8932 msecs
錛屾渶澶х殑鍝嶅簲鏃墮棿44.243 msecs錛屾渶灝忕殑鍝嶅簲鏃墮棿24.488 msecs
5錛巑secs/first-response: 63.5362 mean, 81.624 max, 57.803 min
6銆丠TTP response codes: code 200 — 49 璇存槑鎵撳紑鍝嶅簲欏甸潰鐨勭被鍨嬶紝濡傛灉403鐨勭被鍨嬭繃澶氾紝閭e彲鑳?/p>
瑕佹敞鎰忔槸鍚︾郴緇熼亣鍒頒簡鐡墮銆?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> 鐗規畩璇存槑錛?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> 嫻嬭瘯緇撴灉涓富瑕佺殑鎸囨爣鏄?fetches/sec銆乵secs/connect 榪欎釜閫夐」錛屽嵆鏈嶅姟鍣ㄦ瘡縐掕兘澶熷搷搴旂殑鏌ヨ嬈℃暟錛?/p>
鐢ㄨ繖涓寚鏍囨潵琛¢噺鎬ц兘銆備技涔庢瘮 apache鐨刟b鍑嗙‘鐜囪楂樹竴浜涳紝涔熸洿鏈夎鏈嶅姏涓浜涖?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> Qpt-姣忕鍝嶅簲鐢ㄦ埛鏁板拰response time錛屾瘡榪炴帴鍝嶅簲鐢ㄦ埛鏃墮棿銆?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> 嫻嬭瘯鐨勭粨鏋滀富瑕佷篃鏄湅榪欎袱涓箋傚綋鐒朵粎鏈夎繖涓や釜鎸囨爣騫朵笉鑳藉畬鎴愬鎬ц兘鐨勫垎鏋愶紝鎴戜滑榪橀渶瑕佸鏈嶅姟鍣ㄧ殑
cpu銆乵en榪涜鍒嗘瀽錛屾墠鑳藉緱鍑虹粨璁?/p>
浜屻亀ebbench
webbench鏄疞inux涓嬬殑涓涓綉绔欏帇鍔涙祴璇曞伐鍏鳳紝鏈澶氬彲浠ユā鎷?涓囦釜騫跺彂榪炴帴鍘繪祴璇曠綉绔欑殑璐熻澆鑳藉姏銆備笅杞藉湴鍧鍙互鍒癵oogle鎼滐紝鎴戣繖閲岀粰鍑轟竴涓?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> 涓嬭澆鍦板潃錛?a style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://soft.vpser.net/test/webbench/webbench-1.5.tar.gz
榪欎釜紼嬪簭鏇村皬錛岃В鍘嬪悗涓嶅埌50K錛屽懙鍛?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> 瀹夎闈炲父綆鍗?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> #tar zxvf webbench-1.5.tar.gz
#cd webbench-1.5
#make && make install
浼氬湪褰撳墠鐩綍鐢熸垚webbench鍙墽琛屾枃浠訛紝鐩存帴鍙互浣跨敤浜?/p>
鐢ㄦ硶錛?/p>
webbench -c 騫跺彂鏁?-t 榪愯嫻嬭瘯鏃墮棿 URL
濡傦細
webbench -c 5000 -t 120 http://www.vpser.net
涓夈乤b
ab鏄痑pache鑷甫鐨勪竴嬈懼姛鑳藉己澶х殑嫻嬭瘯宸ュ叿
瀹夎浜哸pache涓鑸氨鑷甫浜嗭紝
鐢ㄦ硶鍙互鏌ョ湅瀹冪殑璇存槑
$ ./ab
./ab: wrong number of arguments
Usage: ./ab [options] [http://]hostname[:port]/path
Options are:
-n requests Number of requests to perform
-c concurrency Number of multiple requests to make
-t timelimit Seconds to max. wait for responses
-p postfile File containing data to POST
-T content-type Content-type header for POSTing
-v verbosity How much troubleshooting info to print
-w Print out results in HTML tables
-i Use HEAD instead of GET
-x attributes String to insert as table attributes
-y attributes String to insert as tr attributes
-z attributes String to insert as td or th attributes
-C attribute Add cookie, eg. ‘Apache=1234. (repeatable)
-H attribute Add Arbitrary header line, eg. ‘Accept-Encoding: gzip’
Inserted after all normal header lines. (repeatable)
-A attribute Add Basic WWW Authentication, the attributes
are a colon separated username and password.
-P attribute Add Basic Proxy Authentication, the attributes
are a colon separated username and password.
-X proxy:port Proxyserver and port number to use
-V Print version number and exit
-k Use HTTP KeepAlive feature
-d Do not show percentiles served table.
-S Do not show confidence estimators and warnings.
-g filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-h Display usage information (this message)
鍙傛暟浼楀錛屼竴鑸垜浠敤鍒扮殑鏄?n 鍜?c
渚嬪錛?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> ./ab -c 1000 -n 100 http://www.vpser.net/index.php
榪欎釜琛ㄧず鍚屾椂澶勭悊1000涓姹傚茍榪愯100嬈ndex.php鏂囦歡.
鍥涖丼iege
涓嬈懼紑婧愮殑鍘嬪姏嫻嬭瘯宸ュ叿錛屽彲浠ユ牴鎹厤緗涓涓猈EB绔欑偣榪涜澶氱敤鎴風殑騫跺彂璁塊棶錛岃褰曟瘡涓敤鎴鋒墍鏈夎姹傝繃紼嬬殑鐩稿簲鏃墮棿錛屽茍鍦ㄤ竴瀹氭暟閲忕殑騫跺彂璁塊棶涓嬮噸澶嶈繘琛屻?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> 瀹樻柟錛?a style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://www.joedog.org/
Siege涓嬭澆錛?a style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; color: #3e62a6; outline-width: 0px; outline-style: initial; outline-color: initial; ">http://soft.vpser.net/test/siege/siege-2.67.tar.gz
瑙e帇錛?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> # tar -zxf siege-2.67.tar.gz
榪涘叆瑙e帇鐩綍錛?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> # cd siege-2.67/
瀹夎錛?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> #./configure ; make
#make install
浣跨敤
siege -c 200 -r 10 -f example.url
-c鏄茍鍙戦噺錛?r鏄噸澶嶆鏁般?url鏂囦歡灝辨槸涓涓枃鏈紝姣忚閮芥槸涓涓猽rl錛屽畠浼氫粠閲岄潰闅忔満璁塊棶鐨勩?/p>
example.url鍐呭:
http://www.licess.cn
http://www.vpser.net
http://soft.vpser.net
緇撴灉璇存槑
Lifting the server siege… done.
Transactions: 3419263 hits //瀹屾垚419263嬈″鐞?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> Availability: 100.00 % //100.00 % 鎴愬姛鐜?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> Elapsed time: 5999.69 secs //鎬誨叡鐢ㄦ椂
Data transferred: 84273.91 MB //鍏辨暟鎹紶杈?4273.91 MB
Response time: 0.37 secs //鐩稿簲鐢ㄦ椂1.65縐掞細鏄劇ず緗戠粶榪炴帴鐨勯熷害
Transaction rate: 569.91 trans/sec //鍧囨瘡縐掑畬鎴?569.91 嬈″鐞嗭細琛ㄧず鏈嶅姟鍣ㄥ悗
Throughput: 14.05 MB/sec //騫沖潎姣忕浼犻佹暟鎹?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> Concurrency: 213.42 //瀹為檯鏈楂樺茍鍙戞暟
Successful transactions: 2564081 //鎴愬姛澶勭悊嬈℃暟
Failed transactions: 11 //澶辮觸澶勭悊嬈℃暟
Longest transaction: 29.04 //姣忔浼犺緭鎵鑺辨渶闀挎椂闂?br style="padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " /> Shortest transaction: 0.00 //姣忔浼犺緭鎵鑺辨渶鐭椂闂?/p>