java - The udp server throws OOM exception when feed data in a high rate -
in order recieve maximum 64kb of data , reduce packets loss, config udp server following netty 4.0
public class udpserver { public void run() throws exception { eventloopgroup group = new nioeventloopgroup(); try { bootstrap b = new bootstrap(); b.group( group ).channel( niodatagramchannel.class ).option( channeloption.so_broadcast, true ) .option( channeloption.udp_receive_packet_size, 1024 * 64 ) .option( channeloption.so_rcvbuf, 1024 * 1024 * 100 ).handler( new userhandler() ); b.bind( 5141 ).sync().channel().closefuture().await(); } { group.shutdowngracefully(); } } public static void main( string[] args ) throws exception { new udpserver().run(); } } when feed data in 20kmsg/s udp sercer, throws oom exception. found cause config param udp_receive_packet_size larger direct buffer memory ran out quickly. if set 1024*128 so_rcvbuf, 1024 * 2 udp_receive_packet_size, server works when feed data in 20kmsg/s.
are there suggestion avoid oom excepiton when udp_receive_packet_size not change?
thanks help/insight
was bug , fixed in latest master , part of netty 4.0.0.final.
Comments
Post a Comment