Thanks!My daemon processes UDP data very fast, just change little memory data, so I think one loop for each UDP socket is enough, with recvmmsg.
发送自HTC手机 ----- Reply message ----- 发件人: "Brandon Black" <[email protected]> 收件人: "Marc Lehmann" <[email protected]> 抄送: <[email protected]> 主题: multi-ev_loop on UDP socket 日期: 周二, 6 月 5 日, 2012 年 01:45 On Mon, Jun 4, 2012 at 12:36 PM, Brandon Black <[email protected]> wrote: > But you can scale up to more packets/sec handled on a given machine by > doing one thread-per-socket (-per-core) and distributing the packets I forgot to mention in the previous email: another area to look at for high performance UDP on Linux is the relatively new syscalls sendmmsg() and recvmmsg(). These can send or receive multiple UDP packets in a single syscall. This reduces the syscall overhead (you're bouncing out to kernel space less often and picking/dropping packets in batches), which further improves the performance of looping on a single socket. In theory, it could reduce internal kernel overhead as well (e.g. lock the socket once for all packets), but last I checked a lot of those kernel-internal optimizations haven't yet been implemented; it more less just loops over sendmsg() internally in the kernel. By using this interface you'll get them if they ever are, though. Just killing some syscall overhead for now is still a nice help. -- Brandon _______________________________________________ libev mailing list [email protected] http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
_______________________________________________ libev mailing list [email protected] http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
