Icecast
debian 上的 icecast2 在大約 1000 個連接後掛起
我在 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 的情況下,您最有可能先用完頻寬。在大多數案例中,它非常節省資源。