Date: Fri, 6 Jun 2014 16:20:16 -0700 From: Adrian Chadd <adrian@freebsd.org> To: Daniel Janzon <janzon@gmail.com> Cc: "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org> Subject: Re: Best practice for accepting TCP connections on multicore? Message-ID: <CAJ-Vmo=eJ4o2j=3kUOjR=HOMDOR5pD2HcXvxm=dYjkaB9bj8EQ@mail.gmail.com> In-Reply-To: <CAAGHsvDhaqQbwir5P%2BoaH_Qa8VZ0aj9A2SGrn%2B2shJMQ21B6Jw@mail.gmail.com> References: <CAAGHsvDhaqQbwir5P%2BoaH_Qa8VZ0aj9A2SGrn%2B2shJMQ21B6Jw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, I'm working on exactly this with the RSS support that's in the tree. The vague design I have in mind is to have one bound thread per RSS allocated CPU, and then put a listen TCP (and later UDP) socket in each thread. Then the accept path in the TCP/PCB code will do a lookup in the CPU-local PCBGROUP table first to see if there's a local listen socket in that table that's local to that CPU. If so, the request will go to that socket. I'll later add support for multiple sockets listening on the same IP:PORT entry, so you can have multiple threads load balanced (eg on the same CPU, or a small CPU set on a core local to that NIC, etc.) But that'll have to come later - it requires a slightly larger overhaul of how listen entries work in that table. I have a patchset that works and I'll be slowly merging it into -HEAD over the next week. Thanks, -a On 6 June 2014 16:00, Daniel Janzon <janzon@gmail.com> wrote: > Hi, > > What is the best practice (performance-wise) for dispatching new TCP > connections to different threads in order to make use of multiple cores? > > Is there any better way than doing the accept() call in one thread and then > dispatch it to a thread on another core with any user space method? > > Conceivably one should be able to perform the accept() call from several > threads but using the same socket and let the kernel distribute the > incoming connections using some kind of hash or round robin. > > Regards, > Daniel > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmo=eJ4o2j=3kUOjR=HOMDOR5pD2HcXvxm=dYjkaB9bj8EQ>