enable reuseport then only one worker is working?

Maxim Dounin mdounin at mdounin.ru
Mon Feb 29 14:06:29 UTC 2016


Hello!

On Sun, Feb 28, 2016 at 08:52:12AM -0500, meteor8488 wrote:

> I just upgrade Nginx from 1.8 o 1.9 on my FreeBSD box.
> After I enabled reuseport on my server, it seems now there is one worker
> always takes up 100% CPU and all the rest workers are use less than 1% CPU.
> In the day time it's OK because my website doesn't have lots of users. But
> at night it's very slow.

While SO_REUSEPORT socket option is available on FreeBSD, its 
behaviour is different from one nginx relies on: instead of 
balancing between all sockets as Linux and DragonFly do, it 
preserves historic behaviour for TCP and delivers all connections 
to one socket instead.

That is, there is no surprise that you see all work done by a 
single worker in your setup when you use "listen ... reuseport" on 
FreeBSD.

Note that documentation explicitly says it's only expected to work 
on Linux and DragonFly:

: This currently works only on Linux 3.9+ and DragonFly BSD.

See http//nginx.org/r/listen for details.

-- 
Maxim Dounin
http://nginx.org/



More information about the nginx mailing list