warren-bank / HLS-Proxy

Node.js server to proxy HLS video streams
http://webcast-reloaded.surge.sh/proxy.html
GNU General Public License v2.0
244 stars 75 forks source link

How to do performance tuning #21

Open culyzhao opened 1 year ago

culyzhao commented 1 year ago

I tested 100 clients, the proxy server can't process new request smoothly, the CPU and network workload is not high. If I have 5000 clients to watch a video with 2M bitrate, could HLS-Proxy do this job good?

test script:

#!/bin/sh
for i in `seq 11 100`; do \
   tag=$(printf "%04d" $i); \
   echo $tag; \
   (while true; do \
      ffmpeg -user-agent stat_$tag \
      -i http://ip/some.m3u8 -c copy \
      -flags +global_header -f null /dev/null 2>&1 \
      | stdbuf -i0 -o0 -e 0 tr -s '\r' '\n' \
      | stdbuf -i0 -o0 -e 0 \
      gawk '{ print strftime("[%Y-%m-%d %H:%M:%S.%s]"), $0 }' \
      >>log_$tag ; \
      sleep 2; \
      echo "RESTART----------" >> log_$tag ;
   done &); \
done