[英]Java - Mule UDP Packet Loss
我搜索了很多關於這個話題。
sysctl.conf net.core.rmem_max = 52508000 net.core.rmem_default = 26265600
net.ipv4.udp_mem = 102400 26265600 52508000
net.core.netdev_max_backlog = 65536 net.ipv4.route.flush = 1
我在 Windows 中進行了一個 escenary 測試,我嘗試在 300 秒內以 256 kbps 的速度發送 100msg/sec,通過 Localhost 沒有丟包。
在 65507 字節的 4 msg 中嘗試了 Linux 本地主機片段 256kbs,其中 125000~ msg 已發布 120000~ 收到 4% 的數據包丟失。
在 2 個子網之間嘗試我得到了可怕的結果,發布了 125000~ 並收到了 40000~。
我的機器:1 GB 以太網,32 核,32 GB 內存 Linux 內核 2.6.32-358.el6.x86_64
我的應用程序設計有 10 個線程,從特定 IP 發送到 10 個端口。
我在 Mule 中的 UDP 連接器:
<udp:connector name="udpConnector" timeout="0" validateConnections="false" receiveBufferSize="26265600" sendBufferSize="26275600" broadcast="true" keepSendSocketOpen="true" doc:name="udpConnector"/>
也許我忘記了設置或者我的 Mule UDP 參數是錯誤的,但我無法用一台好的機器來解釋這一點。
有人可以照亮我嗎? 很多thnx,TCP不是一個選項^^
//sendData = new byte[65507];
tim = 300;
delay = tim * 1000;
setmsgSec(40);
do{
for(int i=0; i<=msgSec ;i++)
{
ds.send(dp[3]);
cont++;
setCont(cont);
setRate(cont);
setAvgBytes(sendata[3].length);
}
Thread.sleep(1000);
tim = tim - 1;
delay = delay - 1000;
}while (delay != 0);
setCont(cont);
問題解決了。
解決方案:為每台機器上的緩沖區設置相同的值,對於 1GB 以太網、32 核和 32G RAM 以及 200 條消息 256kbps 的突發,這個值就足夠了。
kernel.threads-max = 2048
net.core.optmem_max = 16777216
net.core.rmem_default = 2620280
net.core.rmem_max = 16777216
net.core.wmem_default = 2620280
net.core.wmem_max = 16777216**
我使用性能成本低的 log4j.properties:
log4j.rootLogger=INFO, default.out
# System.out.println appender for all classes
log4j.appender.default.out=org.apache.log4j.ConsoleAppender
log4j.appender.default.out.threshold=INFO
log4j.appender.default.out.layout=org.apache.log4j.PatternLayout
log4j.appender.default.out.layout.ConversionPattern=%m%n
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.