我在 Debian(或 Ubunto,都测试过了)上使用 icecast2(来自 apt-get)。8GB RAM、4 个 CPU 核心、3 个流。
该服务器在 XML 配置上配置为 20K 个连接限制,但是当它收到约 1000 个连接时,它就会挂起。
我正在使用真实客户端进行测试,同时也在curl --silent --output /dev/null http://localhost:8001/livemusic
进行测试localhost
。
我也尝试在端口 8001 上手动运行另一个,这样我就可以运行 1000 个连接,但它再次挂起。
我需要做什么 ?
<limits>
<clients>20000</clients>
<sources>9</sources>
<queue-size>10485760</queue-size>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<threadpool>30</threadpool>
<source-timeout>10</source-timeout>
<!-- If enabled, this will provide a burst of data when a client
first connects, thereby significantly reducing the startup
time for listeners that do substantial buffering. However,
it also significantly increases latency between the source
client and listening client. For low-latency setups, you
might want to disable this. -->
<burst-on-connect>1</burst-on-connect>
<!-- same as burst-on-connect, but this allows for being more
specific on how much to burst. Most people won't need to
change from the default 64k. Applies to all mountpoints -->
<burst-size>131072</burst-size>
</limits>
答案1
最有可能的是,icecast 进程具有较低的 ulimit,例如 1024。
/etc/init.d/icecast2
在守护进程启动之前,添加如下一行应该可以起作用:
ulimit -n 25000
请注意,在使用 Icecast 时,您最有可能先耗尽带宽。在大多数情况下,它的资源效率非常高。