Score:0

How would I dynamically add servers to a load balancer?

cn flag

This is a tough question to phrase in the limited space for the title, but I'll try my best to explain myself. I want the users of my website to be able to run the servers themselves. Those servers would be valued and rated. I want to submit those values to my load balancer so that it weights the traffic between all the servers based on how powerful they are. The load balancer should dynamically balance the load between temporary servers, so every time someone starts up a server, it would be added to the list of servers to balance with their weighted score. How would I do this? Could it be done at all? diagram

Score:0
us flag
Rob

I can't quite grasp what problem you're trying to solve, nor do I understand what you intend to achieve by letting your users run your website infrastructure...

But to "dynamically add servers to a load balancer" you have roughly two different strategies:

  • your loadbalancer provides an API (and you trigger an API call to add/remove servers from a pool)

  • your loadbalancer supports a service discovery mechanism.
    A fairly common one is DNS. You use for example a single myservice.example.com hostname in the loadbalancer pool/backend configuration and when servers are added/removed you don't need to change the loadbalancer config, but only the DNS record:

    myservice.example.com. 90  IN  A  192.168.2.131
    myservice.example.com. 90  IN  A  192.168.2.132
    myservice.example.com. 90  IN  A  192.168.2.133
    

https://www.haproxy.com/blog/dns-service-discovery-haproxy/

Nick M avatar
cn flag
i was thinking of using NGINX, does it have an API to use? all of the ip addresses being balanced are from different networks, so would that also work?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.