<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                #### 安裝方法 #### YUM安裝(Centos7) 安裝epel源(aliyun) ```shell yum install siege ``` #### 編譯安裝(Centos6/7) 下載位置 ```shell http://download.joedog.org/siege/ wget -P /opt http://download.joedog.org/siege/siege-latest.tar.gz ``` 安裝 ```shell tar xzf siege-4.0.2.tar.gz cd siege-4.0.2 ./configure make && make install ``` #### 主要參數 ```shell 常用參數 -c,并發用戶,默認為10 -r, 運行測試次數。 -t, 測試時間 核心參數 -d,建議配置為“1”,每個請求前的隨機延遲 -i,隨機點擊URL。 -f,選擇一個特定的URLS FILE。 -b,暴力測試,無延遲,查看某個壓力下,資源的變化情況 壓測控制參數 -q,關閉并禁止輸出。 -l,--log [= FILE] LOG到FILE。如果沒有指定FILE,則使用默認值:PREFIX/var/siege.log 定制化參數 -H,--header =“text”添加一個頭來請求(可以是很多) -A,--user-agent =“text”請求中設置用戶代理 -T,--content-type =“text”在請求中設置Content-Type ``` #### 壓測方法(以下內容如有錯誤,請告知改正) ##### 如何使用1臺24核,16GB內存的服務器,模擬20000并發請求? - 使用Centos7系統 - 做好內核中網絡部分的優化 - 做好系統文件描述符的優化 - 建立10個用戶(a...j) ##### 調整配置 每個用戶下運行一次siege,會在用戶目錄下產生~/.siege/siege.conf的配置文件,該文件中需要調整2個限制參數 1. 出現多少次錯誤時停止,不包含404(按需調整) failures 2. 最大單進程并發數量,默認25 concurrent = 5000 #### 壓測方式 ##### 基于請求的吞吐量(模擬真實請求) 例:20W請求,多長時間能夠處理完成,并且沒有錯誤產生 ```shell siege -c 1000 -r 20 -i ``` 10用戶,每個用戶并發1000,循環20次 主要關注總時常、響應時間、平均每秒完成請求、錯誤數 ##### 基于并發的暴力測試(了解瓶頸、規劃容量) 例:20000并發,運行10分鐘,觀察服務器和應用的運行情況 ```shell siege -c 2000 -t 10m -b ``` 10用戶,每個用戶2000并發,運行10分鐘 主要關注響應時間、平均每秒完成請求、平均每秒傳送數據、實際最高并發 ##### 共同關注,系統資源消耗和壓測對象狀態監控 系統資源監控使用dstat ```shell dstat -t -a -l -m --tcp --top-cpu --output /tmp/145-2c10240-15000.txt ``` Web服務器監控 ```shell Zabbix監控狀態頁或內部運行情況 ``` #### 執行壓測時,siege可能出現的幾種情況 - 壓測后卡住,10個用戶,有些壓測進程壓測完成后退出失敗 ```shell 取可用結果,平均后乘以10,作為壓測結果,總耗時和響應時間,只平均不乘10 ``` - 自身資源不足 ```shell 系統優化 實際使用時,壓測比較消耗內存 ``` - Web服務器處理失敗(到達處理瓶頸) ```shell [error] socket: -872327424 connection timed out.: Connection timed out [error] socket: read error Connection reset by peer sock.c:539: Connection reset by peer ``` #### 真實案例 舉例:壓測Nginx,15000并發,頁面大小150kB,壓縮后800字節 Nginx配置 ```shell gizp on worker_processes=2 worker_connections 10240 ``` ##### 壓測結果(部分) 用戶a ```shell Transactions: 10454 hits Availability: 100.00 % Elapsed time: 30.05 secs Data transferred: 6.89 MB Response time: 1.94 secs Transaction rate: 347.89 trans/sec Throughput: 0.23 MB/sec Concurrency: 674.49 Successful transactions: 11805 Failed transactions: 0 Longest transaction: 16.98 Shortest transaction: 0.00 ``` 用戶b ```shell Transactions: 21462 hits Availability: 100.00 % Elapsed time: 30.06 secs Data transferred: 13.32 MB Response time: 0.74 secs Transaction rate: 713.97 trans/sec Throughput: 0.44 MB/sec Concurrency: 528.73 Successful transactions: 22830 Failed transactions: 0 Longest transaction: 8.57 Shortest transaction: 0.00 ``` >備注:取5個用戶,平均后乘10。但總用時,響應時間只平均,不乘10 |Trans|Elap Time|Data Trans|Resp Time|Trans Rate|Throughput|Concurrent| | :------------: | :------------: | :------------: | :------------: | :------------: | :------------: | :------------: | |150404|30.32|95.54|1.262|5008|3.16|5788.76|
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看