On Wed, Feb 20, 2019 at 10:43:22AM -0300, Joao Morais wrote: > Hi Bruno, thanks! Updating servers via api I'm currently using. From Willy > "in the past it was not possible to dynamically create servers" - so now I'm > wondering if there is a way or future plan to create a new server on an > existing backend and, even better, also dynamically create a new backend and > its servers.
Due to the fact that the number of servers has very important impacts on sizing a number of internal objects (LB map sizes, number of FDs and tasks needed for checks, server IDs for stats, etc), the servers must be pre- populated. That's what we're now doing with server templates. The idea is that it creates a number of dormant servers and reserves their resources. You can them fill their settings from the CLI, which effectively is the same as creating a server from nothing. The only limit is that you have to know in advance how many you'll need to add in a backend and to get prepared for their resources to be preallocated. Also regarding dynamic backend creation, it's still out of the scope. We've studied it multiple times, but it absolutely is not realistic when you see all the things you have in a backend. Just take a look at the function "check_config_validity()" in cfgparse.c : all it does is post-config resolution between frontends and backends, stick-tables resolution and adjustments etc. I think that if one day we end up doing some dynamic backends, instead we'll have a completely different type of config element. It would not be a real backend but a different thing which will not support stick tables, http rules, no stats, nor anything. It would possibly just be a very dumb server farm with only a list of servers and a load balancing algorithm. And it would very likely not even support health checks nor the SNI keyword. Maybe not even SSL on the server lines... As you see it would possibly be totally pointless. The reason is that a proxy is a configuration space, which references other objects and resolves their inter-dependencies. Creating such a thing on the fly out of nowhere is very similar to thinking about adding a function on the fly into a running program and expecting this function to be called from other places, to compil without errors, not to reference any non-existing variable and always using the proper types for everything. Instead I think we'll need to get back to the black board and try to spot why *exactly* people need to create backends instead of reusing existing ones. It's very likely that they could share tons of settings with existing backends but that just a few things make the sharing impossible (e.g. server states) and that we should instead try to figure how to add such multiple states into an existing backend. It will obviously not be anything easy but I find it important to start from the needs and not by constantly forcing to twist what we have. Cheers, willy

