国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > Apache > 正文

使用Apache ab進行http性能測試

2024-08-27 18:25:39
字體:
供稿:網(wǎng)友

Mac自帶了Apache環(huán)境

打開“終端(terminal)”,輸入 sudo apachectl -v,(可能需要輸入機器秘密)。如下顯示Apache的版本

接著輸入 sudo apachectl start,這樣Apache就啟動了。打開Safari瀏覽器地址欄輸入 “http://localhost”,可以看到內(nèi)容為“It works!”的頁面。其位于“/Library(資源庫)/WebServer/Documents/”下,這就是Apache的默認根目錄。

Apache的安裝目錄在:/etc/apache2/,etc默認是隱藏的。有三種方式查看:

1、dock下右鍵Finder,選擇"前往文件夾",輸入"/etc"
2、在finder下----》前往---》前往文件夾,然后輸入/etc
3、可以在terminal 輸入 "open /etc"

windows可以去http://httpd.apache.org/download.cgi下載,或者從命令行安裝

1. 安裝apache

     sudo port install apache2

啟動apache: sudo apachectl start

2.  brew install pcre

3. wget http://ftp.yz.yamagata-u.ac.jp/pub/network/apache//httpd/httpd-2.4.4.tar.bz2

   (1)解壓
   (2) ./configure
   (3) make && make install
   (4) sudo cp support/ab /usr/sbin  

4. ab -n 1000 -c 10 http://localhost:3000/  最后這個斜杠不能少

這個ab -n1000 -c10 http://localhost:3000/命令,在window系統(tǒng)下,需要先用cd命令定位到你的apache安裝目錄的bin文件夾。。。 

ab的參數(shù)說明

-n  需要執(zhí)行的請求次數(shù)

-c  并發(fā)的數(shù)量

-t   等待返回的最長時間

-b  TCP收發(fā)緩沖區(qū)的大小,單位(byte)

-p 使用post (同時需要定義-T參數(shù))

-u 使用put (同時需要定義-T參數(shù))

-T content-type, 例如application/x-www-form-urlencoded, 默認為text/plain

-w 把結(jié)果打印在html的表格里

-x  表格的屬性

-y  tr行屬性

-z  td列屬性

-C 設(shè)置cookie 例如Apach=1234

-H header行, 例如Accept-Encoding:gzip

-k 是否標示位HTTP Keep Alive

測試結(jié)果:

This is ApacheBench, Version 2.3 <$Revision: 1663405 $>Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/Licensed to The Apache Software Foundation, http://www.apache.org/Benchmarking localhost (be patient)Completed 100 requestsCompleted 200 requestsCompleted 300 requestsCompleted 400 requestsCompleted 500 requestsCompleted 600 requestsCompleted 700 requestsCompleted 800 requestsCompleted 900 requestsCompleted 1000 requestsFinished 1000 requestsServer Software:  Server Hostname:  localhostServer Port:   3000Document Path:   /Document Length:  14 bytesConcurrency Level:  10Time taken for tests: 0.323 secondsComplete requests:  1000Failed requests:  0Total transferred:  115000 bytesHTML transferred:  14000 bytesRequests per second: 3097.37 [#/sec] (mean)Time per request:  3.229 [ms] (mean)Time per request:  0.323 [ms] (mean, across all concurrent requests)Transfer rate:   347.85 [Kbytes/sec] receivedConnection Times (ms)    min mean[+/-sd] median maxConnect:  0 0 0.1  0  1Processing:  1 3 2.2  2  16Waiting:  1 3 2.2  2  16Total:   1 3 2.2  2  16Percentage of the requests served within a certain time (ms) 50%  2 66%  3 75%  3 80%  4 90%  5 95%  7 98%  13 99%  15 100%  16 (longest request)
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 双辽市| 泰来县| 平阴县| 泸水县| 东源县| 富宁县| 全南县| 那坡县| 宾阳县| 波密县| 开远市| 陆川县| 奇台县| 台安县| 甘谷县| 竹北市| 莫力| 昌都县| 中山市| 扎赉特旗| 贵阳市| 安庆市| 邢台县| 浦北县| 赞皇县| 闽侯县| 昭觉县| 舒兰市| 仙桃市| 临潭县| 巴林左旗| 新田县| 丹寨县| 阿合奇县| 上饶县| 金坛市| 麻阳| 监利县| 延吉市| 邯郸市| 普定县|