Welcome! Log In Create A New Profile

Advanced

Re: Open-sourcing periodic upstream server resolution and implementing a dedicated service worker.

Vladimir Kokshenev via nginx-devel
July 21, 2022 08:44PM
Hi Neil

Thank you for sharing your perspectives.

TTL-based DNS re-resolving is planned for this feature.

Also, nginx resolver (which we plan to use) supports "ipv6=off" and
(since 1.23.1) "ipv4=off" parameters for cases when IPv6 or IPv4 addresses
are not desired.

We know about solutions based on Lua. However, the motivation is to provide
a solution that works out of the box.

--
Vladimir Kokshenev

´╗┐On 7/21/22, 6:02 AM, "Neil Craig" <Neil.Craig@bbc.co.uk> wrote:

EXTERNAL MAIL: Neil.Craig@bbc.co.uk

Hi Vladimir

I hope you don't mind me chipping in here.
We currently have 2 services which use Nginx with upstreams whose DNS can change frequently (e.g. AWS S3, ELB/ALB origins) so we're familiar with this problem. Initially we did a config reload every minute to solve the issue but since then, we've created custom Lua (using the OpenResty Lua module) to achieve the same thing in a more efficient way.

What you're proposing sounds great to me. I wanted to suggest a few feature ideas for your consideration:

* DNS TTL-based refresh (rather than refreshing every N seconds)
* DNS prefresh (update DNS when the elapsed time since the last refresh is perhaps 90% of the TTL)
* IPv4/6 ignore (useful for example when there's a v6 IP available but the system/network doesn't support v6)

Cheers

Neil Craig (He/Him)
Lead Architect, BBC Digital Distribution

On 20/07/2022, 20:09, "Vladimir Kokshenev via nginx-devel" <nginx-devel@nginx.org> wrote:

Hello!

This is the two-part proposal to open-source periodic upstream server resolution
and implement a dedicated service worker for nginx. The purpose of this e-mail
is to describe the WHY and solicit feedback.

Nginx supports domain names in the upstream server configuration.
Currently, domain names are resolved at configuration time only,
and there are no subsequent name resolutions.

There are plans to open-source re-resolvable upstream servers.
This will allow applying DNS updates to upstream configurations in runtime.
So, there is a need to support periodic asynchronous operations.
And a dedicated service worker is a possible architectural way to address this.

The master process reads and parses configuration and creates the service worker
when needed (in a similar way to cache-related processes).

The service worker manages periodic name resolutions and updates corresponding
upstream configurations. The name resolution relies on the existing nginx
resolver and upstream zone functionality.

The service worker will be responsible solely for periodic background tasks
and wouldn't accept client connections.

The service worker should be the last worker process to shut down
to maintain the actual state of upstreams when there are active workers.

Alternative architecture considered was about choosing one of the regular
workers (e.g., worker zero) to take care of periodic upstream server resolution,
but it creates asymmetry in responsibilities and load for this dedicated worker.

--
Vladimir Kokshenev

_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org


_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

Open-sourcing periodic upstream server resolution and implementing a dedicated service worker.

Vladimir Kokshenev via nginx-devel 393 July 20, 2022 03:10PM

Re: Open-sourcing periodic upstream server resolution and implementing a dedicated service worker.

Maxim Dounin 47 July 20, 2022 04:38PM

Re: Open-sourcing periodic upstream server resolution and implementing a dedicated service worker.

Neil Craig 44 July 21, 2022 09:02AM

Re: Open-sourcing periodic upstream server resolution and implementing a dedicated service worker.

itpp2012 91 July 21, 2022 01:05PM

Re: Open-sourcing periodic upstream server resolution and implementing a dedicated service worker.

Vladimir Kokshenev via nginx-devel 73 July 21, 2022 08:44PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 101
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready