tcprstat 很不錯的服務器時延統計工具


tcprstat 是一個很不錯的網絡通信檢測,可以支持多種應用協議的處理

安裝

git clone https://github.com/y123456yz/tcprstat.git
yum -y install bison yacc flex  glibc-static  libcap-devel
./configure
make &&  make  install
  • 支持的命令
./tcprstat --help
tcprstat 0.3.1, libpcap version 1.1.1.
Usage: tcprstat [--port <port>] [--format=<format>] [--interval=<sec>]
             [--header[=<header>] | --no-header] [--iterations=<it>]
             [--read=<file>]
       tcprstat --version | --help
    --read <file>, -r    Capture from pcap file <file>, not live.
    --time <ms>, -T     time delay > -T(time) count stastic.
    --log  <file>, -o   if time dealy > -T(time), timestamp record to log file.
    --local <addresses>, -l
                         <addresses> is a comma-separated list of ip
                         addresses, which are used as the local list of
                         addresses instead of pcap getting the list.
                         This is useful when working with a pcap file got
                         from another host with different addresses.
    --port <port>, -p    Capture traffic only for tcp/<port>.
    --format <format>, -f
                         Output format. Argument is a string detailing
                         how the information is presented. Accepted codes:
                             %n - Response time count
                             %a - Response time media in microseconds
                             %s - Response time sum
                             %x - Response time squares sum
                             %m - Minimum value
                             %M - Maximum value
                             %T - counts that package delay time(default 40ms)
                             %h - Median value
                             %S - Standard deviation
                             %v - Variance (square stddev)
                             %I - Iteration number
                             %t - Timestamp since iteration zero
                             %T - Unix timestamp
                             %% - A literal %
                         Default is:
    "%T\t%n\t%M\t%m\t%a\t%h\t%S\t%C\t%95M\t%95a\t%95S\t%99M\t%99a\t%99S\n".
                         Statistics may contain a percentile between
                         the percentage sign and the code: %99n, %95a.
    --header[=<header>], --no-header
                         Whether to output a header. If not supplied, a
                         header is created out of the format. By default,
                         the header is shown.
    --interval <seconds>, -t
                         Output interval. Default is 10.
    --iterations <n>, -n
                         Output iterations. Default is 1, 0 is infinity
    --help               Shows program information and usage.
    --version            Shows version information.

試用

測試一個redis 服務的

  • 安裝redis
yum install -y redis
  • 運行命令
./tcprstat -p 6379 -t 1  -n 0
  • 運行壓測
redis-benchmark

說明

tcprstat 是一個很不錯的工具,但是目前基本沒看到維護了,實際上bcc是一個更好的性能分析套件,可以放到我們日常的開發以及性能
分析的工具包中

參考資料

https://github.com/y123456yz/tcprstat
https://github.com/Lowercases/tcprstat


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM