<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      如何對Linux系統進行基準測試4工具Sysbench

      Sysbench簡介

      Sysbench是一款多用途基準測試工具,可對CPU、內存、I/O甚至數據庫性能進行測試。它是一個基本的命令行工具,提供了直接、簡便的系統測試方法。github地址:https://github.com/akopytov/sysbench

      主要功能:

      • CPU: 衡量CPU執行計算密集型任務的能力。
      • 內存: 衡量內存子系統的性能。
      • 磁盤I/O: 衡量磁盤讀寫速度。
      • 數據庫: 衡量數據庫的性能,包括 OLTP(聯機事務處理)和TPC-C基準測試。
      • 其他: Sysbench還支持其他類型的測試,例如線程性能和網絡延遲。

      Sysbench的主要特點包括:

      • 開源: Sysbench 是一個開源軟件,可以免費使用和修改。
      • 跨平臺: Sysbench 支持多種操作系統,包括 Linux、Windows、macOS 和 Solaris。
      • 多線程: Sysbench 支持多線程測試,可以充分利用多核 CPU 的性能。
      • 模塊化: Sysbench 的架構是模塊化的,可以擴展支持新的測試類型和功能。
      • 易用性: Sysbench 提供命令行界面和 Lua 腳本支持,易于使用和配置。

      Sysbench 常用于以下場景:

      • 性能測試: 評估系統的性能瓶頸并進行優化。
      • 數據庫性能測試: 衡量數據庫的性能并與其他數據庫進行比較。
      • 硬件評估: 評估新硬件的性能。
      • 容量規劃: 規劃系統的容量以滿足未來的需求。

      源碼:https://github.com/akopytov/sysbench

      安裝Sysbench

      首先在系統上安裝Sysbench。大多數發行版軟件源都提供了它:

      # Ubuntu/Debian
      $ sudo apt install sysbench
      
      # Fedora
      # dnf install sysbench
      
      # CentOS
      # yum install sysbench
      
      # OpenSUSE
      # zypper in sysbench
      

      CPU基準測試

      $ sysbench cpu --cpu-max-prime=2000 run
      sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
      
      Running the test with following options:
      Number of threads: 1
      Initializing random number generator from current time
      
      
      Prime numbers limit: 2000
      
      Initializing worker threads...
      
      Threads started!
      
      CPU speed:
          events per second: 22757.61
      
      General statistics:
          total time:                          10.0001s
          total number of events:              227609
      
      Latency (ms):
               min:                                    0.04
               avg:                                    0.04
               max:                                    0.12
               95th percentile:                        0.04
               sum:                                 9968.18
      
      Threads fairness:
          events (avg/stddev):           227609.0000/0.00
          execution time (avg/stddev):   9.9682/0.00
      
      

      雖然會生成包含大量統計數據的報告,但 CPU 基準測試的主要內容是"General statistics"下的"total time"。

      • 其他命令:
      $ sysbench cpu run
      $ sysbench cpu --threads=40 run # 默認為單線程
      #在檢查 CPU 在重負載下的性能時,可使用命令將 CPU 的最大質數限制從 "10000 "擴展到 "15000":
      $ sysbench --test=cpu --cpu-max-prime=15000 run 
      # 幫助
      $ sysbench cpu help
      sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
      
      cpu options:
        --cpu-max-prime=N upper limit for primes generator [10000]
      
      

      內存基準測試

      $ sysbench memory --threads=2 run
      sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
      
      Running the test with following options:
      Number of threads: 2
      Initializing random number generator from current time
      
      
      Running memory speed test with the following options:
        block size: 1KiB
        total size: 102400MiB
        operation: write
        scope: global
      
      Initializing worker threads...
      
      Threads started!
      
      Total operations: 28555430 (2855143.49 per second)
      
      27886.16 MiB transferred (2788.23 MiB/sec)
      
      
      General statistics:
          total time:                          10.0001s
          total number of events:              28555430
      
      Latency (ms):
               min:                                    0.00
               avg:                                    0.00
               max:                                    0.03
               95th percentile:                        0.00
               sum:                                12842.67
      
      Threads fairness:
          events (avg/stddev):           14277715.0000/1030637.00
          execution time (avg/stddev):   6.4213/0.10
      
      

      這里有兩點需要考慮:"Total operations"和"transferred"。

      • 其他命令:
      $ sysbench memory run
      $ sysbench memory --memory-oper=write run # 默認為讀
      # 要測試特定條件下的內存,例如將內存塊大小從默認的 "1KiB "提高到 "1M",同時保持總內存容量為 "8GB"
      $ sysbench --test=memory --memory-block-size=1M --memory-total-size=8G run
      

      參考資料

      IO基準測試

      在Linux系統上執行IO基準測試時,我們必須先創建一些測試文件。要創建測試文件,請使用以下命令:

      $ sysbench --test=fileio --file-total-size=100G prepare
      WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
      sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
      
      128 files, 819200Kb each, 102400Mb total
      Creating files for the test...
      Extra file open flags: (none)
      Extending existing file test_file.0
      ...
      Extending existing file test_file.127
      53687091200 bytes written in 94.39 seconds (542.44 MiB/sec).
      

      請確保選擇的測試文件大小大于內存容量,這樣IO進程才不會受到內存操作的影響。創建測試文件將根據所選大小花費一些時間。創建測試文件后,運行以下命令開始基準測試:

      $ sysbench --test=fileio --file-total-size=100G --file-test-mode=rndrw --max-time=300 --max-requests=0 run
      WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
      WARNING: --max-time is deprecated, use --time instead
      sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
      
      Running the test with following options:
      Number of threads: 1
      Initializing random number generator from current time
      
      
      Extra file open flags: (none)
      128 files, 800MiB each
      100GiB total file size
      Block size 16KiB
      Number of IO requests: 0
      Read/Write ratio for combined random IO test: 1.50
      Periodic FSYNC enabled, calling fsync() each 100 requests.
      Calling fsync() at the end of test, Enabled.
      Using synchronous I/O mode
      Doing random r/w test
      Initializing worker threads...
      
      Threads started!
      
      
      File operations:
          reads/s:                      1101.01
          writes/s:                     734.01
          fsyncs/s:                     2348.98
      
      Throughput:
          read, MiB/s:                  17.20
          written, MiB/s:               11.47
      
      General statistics:
          total time:                          300.0508s
          total number of events:              1255287
      
      Latency (ms):
               min:                                    0.00
               avg:                                    0.24
               max:                                 2154.60
               95th percentile:                        0.46
               sum:                               299665.82
      
      Threads fairness:
          events (avg/stddev):           1255287.0000/0.00
          execution time (avg/stddev):   299.6658/0.00
      
      

      文件清理:

      $ sysbench --test=fileio --file-total-size=100G cleanup
      WARNING: the --test option is deprecated. You can pass a script name or path on the command line without any options.
      sysbench 1.0.20 (using system LuaJIT 2.1.0-beta3)
      
      Removing test files...
      

      Mysql基準測試

      要對mysql進行基準測試,我們首先要在名為"test"的數據庫中創建一個有50000 的表,使用以下命令

      $ sysbench --test=oltp –oltp-table-size=50000 --mysql-db=test --mysql-user=root --mysql-password=passwd prepare
      

      操作完成后,執行以下命令啟動 Mysql Bechmarking:

      $ sysbench --test=oltp --oltp-table-size=500000 --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run
      No DB drivers specified, using mysql
      
      Running the test with following options:
      
      Number of threads: 8
      
      Doing OLTP test.
      
      Running mixed OLTP test
      
      Doing read-only test
      
      Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases)
      
      Using "BEGIN" for starting transactions
      
      Using auto_inc on the id column
      
      Threads started!
      
      Time limit exceeded, exiting...
      
      (last message repeated 7 times)
      
      Done.
      
      OLTP test statistics:
      
      queries performed:
      
      read: 2253860
      
      write: 0
      
      other: 321980
      
      total: 2575840
      
      transactions: 160990 (2683.06 per sec.)
      
      deadlocks: 0 (0.00 per sec.)
      
      read/write requests: 2253860 (37562.81 per sec.)
      
      other operations: 321980 (5366.12 per sec.)
      
      Test execution summary:
      
      total time: 60.0024s
      
      total number of events: 160990
      
      total time taken by event execution: 479.3419
      
      per-request statistics:
      
      min: 0.81ms
      
      avg: 2.98ms
      
      max: 3283.40ms
      
      approx. 95 percentile: 4.62ms
      
      Threads fairness:
      
      events (avg/stddev): 20123.7500/63.52
      
      execution time (avg/stddev): 59.9177/0.00
      
      Main parameter to check here is 'transactions per second'
      
      transactions: 160990 (2683.06 per sec.)
      

      測試數據清理:

      $ sysbench --test=oltp --mysql-db=test --mysql-user=root --mysql-password=yourrootsqlpassword cleanup
      

      結果解讀

      總時間越短,表明系統性能越好,尤其是在比較類似測試時。不過必須將這一指標與其他指標結合起來考慮,因為測試時間越短,錯誤率越高,并不代表性能越好。

      Ops/sec是系統吞吐量的直接指標。ops/sec值越高,通常意味著系統在給定時間內可以處理的操作越多,性能越好。例如,如果您運行的是數據庫服務器,較高的ops/sec表示您的服務器每秒可以處理更多的查詢,從而為最終用戶帶來更快的響應時間。

      延遲對用戶體驗至關重要。較低的延遲意味著更快地完成操作,這對于視頻流或在線游戲等需要實時響應的任務尤為重要。如果您正在托管一個網站,較低的延遲可以加快頁面加載時間,提升用戶體驗。

      posted @ 2024-07-13 18:36  磁石空杯  閱讀(402)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 国产午夜亚洲精品不卡下载| 干老熟女干老穴干老女人| 好吊妞| 欧美大bbbb流白水| 一边捏奶头一边高潮视频| 在线看无码的免费网站| 少妇高潮潮喷到猛进猛出小说| 亚洲欧美日韩愉拍自拍美利坚| 光泽县| 久久99精品久久久大学生| 国产伦码精品一区二区| 国产精品午夜福利视频| 国产无遮挡免费真人视频在线观看| 国产一区二区日韩在线 | 人妻另类 专区 欧美 制服| 国产亚洲精品自在久久vr| 国产精品一区二区色综合| 午夜福利精品国产二区| 无码免费大香伊蕉在人线国产 | 人妻影音先锋啪啪av资源| 人妻中文字幕精品一页| 亚洲一区在线成人av| 日韩一区二区三区水蜜桃| 日韩精品国产中文字幕| 播放灌醉水嫩大学生国内精品| 国产精品女人毛片在线看| 四虎成人免费视频在线播放| 武乡县| 国产精品疯狂输出jk草莓视频| 久久精品娱乐亚洲领先| 狂野欧美性猛交免费视频| 久久久久久综合网天天 | 泸西县| 狠狠色丁香婷婷综合久久来来去| 亚洲精品专区永久免费区| 国产无套粉嫩白浆在线| 精品国产乱码久久久久app下载| 亚洲欧美日韩成人综合一区| 国产精品人妻一码二码尿失禁| 亚洲欧洲av一区二区久久| 99riav国产精品视频|