You are not consuming your UDP input fast enough. Here are some usual steps to take to mitigate that:
- Switch to
recvmmsg(2)
if your kernel supports it to reduce system call overhead, - Pre-allocate all memory used during input processing,
- Profile your app, find hot spots and optimize,
- Maybe farm processing out to separate threads, but keep lock scope as small as possible,
- Increase your socket receive buffer (
setsockopt(2)
),