<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/ DTD/wml_1.1.xml">

<wml>
<head>
<meta http-equiv="cache-control" content="max-age=180,private" />
</head>
<card title="流媒体压力测试rtmp&amp;hls(SRS Bench)">
<p>
作者:<a href="index.php?action=showuser&amp;userid=1&amp;hash=">admin</a><br />时间:2021-04-28 08:47<br />分类:<a href="index.php?action=list&amp;cid=3&amp;hash=">电脑技术</a><br />内容:
流媒体压力测试rtmp&amp;hls(SRS Bench)

 

服务器负载测试工具SB(SRS Bench)：

1. 模拟huge并发：2G内存就可以开300k连接。基于states-threads的协程。 

2. 支持HLS解析和测试，下载ts片后等待一个切片长度，模拟客户端。支持HLS点播和直播。执行程序：./objs/sb_hls_load 

3. 支持HTTP负载测试，所有并发重复下载一个http文件。可将80Gbps带宽测试的72Gbps。执行程序：./objs/sb_http_load 

4. 支持RTMP流播放测试，一个进程支持5k并发。执行程序：./objs/sb_rtmp_load 

5. 支持RTMP流推流测试，一个进程支持500个并发。执行程序：./objs/sb_rtmp_publish 

6. RTMP协议使用高性能服务器SRS(6. SimpleRtmpServer)的协议栈。 

注意：

1. HTTP/HLS：依赖服务器Content-Length，不支持chunked方式(chunked时会把所有内容当做body一直读)。 

2. 所有程序都在Linux下运行，模拟客户端运行。 

3. 其他工具参考3. srs-librtmp 

模拟RTMP用户

./st_rtmp_load -c 1 -r rtmp://127.0.0.1:1935/live/livestream

模拟HLS直播用户

./st_hls_load -c 1 -r http://127.0.0.1:3080/hls/hls.m3u8

模拟HSL点播用户

./st_hls_load -c 10000 -o -r http://127.0.0.1:3080/hls/hls.m3u8

模拟RTMP推流用户

./st_rtmp_publish -i doc/source.200kbps.768&times;320.flv -c 1 -r rtmp://127.0.0.1:1935/live/livestream

模拟RTMP多路推流用户

./st_rtmp_publish -i doc/source.200kbps.768&times;320.flv -c 1000 -r rtmp://127.0.0.1:1935/live/livestream_{i}

      官网地址：https://github.com/ossrs/srs-bench

      WIN32下载地址：https://github.com/wanstonq/srs-bench-win32

 ubuntu(debian) 系统下编译报错处理

执行 apt install git

正式安装

1. 执行 git clone https://github.com/ossrs/srs [该过程很漫长] 

2. 执行 cd srs/trunk 

3. 执行 ./configure &amp;&amp; make 

4. 启动服务器则执行 ./objs/srs -c conf/srs.conf 

遇到的问题

若在上节步骤 3 中的时候报下面的错误信息：

  

patching file Makefile

cc -I. -DHTTP_PARSER_STRICT=1  -Wall -Wextra -Werror -O0 -g  -c http_parser.c

http_parser.c: In function &lsquo;http_parser_parse_url&rsquo;:

http_parser.c:2093:18: error: this statement may fall through [-Werror=implicit-fallthrough=]

         found_at = 1;

         ~~~~~~~~~^~~

http_parser.c:2096:7: note: here

       case s_req_server:

       ^~~~

cc1: all warnings being treated as errors

Makefile:40: recipe for target 'http_parser.o' failed

make: *** [http_parser.o] Error 1

build http-parser-2.1 failed, ret=2

步骤：

&middot; 执行 cd .. 回到 trunk 目录

&middot; 执行 cd 3rdparty 进入三方框架目录

&middot; 执行 mkdir temp 后 cd temp

&middot; 执行 unzip ../http-parser-2.1.zip

&middot; 执行 grep -n &quot;FALLT&quot; ./http-parser-2.1/http_parser.c

&middot; 执行 sed -e s/FALLTROUGH/FALLTHROUGH/ -i ./http-parser-2.1/http_parser.c

&middot; 执行 grep -n &quot;FALLT&quot; ./http-parser-2.1/http_parser.c

&middot; 执行 mv ../http-parser-2.1.zip ../http-parser-2.1-orig.zip

&middot; 执行 zip ../http-parser-2.1.zip http-parser-2.1/*

&middot; 执行 cd ../.. 回到 trunk 文件夹，此时一定是解决成功的

&middot; 执行 ./configure &amp;&amp; make


 
</p><p>
<a href="index.php?action=login&amp;hash=">立即登陆发表评论</a><br />
</p>
<p><a href="index.php?action=list&amp;hash=">返回日志列表</a><br /><a href="index.php?action=index&amp;hash=">返回主页</a></p>
</card>
</wml>
