Why are particular UDP messages always getting dropped below a particular buffer size?

前端 未结 2 1431
悲&欢浪女
悲&欢浪女 2021-01-04 04:10

3 different messages are being sent to the same port at different rates:

Message  size (bytes) &nb

2条回答
  •  梦毁少年i
    2021-01-04 04:37

    Without detailed analysis of every network stack implementation along the path your UDP messages are being sent it is nearly impossible to state the resulting behaviour.

    UDP implementations are allowed to drop any packet at their own discretion. Usually this happens when a stack comes to the conclusion that it would need to drop packets to be able to receive new ones. There is no formal requirement that the packets dropped are the oldest or the newest being received. It could also be that a certain size class is more affected due to internal memory management strategies.

    From the IP stacks involved the most interesting one is the one on the receiving machine.

    For sure you will get better receive experience if you change the receive side to have a receive buffer that will take several seconds full of expected messages. I'd start with at least 10k.

    The observed "change" in behaviour when going from 4,799 to 4,800 may result from the later just allowing one of the small messages to be received before it needs to be dropped again, while the smaller size just causes it to be dropped slightly earlier. If the receiving application is quick enough to read the pending message you will receive small messages in the one case and no small messages in the other case.

提交回复
热议问题