How to monitor Linux UDP buffer available space?

前端 未结 4 709
别那么骄傲
别那么骄傲 2020-11-29 18:11

I have a java app on linux which opens UDP socket and waits for messages.

After couple of hours under heavy load, there is a packet loss, i.e. the packets are receiv

4条回答
  •  佛祖请我去吃肉
    2020-11-29 18:47

    The process is simple:

    1. If desired, pause the application process.

    2. Open the UDP socket. You can snag it from the running process using /proc//fd if necessary. Or you can add this code to the application itself and send it a signal -- it will already have the socket open, of course.

    3. Call recvmsg in a tight loop as quickly as possible.

    4. Count how many packets/bytes you got.

    This will discard any datagrams currently buffered, but if that breaks your application, your application was already broken.

提交回复
热议问题