Welcome! Log In Create A New Profile

Advanced

Re: Restarting service takes too much time

Maxim Dounin
December 05, 2022 07:36PM
Hello!

On Mon, Dec 05, 2022 at 09:43:18PM +0100, Charlie Kilo wrote:

> I know the problem also from an environment with many sites and thousands
> of ips to bind to. for us the problem is that nginx binds every worker to
> every ip sequentially - leading to a restart time of 10-15 minutes. the
> problem can easily be observed using strace on the master process during
> startup.. we couldn't find an easy solution so far.

Could you please share some numbers and details of the
configuration? Some strace output with timestamps might be also
helpful (something like "strace -ttT" would be great).

While binding listening sockets indeed happens sequentially, it is
expected to take at most seconds even with thousands of listening
sockets, and even under load, not minutes. It would be
interesting to dig into what causes 10-15 minutes restart time.

In particular, in ticket #2188
(https://trac.nginx.org/nginx/ticket/2188), which was about
speeding up "nginx -t" with lots of listening sockets under load,
opening 20k listening sockets (expanded from about 1k sockets in
the configuration with "listen ... reuseport" and multiple worker
processes) was observed to take about 1 second without load (and
up to 15 seconds under load, though this shouldn't affect restart).

Also note that nginx provides a lot of ways to actually do not
open that many sockets (including using a single socket on a
wildcard address for a given port instead of a socket for each IP
address, and not using reuseport, which is really needed only if
you are balancing UDP). If the issue you are observing is indeed
due to slow bind() calls, one of the possible solutions might be
to reduce the number of listening sockets being used.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

Restarting service takes too much time

Gus Flowers Starkiller November 30, 2022 10:42PM

Re: Restarting service takes too much time

blason December 01, 2022 12:55AM

Re: Restarting service takes too much time

Maxim Dounin December 01, 2022 01:04PM

Re: Restarting service takes too much time

blason December 04, 2022 02:04AM

Re: Restarting service takes too much time

blason December 04, 2022 02:04AM

Re: Restarting service takes too much time

A. Schulze via nginx December 04, 2022 07:32AM

Re: Restarting service takes too much time

Charlie Kilo December 05, 2022 03:46PM

Re: Restarting service takes too much time

Maxim Dounin December 05, 2022 07:36PM

Re: Restarting service takes too much time

Charlie Kilo December 10, 2022 03:54AM

Re: Restarting service takes too much time

Maxim Dounin December 11, 2022 06:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 233
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready