雲伺服器 效能測試之web壓力測試
前言:現在雲伺服器是主流,成了許多中小型公司的首選伺服器,但是雲伺服器都是虛擬機器,所以效能是一大疑問,這裡就開始簡單介紹雲伺服器的效能測試,雲端web伺服器的壓力測試。
Linux下常用的四款Web伺服器壓力測試工具(http_load、webbench、ab、siege),這裡採用apache自帶的ab工具來測試。
1,開始安裝apache
前期準備:
yum install gcc* -y
yum install libtool* -y
1.1,去官網下載
解壓tar -zxvf httpd-2.2.6.tar.gz,完成之後,會在當前目錄出現一個httpd-2.2.6目錄,然後順序執行如下命令改名:
tar -zxvf httpd-2.2.6.tar.gz
mv httpd-2.2.6 apache
cd apache
設定安裝引數,命令如下:
./configure –prefix=/usr/local/apache2 –enable-module=so –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util
[root@bwebhttpd-2.4.12]# ./configure --prefix=/usr/local/apache2 --enable-module=so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... configure: error: the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.
[root@bwebhttpd-2.4.12]#
1.2 解決apr not found問題
[root@bwebdata]# cd apr-1.4.6
[root@bwebapr-1.4.6]# ./configure --prefix=/usr/local/apr
[root@bwebapr-1.4.6]# make
[root@bwebapr-1.4.6]# make install
1.3.解決APR-util not found問題
需要安裝apr-util元件:
[root@bwebdata]# wget http://apache.fayea.com//apr/apr-util-1.5.4.tar.gz
[root@bwebdata]# tar -xvf apr-util-1.5.4.tar.gz
[root@bwebdata]# cd apr-util-1.5.4
[root@bwebapr-util-1.5.4]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
[root@bwebapr-util-1.5.4]# make
[root@bwebapr-util-1.5.4]# make install
或者 yum install -y apr-util*
1.4 configure: error: pcre-config for libpcre not found問題
../configure添加了–with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util仍提示 configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/的錯誤
檢視下是否有pcre引數
[[email protected]]# ./configure -help | grep pcre
–with-pcre=PATH Use external PCRE library
[[email protected]]#
[root@bwebdata]# wget http://ftp.exim.llorien.org/pcre/pcre-8.36.tar.gz
--這裡因為下載失敗,所以重新去csdn資源庫下載了pcre的zip包
[root@bwebdata]# unzip pcre-8.36.zip
[root@bwebdata]# cd pcre-8.36
[root@bwebpcre-8.36]# ./configure --prefix=/usr/local/pcre
[root@bwebpcre-8.36]# make
[root@bwebpcre-8.36]# make install
或者 yum安裝也可以:
[root@bwebhttpd-2.4.12]# yum install -y pcre*
必要的元件安裝完了,我們可以繼續原始碼編譯apache了
2 最後編譯安裝apache
[root@bwebhttpd-2.4.12]# ./configure --prefix=/usr/local/apache2 --enable-module=so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-included-apr
[root@bwebhttpd-2.4.12]# make
[root@bwebhttpd-2.4.12]# make install
啟動apache
/usr/local/apache2/bin/apachectl start
[[email protected]2.4.12]# /usr/local/apache2/bin/apachectl start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.16.1.4. Set the 'ServerName' directive globally to suppress this message
[[email protected]2.4.12]#
檢視下:
在瀏覽器中輸入地址:http://172.16.1.4/,會顯示如下資訊:
It works!
apache安裝完畢後ab命令存放在apache安裝目錄的bin目錄下。如下:
[[email protected]]# ll /usr/local/apache2/bin
total 2308
-rwxr-xr-x. 1 root root 80799 Jun 4 12:48 ab
-rwxr-xr-x. 1 root root 3438 Jun 4 12:43 apachectl
-rwxr-xr-x. 1 root root 23515 Jun 4 12:43 apxs
-rwxr-xr-x. 1 root root 12277 Jun 4 12:48 checkgid
-rwxr-xr-x. 1 root root 8925 Jun 4 12:43 dbmmanage
-rw-r--r--. 1 root root 1073 Jun 4 12:43 envvars
-rw-r--r--. 1 root root 1073 Jun 4 12:43 envvars-std
-rwxr-xr-x. 1 root root 20200 Jun 4 12:48 fcgistarter
-rwxr-xr-x. 1 root root 66594 Jun 4 12:48 htcacheclean
-rwxr-xr-x. 1 root root 40674 Jun 4 12:48 htdbm
-rwxr-xr-x. 1 root root 22263 Jun 4 12:48 htdigest
-rwxr-xr-x. 1 root root 41346 Jun 4 12:48 htpasswd
-rwxr-xr-x. 1 root root 1933978 Jun 4 12:48 httpd
-rwxr-xr-x. 1 root root 19488 Jun 4 12:48 httxt2dbm
-rwxr-xr-x. 1 root root 21908 Jun 4 12:48 logresolve
-rwxr-xr-x. 1 root root 34593 Jun 4 12:48 rotatelogs
[[email protected]]#
3,ab壓測結果如下:
3.1 微軟雲壓測
ab壓測結果如下:
[[email protected]2.4.12]# /usr/local/apache2/bin/ab -c 1000 -n 1000 http://127.0.0.1/phpinfo.php
This is ApacheBench, Version 2.3 <$Revision: 1638069 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to 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
Completed 1000 requests
Finished 1000 requests
Server Software: Apache/2.4.12
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /phpinfo.php
Document Length: 209 bytes
Concurrency Level: 1000
Time taken for tests: 0.676 seconds
Complete requests: 1000
Failed requests: 0
Non-2xx responses: 1000
Total transferred: 387000 bytes
HTML transferred: 209000 bytes
Requests per second: 1478.80 [#/sec] (mean)
Time per request: 676.224 [ms] (mean)
Time per request: 0.676 [ms] (mean, across all concurrent requests)
Transfer rate: 558.88 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 4 28 20.1 14 65
Processing: 4 90 155.1 18 608
Waiting: 3 87 156.2 13 608
Total: 16 118 169.9 29 665
Percentage of the requests served within a certain time (ms)
50% 29
66% 52
75% 266
80% 267
90% 270
95% 662
98% 663
99% 663
100% 665 (longest request)
[[email protected]2.4.12]
[[email protected]2.4.12]# /usr/local/apache2/bin/ab -k -c 1000 -n 1000 http://127.0.0.1/phpinfo.php
This is ApacheBench, Version 2.3 <$Revision: 1638069 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to 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
Completed 1000 requests
Finished 1000 requests
Server Software: Apache/2.4.12
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /phpinfo.php
Document Length: 209 bytes
Concurrency Level: 1000
Time taken for tests: 5.136 seconds
Complete requests: 1000
Failed requests: 125
(Connect: 0, Receive: 0, Length: 125, Exceptions: 0)
Non-2xx responses: 885
Keep-Alive requests: 877
Total transferred: 374749 bytes
HTML transferred: 184965 bytes
Requests per second: 194.69 [#/sec] (mean)
Time per request: 5136.408 [ms] (mean)
Time per request: 5.136 [ms] (mean, across all concurrent requests)
Transfer rate: 71.25 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 18 25.2 0 73
Processing: 1 1342 2013.5 12 5060
Waiting: 1 728 1499.3 11 5060
Total: 1 1360 2023.8 45 5130
Percentage of the requests served within a certain time (ms)
50% 45
66% 1137
75% 2201
80% 4997
90% 5005
95% 5128
98% 5129
99% 5129
100% 5130 (longest request)
[[email protected]2.4.12]#
3.2 華為雲壓測
[[email protected] httpd-2.4.12]# /usr/local/apache2/bin/ab -c 1000 -n 1000 http://127.0.0.1/phpinfo.php
This is ApacheBench, Version 2.3 <$Revision: 1638069 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to 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
Completed 1000 requests
Finished 1000 requests
Server Software: Apache/2.4.12
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /phpinfo.php
Document Length: 209 bytes
Concurrency Level: 1000
Time taken for tests: 0.642 seconds
Complete requests: 1000
Failed requests: 0
Non-2xx responses: 1000
Total transferred: 387000 bytes
HTML transferred: 209000 bytes
Requests per second: 1558.26 [#/sec] (mean)
Time per request: 641.742 [ms] (mean)
Time per request: 0.642 [ms] (mean, across all concurrent requests)
Transfer rate: 588.91 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 16 11.5 8 30
Processing: 8 101 170.6 20 609
Waiting: 2 98 171.8 18 609
Total: 15 116 176.2 25 634
Percentage of the requests served within a certain time (ms)
50% 25
66% 45
75% 231
80% 234
90% 238
95% 632
98% 634
99% 634
100% 634 (longest request)
[[email protected] httpd-2.4.12]#
以下是加帶了-k引數。表示不釋放連線:
[[email protected] httpd-2.4.12]# /usr/local/apache2/bin/ab -k -c 1000 -n 1000 http://127.0.0.1/phpinfo.php
This is ApacheBench, Version 2.3 <$Revision: 1638069 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to 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
Completed 1000 requests
Finished 1000 requests
Server Software: Apache/2.4.12
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /phpinfo.php
Document Length: 209 bytes
Concurrency Level: 1000
Time taken for tests: 6.265 seconds
Complete requests: 1000
Failed requests: 100
(Connect: 0, Receive: 0, Length: 100, Exceptions: 0)
Non-2xx responses: 910
Keep-Alive requests: 900
Total transferred: 385300 bytes
HTML transferred: 190190 bytes
Requests per second: 159.62 [#/sec] (mean)
Time per request: 6264.951 [ms] (mean)
Time per request: 6.265 [ms] (mean, across all concurrent requests)
Transfer rate: 60.06 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 10 12.9 0 29
Processing: 0 1425 2150.0 8 6235
Waiting: 0 934 1811.3 8 6235
Total: 0 1434 2155.1 8 6261
Percentage of the requests served within a certain time (ms)
50% 8
66% 1402
75% 2419
80% 3416
90% 5004
95% 6260
98% 6261
99% 6261
100% 6261 (longest request)
[[email protected] httpd-2.4.12]#
3.3 idc機房測試
[[email protected]_web~]# /usr/bin/ab -k -c 1000 -n 1000 http://127.0.0.1/phpinfo.php
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to 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
Completed 1000 requests
Finished 1000 requests
Server Software: Apache/2.2.15
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /phpinfo.php
Document Length: 286 bytes
Concurrency Level: 1000
Time taken for tests: 0.341 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Non-2xx responses: 1000
Keep-Alive requests: 0
Total transferred: 466000 bytes
HTML transferred: 286000 bytes
Requests per second: 2929.00 [#/sec] (mean)
Time per request: 341.414 [ms] (mean)
Time per request: 0.341 [ms] (mean, across all concurrent requests)
Transfer rate: 1332.92 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 23 41 9.9 42 57
Processing: 78 177 65.4 178 274
Waiting: 72 176 65.4 177 274
Total: 120 218 72.0 234 316
Percentage of the requests served within a certain time (ms)
50% 234
66% 278
75% 288
80% 294
90% 307
95% 312
98% 315
99% 316
100% 316 (longest request)
[[email protected]_web~]#
相關推薦
雲伺服器 效能測試之web壓力測試
前言:現在雲伺服器是主流,成了許多中小型公司的首選伺服器,但是雲伺服器都是虛擬機器,所以效能是一大疑問,這裡就開始簡單介紹雲伺服器的效能測試,雲端web伺服器的壓力測試。 Linux下常用的四款Web伺服器壓力測試工具(http_load、webbench、a
Visual Studio 單元測試之三---壓力測試
我們都知道大名鼎鼎的LoadRuner,但是很少有人知道Visual Studio自帶的Test也可以做些簡單的壓力測試,下面我們就介紹一下如何利用Visual Studio進行壓力測試。 本文會自動略去上篇中提到過的相關概念、方法。本文的例子可以使用下面的連
Web項目之站點壓力測試
Web上線準備 Web服務Nginx壓力測 本教程在個人網站、51cto博客上同步更新。手打不易請支持原創。Webbench為著名的網站壓力測試工具,由Lionbrdge公司開發,能測試處在相同硬件上,不同服務的性能以及不同硬件上同一個服務的運行狀況。同樣的還有loadruner等.這裏使用Webbe
測者的效能測試手冊:Web壓力測試工具webbench
webbench最多可以模擬3萬個併發連線去測試網站的負載能力,個人感覺要比Apache自帶的ab壓力測試工具好,安裝使用也特別方便。 1、適用系統:Linux 2、編譯安裝: wget http://www.ha97.com/code/webbench-1.5.tar.gz
在window下如何利用apache web伺服器的ab命令進行壓力測試?
ab 的全稱是 ApacheBench , 是 Apache 附帶的一個小工具 , 專門用於 HTTP Server 的 benchmark testing , 可以同時模擬多個併發請求。前段時間看到公司的開發人員也在用它作一些測試,看起來也不錯,很簡
效能、負載、壓力測試——從效能測試角度理解系統開發
引言 最近,由於舊機器下線,我對過去部署的一些服務做了遷移,順帶對新部署的服務做了一個簡單的效能測試。在實施過程中,我發現自己對很多效能指標的理解很不清晰,對於併發數、壓力、吞吐量、延遲等概念,通常是以望文生義的方式使用。對於系統應該關注什麼樣的效能指標,認識也不完整。為此,我閱讀了wiki百科以及一些部落
軟體測試之Web系統常用的測試方法總結
Web系統常用的測試方法: 1.頁面連結檢查:每一個連結是否都有對應的頁面,並且頁面之間切換正確。 2.功能相關性檢查:刪除/增加一項會不會對其他項產生影響,如果產生影響,這些影響是否都正確,常見的情況,增加某個資料記錄以後,如果該資料記錄某個欄位內容較長,可能會在查詢的
測者的性能測試手冊:Web壓力測試工具webbench
padding req adding 說明 apache war add com 系統 webbench最多可以模擬3萬個並發連接去測試網站的負載能力,個人感覺要比Apache自帶的ab壓力測試工具好,安裝使用也特別方便。 1、適用系統:Linux 2、編譯安裝:
WEB介面測試之Jmeter介面測試自動化之一
1、開啟jmeter 開源版本和可執行版本均可在Apache官方網站上下載到,解壓後開啟bin目錄下的jmeter.bat檔案,即打開了使用者介面: 2、新增相關元件 2.1、新建執行
WEB介面測試之Jmeter介面測試自動化之四 持續構建
Jmeter是壓力測試、介面測試工具,Ant是基於Java的構建工具,具有跨平臺的作用,jenkins是持續整合工具。將這三者結合起來可以搭建一套webservice介面測試的持續構建環境。 1、安裝JDK,配置java環境變數(略過) 2、安裝Jmeter,這裡
【Apache】從Apache官網下載windows版apache伺服器,並用AB進行壓力測試
1、下載穩定版2.2.31 http://httpd.apache.org/ 2.2.*和2.4.*區別? httpd-2.2.x(prefork) httpd-2.4.x(event) 編譯時可以使用--with-mpm=prefork手動指定
使用web壓力測試工具 siege 和 ab 傳送帶json資料的post請求
首先我們的json字串直接放在檔案postfile中 在我們使用json格式時,注意一定要將headers的Content_type設定為application/json,否則伺服器端可能不能正確識別傳送的body格式。 siege 經過測試的版本為3.02和3.
Web壓力測試工具Webbench
Web壓力測試工具webbench webbench最多可以模擬3萬個併發連線去測試網站的負載能力,個人感覺要比Apache自帶的ab壓力測試工具好,安裝使用也特別方便。 1、適用系統:Linux 2、編譯安裝: wget http://ww
運用Jmeter做Java Web壓力測試例項
ROCCOffline Web例項Local Server URL:http://roccoffline.easternphoenix.com流程1.UserLogin 2.Choose BMU 3.SyncLibraryData 4.CreatePerform 5.
小白日記36:kali滲透測試之Web滲透-手動漏洞挖掘(二)-突破身份認證,作業系統任意命令執行漏洞
手動漏洞挖掘 ###################################################################################### 手動漏洞挖掘
WEB UI自動化測試之AutoMagic自動化測試平臺開源
作者介紹:網名: Ray介紹:笑起來像個孩子,冷起來是個迷。部落格:http://www.cnblogs.com/tsbc/2018年3月29日,Ray說準備把AutoMagic自動化測試管理平臺開源了!!!這是個好訊息,因為AutoMagic在其所在的企業中實踐應用,沉澱了
轉(二):WEB介面測試之Jmeter介面測試自動化(資料分離)
通過逐個錄入的方式,好不容易將需要測試幾十個介面的300多個測試用例錄入sampler-http請求中,固定的測試環境跑起來也還感覺良好。不料在新伺服器環境中跑用例時,問題來了:修改引數維護指令碼等成本太大! 指令碼引數是寫死的,修改起來得一個個請求開啟來依次輸入引
小白日記30:kali滲透測試之Web滲透-掃描工具-Skipfish
WEB滲透-skipfish Skipfish是一個命令列模式,以C語言編寫的積極的Web應用程式的安全性偵察工具,沒有代理模式。 它準備了一個互動為目標的網站的站點地圖進行一個遞迴爬網和基於字典的探
小白日記29:kali滲透測試之Web滲透-掃描工具-Vega
WEB掃描工具-Vega 純圖形化介面,Java編寫的開源web掃描器。兩種工作模式:掃描模式和代理模式【主流掃描功能】。用於爬站。處理表單,注入測試等。支援SSL:http://vega/ca.c
WEB壓力測試工具 ab 及 Siege 介紹
ab是Apache超文字傳輸協議(HTTP)的效能測試工具。其設計意圖是描繪當前所安裝的Apache的執行效能,主要是顯示你安裝的Apache每秒可以處理多少個請求 。ab做重複壓力測試不錯,但是每次只能測試一個連結,如何測試一組連結可能需要你自己修改ab的原始碼,還好程式碼