Hi,
For something similar, I in fact use the admin socket to haproxy to add drain 
and remove servers from backend definitions. Very light and doesn't use CPU on 
the haproxy machine.

On 21 June 2023 02:29:42 GMT+02:00, Diffie <n...@mm.st> wrote:
>Hello!
>
>I had a question about the performance of Lua in HAProxy. I am experimenting 
>with using a Lua script as a way of dynamically updating server ports. This 
>script would be used instead of HAProxy's native support for DNS SRV records 
>for service discovery (SRV records are not ideal for my use case, and I 
>believe you have been trying to move away from DNS in the core codebase, based 
>on release notes I've read on this mailing list -- please correct me if that 
>is wrong).
>
>So, I am thinking of using `core.register_task()` to run a Lua function at 
>startup. This function will talk to some simple web server over HTTP, which 
>will return a list of server ids/ip addrs/ports. Lua would then update the 
>port(s) of any servers with the relevant id using :set_addr(). The server 
>count could have a ceiling of ~1k servers. This whole thing would run in a 
>loop, and sleep every 10 seconds or so. 
>
>My question is, does the above approach sound like it could affect the 
>performance of HAProxy in some significant way (any more than a DNS SRV 
>lookup)? Also, in general, is the performance impact of core.register_task() 
>less than a standard core.register_service()? I ask since register_task() 
>would have a fixed schedule (e.g., every 10s), whereas a service could be hit 
>with every incoming request.
>
>Thanks!
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Reply via email to