欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

使用Apache ab工具對Apache服務(wù)器進(jìn)行簡單的壓力測試

 更新時間:2016年03月04日 15:53:29   作者:傲雪星楓  
這篇文章主要介紹了使用Apache ab工具對Apache服務(wù)器進(jìn)行簡單的壓力測試的方法,文中還對如何查看當(dāng)前Apache的連接數(shù)的方法作了介紹,需要的朋友可以參考下

1.安裝ab命令

sudo apt-get install apache2-utils 

2.ab命令參數(shù)說明

Usage: ab [options] [http[s]://]hostname[:port]/path 
Options are:  
  

//總的請求數(shù)  
-n requests Number of requests to perform 
 
//一次同時并發(fā)的請求數(shù) 總的請求數(shù)(n)=次數(shù)*一次并發(fā)數(shù)(c)  
-c concurrency Number of multiple requests to make 

-n requests Number of requests to perform
//在測試會話中所執(zhí)行的請求個數(shù)(本次測試總共要訪問頁面的次數(shù))。默認(rèn)時,僅執(zhí)行一個請求。
-c concurrency Number of multiple requests to make
//一次產(chǎn)生的請求個數(shù)(并發(fā)數(shù))。默認(rèn)是一次一個。
-t timelimit Seconds to max. wait for responses
//測試所進(jìn)行的最大秒數(shù)。其內(nèi)部隱含值是-n 50000。它可以使對服務(wù)器的測試限制在一個固定的總時間以內(nèi)。默認(rèn)時,沒有時間限制。
-p postfile File containing data to POST
//包含了需要POST的數(shù)據(jù)的文件,文件格式如“p1=1&p2=2”.使用方法是 -p 111.txt 。 (配合-T)
-T content-type Content-type header for POSTing
//POST數(shù)據(jù)所使用的Content-type頭信息,如 -T “application/x-www-form-urlencoded” 。 (配合-p)
-v verbosity How much troubleshooting info to print
//設(shè)置顯示信息的詳細(xì)程度 – 4或更大值會顯示頭信息, 3或更大值可以顯示響應(yīng)代碼(404, 200等), 2或更大值可以顯示警告和其他信息。 -V 顯示版本號并退出。
-w Print out results in HTML tables
//以HTML表的格式輸出結(jié)果。默認(rèn)時,它是白色背景的兩列寬度的一張表。
-i Use HEAD instead of GET
// 執(zhí)行HEAD請求,而不是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. -C “c1=1234,c2=2,c3=3″ (repeatable)
//-C cookie-name=value 對請求附加一個Cookie:行。 其典型形式是name=value的一個參數(shù)對。此參數(shù)可以重復(fù),用逗號分割。
提示:可以借助session實(shí)現(xiàn)原理傳遞 JSESSIONID參數(shù), 實(shí)現(xiàn)保持會話的功能,如
-C ” c1=1234,c2=2,c3=3, JSESSIONID=FF056CD16DA9D71CB131C1D56F0319F8″ 。
-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.
//-P proxy-auth-username:password 對一個中轉(zhuǎn)代理提供BASIC認(rèn)證信任。用戶名和密碼由一個:隔開,并以base64編碼形式發(fā)送。無論服務(wù)器是否需要(即, 是否發(fā)送了401認(rèn)證需求代碼),此字符串都會被發(fā)送。
-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)
//-attributes 設(shè)置屬性的字符串. 缺陷程序中有各種靜態(tài)聲明的固定長度的緩沖區(qū)。另外,對命令行參數(shù)、服務(wù)器的響應(yīng)頭和其他外部輸入的解析也很簡單,這可能會有不良后果。它沒有完整地實(shí)現(xiàn) HTTP/1.x; 僅接受某些'預(yù)想'的響應(yīng)格式。 strstr(3)的頻繁使用可能會帶來性能問題,即你可能是在測試ab而不是服務(wù)器的性能。

3.運(yùn)行

 ab -n 100 -c 10 http://www.dbjr.com.cn/ 

對 http://www.dbjr.com.cn/ 進(jìn)行100次請求,10個并發(fā)請求壓力測試結(jié)果。

Server Software: lighttpd/1.4.20 
Server Hostname: www.dbjr.com.cn 
Server Port: 80 
 
Document Path: / 
Document Length: 2095 bytes 
 
Concurrency Level: 10 
 
//整個測試持續(xù)的時間  
Time taken for tests: 3.303 seconds 
 
//完成的請求數(shù)量  
Complete requests: 100 
Failed requests: 0 
Write errors: 0 
Total transferred: 235200 bytes 
HTML transferred: 209500 bytes 
 
//平均每秒處理30個請求  
Requests per second: 30.27 [#/sec] (mean) 
 
//平均每個請求處理時間為330毫秒 注:這里將一次10個并發(fā)請求看成一個整體  
Time per request: 330.335 [ms] (mean) 
 
//平均每個并發(fā)請求處理 時間 為33毫秒  
Time per request: 33.034 [ms] (mean, across all concurrent requests) 
Transfer rate: 69.53 [Kbytes/sec] received 
 
Connection Times (ms) 
min mean[+/-sd] median max 
Connect: 51 170 35.9 178 230 
Processing: 60 153 64.5 121 263 
Waiting: 55 148 64.4 115 258 
Total: 235 322 59.9 299 437 
 
Percentage of the requests served within a certain time (ms) 
 
//在這100個請求中有50%在299毫秒內(nèi)完成  
50% 299 
 
//在這100個請求中有66%在312毫秒內(nèi)完成  
66% 312 
75% 383 
80% 412 
90% 431 
95% 432 
98% 436 
99% 437 
100% 437 (longest request) 

PS:如何查看當(dāng)前Apache的連接數(shù)
查看了連接數(shù)和當(dāng)前的連接數(shù)

netstat -ant | grep $ip:80 | wc -l  
netstat -ant | grep $ip:80 | grep EST | wc -l  

查看IP訪問次數(shù)

netstat -nat|grep ":80"|awk '{print $5}' |awk -F: '{print $1}' | sort| uniq -c|sort -n 

Linux命令:

netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' 
watch "netstat -n | awk '/^tcp/ {++S[\$NF]} END {for(a in S) print a, S[a]}'" 

返回結(jié)果示例:

LAST_ACK 5
SYN_RECV 30
ESTABLISHED 1597
FIN_WAIT1 51
FIN_WAIT2 504
TIME_WAIT 1057

說明:
SYN_RECV 表示正在等待處理的請求數(shù);
ESTABLISHED 表示正常數(shù)據(jù)傳輸狀態(tài);
TIME_WAIT 表示處理完畢,等待超時結(jié)束的請求數(shù);
FIN_WAIT1 表示server端主動要求關(guān)閉tcp連接;
FIN_WAIT2 表示客戶端中斷連接;
LAST_ACK 關(guān)閉一個TCP連接需要從兩個方向上分別進(jìn)行關(guān)閉,雙方都是通過發(fā)送FIN來表示單方向數(shù)據(jù)的關(guān)閉,當(dāng)通信雙方發(fā)送了最后一個FIN的時候,發(fā)送方此時處于LAST_ACK狀態(tài),當(dāng)發(fā)送方收到對方的確認(rèn)(Fin的Ack確認(rèn))后才真正關(guān)閉整個TCP連接;

相關(guān)文章

  • apache2.2 支持.net 3.5的設(shè)置方法

    apache2.2 支持.net 3.5的設(shè)置方法

    一直在為asp.net程序的打包發(fā)布頭疼,甚至想過把程序裝好放到vware里!但為什么一直沒有想到apache這位大哥呢?!以至今天才google apache+asp.net。
    2009-10-10
  • centos 6.8命令行下使用pptpsetup進(jìn)行pptp撥號的實(shí)現(xiàn)方法

    centos 6.8命令行下使用pptpsetup進(jìn)行pptp撥號的實(shí)現(xiàn)方法

    centos 6.8 命令行下可使用pptpsetup進(jìn)行pptp撥號,首先安裝ppp,pptp和pptp-setup三個包,使用pptpsetup進(jìn)行連接,下面給大家介紹的非常詳細(xì),感興趣的朋友一起看看吧
    2016-10-10
  • opensips源代碼安裝與配置的技巧方法

    opensips源代碼安裝與配置的技巧方法

    本篇文章小編為大家介紹,opensips源代碼安裝與配置的技巧方法。需要的朋友參考下
    2013-04-04
  • 你必須知道Linux系統(tǒng)的七種優(yōu)勢

    你必須知道Linux系統(tǒng)的七種優(yōu)勢

    你必須知道Linux系統(tǒng)的七種優(yōu)勢,越來越多的電腦用戶開始使用 Linux進(jìn)行辦公、學(xué)習(xí),這篇文章主要介紹了Linux系統(tǒng)的多種優(yōu)勢,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-03-03
  • Ubuntu編譯內(nèi)核模塊,內(nèi)容體現(xiàn)系統(tǒng)日志中

    Ubuntu編譯內(nèi)核模塊,內(nèi)容體現(xiàn)系統(tǒng)日志中

    大家好,本篇文章主要講的是Ubuntu編譯內(nèi)核模塊,內(nèi)容體現(xiàn)系統(tǒng)日志中,感興趣的同學(xué)趕快來看一看吧,對你有幫助的話記得收藏一下,方便下次瀏覽
    2021-12-12
  • CentOS7 systemd添加自定義系統(tǒng)服務(wù)的方法

    CentOS7 systemd添加自定義系統(tǒng)服務(wù)的方法

    這篇文章主要介紹了CentOS7 systemd添加自定義系統(tǒng)服務(wù),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2019-03-03
  • 解決hadoop啟動報錯ERROR: Attempting to operate on hdfs namenode as root的方法

    解決hadoop啟動報錯ERROR: Attempting to operate 

    這篇文章主要介紹了解決hadoop啟動報錯ERROR: Attempting to operate on hdfs namenode as root的方法,hadoop-3.1.0啟動hadoop集群時還有可能可能會報如下錯誤,需要的朋友可以參考下
    2023-03-03
  • 教你使用Apache搭建Http下載服務(wù)器

    教你使用Apache搭建Http下載服務(wù)器

    這篇文章主要介紹了使用Apache搭建Http下載服務(wù)器的詳細(xì)過程,Apache2默認(rèn)采用的是80端口號,因此直接通過公網(wǎng)ip或域名就能訪問,需要的朋友可以參考下
    2022-10-10
  • Linux alias命令編寫

    Linux alias命令編寫

    這篇文章主要介紹了Linux alias命令編寫,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-08-08
  • 詳解linux SSH登錄流程

    詳解linux SSH登錄流程

    本篇文章通過秘匙生成等問題詳細(xì)分析了linux里SSH登錄流程,有需要的朋友參考一下吧。
    2017-12-12

最新評論