Date: Mon, 15 Jul 2013 10:37:59 +0800 From: Sepherosa Ziehau <sepherosa@gmail.com> To: trafdev <trafdev@mail.ru> Cc: freebsd-net@freebsd.org Subject: Re: SO_REUSEPORT: strange kernel balancer behaviour Message-ID: <CAMOc5cz6gP2N62T4QhbTdVar94O4FSdPDsqktD_9vJ0mYVqt_Q@mail.gmail.com> In-Reply-To: <51E0E2AF.7090404@mail.ru> References: <51E0E2AF.7090404@mail.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jul 13, 2013 at 1:16 PM, trafdev <trafdev@mail.ru> wrote:
> Hello.
>
> Could someone help with following problem of SO_REUSEPORT.
The most portable "load balance" between processes listening on the
same TCP addr/port probably is:
s=socket();
bind(s);
listen(s);
/* various socketopt and fcntl as you needed */
pid=fork();
if (pid==0) {
server_loop(s);
exit(1);
}
server_loop(s);
exit(1);
Even in Linux or DragonFly SO_REUSEPORT "load balance" between
processes listening on the same TCP addr/port was introduced recently,
so you probably won't want to rely on it.
Best Regards,
sephe
--
Tomorrow Will Never Die
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMOc5cz6gP2N62T4QhbTdVar94O4FSdPDsqktD_9vJ0mYVqt_Q>
