Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revamp loading configuration #1017

Closed
mikz opened this issue Apr 17, 2019 · 2 comments
Closed

Revamp loading configuration #1017

mikz opened this issue Apr 17, 2019 · 2 comments

Comments

@mikz
Copy link
Contributor

mikz commented Apr 17, 2019

Configuration loading implementation is based on the proposal in #230.

Over time it evolved a bit and we should re-evaluate how it is being loaded.
It is not obvious how many times, when exactly it is loaded or how long it takes.

We should try to design a solution that will:

  • load the configuration only once (even across multiple workers)
  • work for both lazy and boot modes
  • be able to print precise timestamps when and how long it took, including debugging logs what the configuration was and the response codes

With https://github.com/openresty/lua-resty-shell it should be possible to start and asynchronously read from external processes (needed to make requests in init phase).

https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#raw_log allows for cleaner errors messages without extra bloat.

https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/process.md allows starting a privileged process. There will be exactly one. If it is killed, it will be restarted. It can run init_worker phase. This would be ideal for an infinite timer, that would periodically refresh configuration. It also allows getting master PID.

https://github.com/openresty/lua-resty-signal allows sending signals to processes. Theoretically signalling master process to do a full reload. That would gracefully exit all workers, load new configuration and start the new master process.

For lazy loading, the situation is a bit harder, but still, we could try to have an internal API over UNIX socket, that would allow sharing configuration between multiple workers. The only methods of sharing configuration between workers are shared memory ngx.dict or some internal API (that still uses shared memory).

@davidor
Copy link
Contributor

davidor commented Jul 9, 2019

I'll start with offering the option to loading services one by one when they're needed instead of all of them when using APICAST_CONFIGURATION_LOADER = lazy.

@eloycoto
Copy link
Contributor

Fixed by:
#1099

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants