我在 Debian(或 Ubunto,都测试过)上使用 icecast2(来自 apt-get)。8GB RAM,4 个 CPU 内核,3 个流。
服务器在 XML 配置中配置为 20K 连接限制,但是当它接收到 ~ 1000 个连接时,它会挂起。
我正在使用真实客户进行测试,但也使用curl --silent --output /dev/null http://localhost:8001/livemusic
from进行测试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>
icecast 进程很可能具有较低的 ulimit,例如 1024。
在守护进程启动之前,将这样的行添加到
/etc/init.d/icecast2
,应该工作:ulimit -n 25000
请注意,在 Icecast 的情况下,您最有可能先用完带宽。在大多数用例中,它非常节省资源。