Question

Im searched a lot about this topic.

  • UDP is not reliable
  • UDP can't send packets higher than 64kbs or 65507 bytes without headers
  • the MTU normally is 1500
  • 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

    I made test in Windows for an escenary where i try to send 100msg/sec @ 256 kbps in 300 sec, with no packet loss through Localhost.

Tried Linux throgh Localhost fragment 256kbs in 4 msg of 65507 bytes, with 125000~ msg published 120000~ Received 4% packet loss.

Trying between 2 subnet i get horrible results , publishing 125000~ and receiving 40000~.

My machine: 1 GB Ethernet , 32 core , 32 gb ram Linux Kernel 2.6.32-358.el6.x86_64

My app is designed with 10 threads sending to 10 ports from an specific IP.

My UDP connector in Mule :

    <udp:connector name="udpConnector" timeout="0" validateConnections="false" receiveBufferSize="26265600" sendBufferSize="26275600" broadcast="true" keepSendSocketOpen="true" doc:name="udpConnector"/>

Maybe i forgot settings or my Mule UDP pararms are wrong, but i can't explain this with a nice machine.

Someone can iluminate me? A lot of thnx, and TCP is not an option ^^

                            //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);
Was it helpful?

Solution

Problem solved.

Solution: put the same values for buffers on each machine, for 1GB Ethernet, 32 core & 32G RAM and burst of 200 messages 256kbps this values are enough.

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**

I Use a log4j.properties with low cost to performance:

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top