使ApacheBench支持multi-url

来源:https://www.cnblogs.com/wangqingyong/archive/2019/06/24/11076809.html
-Advertisement-
Play Games

[TOC] 由於標準的ab只支持對單個uri進行壓測,不滿足實際需要,故做以下修改,使ab支持multi url。 1、下載Apache httpd相關源碼包以及針對ab工具的patch包 ~~~ wget https://mirrors.tuna.tsinghua.edu.cn/apache/ap ...


目錄

由於標準的ab只支持對單個uri進行壓測,不滿足實際需要,故做以下修改,使ab支持multi-url。

1、下載Apache httpd相關源碼包以及針對ab工具的patch包

wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-1.6.5.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
wget https://mirrors.tuna.tsinghua.edu.cn/apache/httpd/httpd-2.4.37.tar.gz
wget https://github.com/philipgloyne/apachebench-for-multi-url/archive/master.zip

註:httpd依賴於apr和apr-util

2、編譯安裝apr

tar -zxf apr-1.6.5.tar.gz
cd apr-1.6.5
./configure --prefix=/usr/local/apr
make && make  install

3、編譯安裝apr-util

tar -zxf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install

4、替換httpd源碼裡面的ab.c文件

unzip master.zip
tar -zxf httpd-2.4.37.tar.gz
\cp ./apachebench-for-multi-url-master/ab.c ./httpd-2.4.37/support/

5、編譯安裝httpd

cd httpd-2.4.37
./configure                             \
    --with-apr=/usr/local/apr           \
    --with-apr-util=/usr/local/apr-util \
    --prefix=/usr/local/apache          \
    --sysconfdir=/etc/httpd24           \
    --enable-so                         \
    --enable-ssl                        \
    --enable-cgi                        \
    --enable-rewrite                    \
    --with-zlib                         \
    --with-pcre                         \
    --with-mpm=prefork                  \
    --enable-modules=most               \
    --enable-mpms-shared=all  

make && make install

6、驗證結果

#/usr/local/apache/bin/ab -h
Usage: /usr/local/apache/bin/ab [options] [http[s]://]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
    -b windowsize   Size of TCP send/receive buffer, in bytes
    -p postfile     File containing data to POST. Remember also to set -T
    -u putfile      File containing data to PUT. Remember also to set -T
    -T content-type Content-type header for POSTing, eg.
                    'application/x-www-form-urlencoded'
                    Default is 'text/plain'
    -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
    -r              Don't exit on socket receive errors.
    -h              Display usage information (this message)
    -L              Use URL list file name, eg. url.txt
    -Z ciphersuite  Specify SSL/TLS cipher suite (See openssl ciphers)
    -f protocol     Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)

可以看到ab已經支持-L參數(上面幫助信息的倒數第3行),大功告成。


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 在C#的List集合中有時候需要獲取指定索引位置範圍的元素對象來組成一個新的List集合,此時就可使用到List集合的擴展方法GetRange方法,GetRange方法專門用於獲取List集合指定範圍內的所有值,GetRange方法簽名為List<T> GetRange(int index, int ...
  • 在C#的List集合操作中,有時候需要判斷元素對象在List集合中第一次出現的索引位置信息,此時需要使用到List集合的IndexOf方法來判斷,如果元素存在List集合中,則IndexOf方法返回所在的索引位置信息,如果不存在則返回-1,IndexOf方法簽名為int IndexOf(T item ...
  • 本文只總結一些常用的用法,更詳細的說明見 man uniq 和 uniq help 。 uniq命令 uniq 命令主要用於去重。 需要註意的是,不相鄰的行不算重覆值。 語法格式 OPTION | 說明 | c | 統計出現的次數 d | 只顯示被計算為重覆的行 D | 顯示所有被計算為重覆的行 c ...
  • [TOC] 第一部分: 虛擬機創建、系統安裝、Linux歷史介紹 1.超級用戶(管理員用戶)提示符是 ,普通用戶提示符是` 2. linux關機重啟的命令有哪些 ? 3.bash是什麼? 4.bash特性, 常見的bash特性有哪些? 5.網卡的配置文件路徑什麼? 6.echo命令的功能是什麼? 7 ...
  • Linux的/proc/sys/fs/file max決定了當前內核可以打開的最大的文件句柄數。 查看當前的值: 這個值在kernel的文檔里是這樣描述的: 意思是file max一般為記憶體大小(KB)的10%來計算,如果使用shell,可以這樣計算: 一般我們不需要主動設置這個值,除非這個值確實較 ...
  • 初步區分和理解semaphore(信號量), event(事件), lock/mutex(鎖), condition ...
  • 上一篇博文,我們介紹了LCD RGB控制模式的典型時鐘。那麼這一片我們要詳細的去討論剩下的細節部分。 我們先回顧一下之前的典型時序圖 在這個典型的時序圖裡面,除了上篇博文講述的HSYNC VSYNC VDEN VCLK這幾信號外,我們還能看見諸如HSPW、 VSPW,HBPD、 HFPD,VBPD、 ...
  • 一、安裝使用Docer CE 本文以CentOS 7為例,安裝docker CE版本,docker有兩種版本,社區版本CE和企業版本EE,此處學習研究以CE版本為例, 兩種安裝方式可選:1、使用yum安裝,2、使用腳本自動安裝 系統要求 Docker CE 支持 64 位版本 CentOS 7,並且 ...
一周排行
    -Advertisement-
    Play Games
  • 移動開發(一):使用.NET MAUI開發第一個安卓APP 對於工作多年的C#程式員來說,近來想嘗試開發一款安卓APP,考慮了很久最終選擇使用.NET MAUI這個微軟官方的框架來嘗試體驗開發安卓APP,畢竟是使用Visual Studio開發工具,使用起來也比較的順手,結合微軟官方的教程進行了安卓 ...
  • 前言 QuestPDF 是一個開源 .NET 庫,用於生成 PDF 文檔。使用了C# Fluent API方式可簡化開發、減少錯誤並提高工作效率。利用它可以輕鬆生成 PDF 報告、發票、導出文件等。 項目介紹 QuestPDF 是一個革命性的開源 .NET 庫,它徹底改變了我們生成 PDF 文檔的方 ...
  • 項目地址 項目後端地址: https://github.com/ZyPLJ/ZYTteeHole 項目前端頁面地址: ZyPLJ/TreeHoleVue (github.com) https://github.com/ZyPLJ/TreeHoleVue 目前項目測試訪問地址: http://tree ...
  • 話不多說,直接開乾 一.下載 1.官方鏈接下載: https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 2.在下載目錄中找到下麵這個小的安裝包 SQL2022-SSEI-Dev.exe,運行開始下載SQL server; 二. ...
  • 前言 隨著物聯網(IoT)技術的迅猛發展,MQTT(消息隊列遙測傳輸)協議憑藉其輕量級和高效性,已成為眾多物聯網應用的首選通信標準。 MQTTnet 作為一個高性能的 .NET 開源庫,為 .NET 平臺上的 MQTT 客戶端與伺服器開發提供了強大的支持。 本文將全面介紹 MQTTnet 的核心功能 ...
  • Serilog支持多種接收器用於日誌存儲,增強器用於添加屬性,LogContext管理動態屬性,支持多種輸出格式包括純文本、JSON及ExpressionTemplate。還提供了自定義格式化選項,適用於不同需求。 ...
  • 目錄簡介獲取 HTML 文檔解析 HTML 文檔測試參考文章 簡介 動態內容網站使用 JavaScript 腳本動態檢索和渲染數據,爬取信息時需要模擬瀏覽器行為,否則獲取到的源碼基本是空的。 本文使用的爬取步驟如下: 使用 Selenium 獲取渲染後的 HTML 文檔 使用 HtmlAgility ...
  • 1.前言 什麼是熱更新 游戲或者軟體更新時,無需重新下載客戶端進行安裝,而是在應用程式啟動的情況下,在內部進行資源或者代碼更新 Unity目前常用熱更新解決方案 HybridCLR,Xlua,ILRuntime等 Unity目前常用資源管理解決方案 AssetBundles,Addressable, ...
  • 本文章主要是在C# ASP.NET Core Web API框架實現向手機發送驗證碼簡訊功能。這裡我選擇是一個互億無線簡訊驗證碼平臺,其實像阿裡雲,騰訊雲上面也可以。 首先我們先去 互億無線 https://www.ihuyi.com/api/sms.html 去註冊一個賬號 註冊完成賬號後,它會送 ...
  • 通過以下方式可以高效,並保證數據同步的可靠性 1.API設計 使用RESTful設計,確保API端點明確,並使用適當的HTTP方法(如POST用於創建,PUT用於更新)。 設計清晰的請求和響應模型,以確保客戶端能夠理解預期格式。 2.數據驗證 在伺服器端進行嚴格的數據驗證,確保接收到的數據符合預期格 ...