1. 程式人生 > >HTTP/HLS/RTMP超級負載測試工具(轉)

HTTP/HLS/RTMP超級負載測試工具(轉)

解析 重復 run rtu port -i 連接 內容 ace

這個負載測試工具是網遊分享的工具,可以在http://blog.csdn.net/win_lin/article/details/11835011 或者https://github.com/winlinvip/st-load 找到非常詳細的介紹,包括如何安裝,如何使用。

服務器負載測試工具(st-load):

  1. 模擬huge並發:2G內存就可以開300k連接。基於states-threads的協程。
  2. 支持HLS解析和測試,下載ts片後等待一個切片長度,模擬客戶端。支持HLS點播和直播。
  3. 支持HTTP負載測試,所有並發重復下載一個http文件。可將80Gbps帶寬測試的72Gbps。
  4. 支持RTMP流測試,一個進程支持5k並發。使用nginx-rtmp的協議直接將chunk流解析為messgae。

流媒體相關補充

rtmp://10.169.0.66/rtmp/live 這樣的格式,我們稱之為一個rtmp流。通用格式為 rtmp://ip_addr/application_name/stream_name(id)

使用方法

將工具下載下來:Git clone https://github.com/winlinvip/st-load.git

編譯:

  • cd st-load
  • ./configure
  • make

使用:./objs/sb_rtmp_load -c 1 -r rtmp://127.0.0.1:1935/live/livestream

更多使用方法

Usage: ./sb_rtmp_publish <Options> <-u URL>

./sb_rtmp_publish base on st(state-threads), support huge concurrency.

Options:

 -c CLIENTS, --clients CLIENTS    The concurrency client to start to request. defaut: 1
 -r URL, --url URL                The load test url for each client to download/process. 
 -t REPEAT, --repeat REPEAT       The repeat is the number for each client to download the url. 
                                  ie. rtmp://127.0.0.1:1935/live/livestream_{i}
                                  default: 0. 0 means infinity.
 -s STARTUP, --start STARTUP      The start is the ramdom sleep when  thread startup in seconds. 
                                  defaut: 5.00. 0 means no delay.
 -d DELAY, --delay DELAY          The delay is the ramdom sleep when success in seconds. 
                                  default: 1.00. 0 means no delay. -1 means to use HLS EXTINF duration(HLS only).
 -e ERROR, --error ERROR          The error is the sleep when error in seconds. 
                                  defaut: 3.00. 0 means no delay. 
 -m SUMMARY, --summary SUMMARY    The summary is the sleep when report in seconds. 
                                  etasks is error_tasks, statks is sub_tasks, estatks is error_sub_tasks.
                                  duration is the running time in seconds, tduration is the avarage duation of tasks.
                                  nread/nwrite in Mbps, duration/tduration in seconds.
                                  defaut: 30.00. 0 means no delay. 
 -v, --version                    Print the version and exit.
 -h, --help                       Print this help message and exit.

Examples:1. start a client

  ./sb_rtmp_publish -i doc/source.200kbps.768x320.flv -c 1 -r rtmp://127.0.0.1:1935/live/livestream

2. start 1000 clients

  ./sb_rtmp_publish -i doc/source.200kbps.768x320.flv -c 1000 -r rtmp://127.0.0.1:1935/live/livestream_{i}

3. start 10000 clients

  ./sb_rtmp_publish -i doc/source.200kbps.768x320.flv -c 10000 -r rtmp://127.0.0.1:1935/live/livestream_{i}

4. start 100000 clients

  ./sb_rtmp_publish -i doc/source.200kbps.768x320.flv -c 100000 -r rtmp://127.0.0.1:1935/live/livestream_{i}

http負載:./objs/sb_http_load

hls負載: ./objs/sb_hls_load

rtmp收看負載: ./objs/sb_rtmp_load

rtmp創建直播流負載: ./objs/sb_rtmp_publish


如果不知道需要跟什麽參數可以使用 ./objs/sb_http_load -help 查看

Report分析

[2015-06-01 17:00:06.981][0][trace] params url=rtmp://10.169.0.66/rtmp/live, threads=1, start=5.00, delay=1.00, error=3.00, report=30.00, count=0

[2015-06-01 17:00:06.981][0][trace] create thread for task #1 success

[2015-06-01 17:00:06.981] [report] [4391] threads:0 alive:0 duration:0 tduration:0 nread:0.00 nwrite:0.00 tasks:0 etasks:0 stasks:0 estasks:0

[2015-06-01 17:00:06.981][1][trace] start random sleep 4338ms

[2015-06-01 17:00:11.324][1][trace] start to process RTMP play task #1, schema=rtmp, host=10.169.0.66, port=1935, tcUrl=rtmp://10.169.0.66:1935/rtmp, stream=live, startup=5.00, delay=1.00, error=3.00, count=0

[2015-06-01 17:00:36.981] [report] [4391] threads:1 alive:1 duration:30 tduration:0 nread:2.62 nwrite:0.00 tasks:1 etasks:0 stasks:0 estasks:0

[2015-06-01 17:01:06.981] [report] [4391] threads:1 alive:1 duration:60 tduration:0 nread:2.88 nwrite:0.00 tasks:1 etasks:0 stasks:0 estasks:0

[2015-06-01 17:01:36.981] [report] [4391] threads:1 alive:1 duration:90 tduration:0 nread:2.96 nwrite:0.00 tasks:1 etasks:0 stasks:0 estasks:0

[2015-06-01 17:02:06.981] [report] [4391] threads:1 alive:1 duration:120 tduration:0 nread:3.01 nwrite:0.00 tasks:1 etasks:0 stasks:0 estasks:0


收看直播與創建直播只需要關註:nread與nwrite即可。其他內容有待進一步調查

HTTP/HLS/RTMP超級負載測試工具(轉)