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

Vladimir Kokshenev V.Kokshenev at F5.com
Wed Jul 20 19:08:40 UTC 2022


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



More information about the nginx-devel mailing list