回复: multi-ev_loop on UDP socket
钱晓明
mailtoantares at 163.com
Tue Jun 5 00:39:24 CEST 2012
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" <blblack at gmail.com>
收件人: "Marc Lehmann" <schmorp at schmorp.de>
抄送: <libev at lists.schmorp.de>
主题: multi-ev_loop on UDP socket
日期: 周二, 6 月 5 日, 2012 年 01:45
On Mon, Jun 4, 2012 at 12:36 PM, Brandon Black <blblack at gmail.com> 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
libev at lists.schmorp.de
http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/libev/attachments/20120605/ba76d657/attachment.html>
More information about the libev
mailing list