How to build a loadbalancer using elixir?

What I want to know is whether I can use elixir to build a load balancer that receives the requests of the user and then sends a messages to the processes that handles the users in order to know which one is the least busy, and depending on the result, the load balancer(which is a process itself) redirects the user and in the process eliminating third party load balancers such as nginx.

To me the title and the description of your topic are not in sync.

To me configuring a server to run an application is different from putting a load balancer in front of the application, but I may be wrong.

You may want to explain with more detail what you are trying to achieve. To me it looks that you are asking how to create an Elixir load balancer that is able to balance requests between nodes in a distributed application. Am I correct?

2 Likes

Thanks for pointing out the confusion, gonna edit the post.

What I want to know is whether I can use elixir to build a load balancer that receives the requests of the user and then sends a messages to the processes that handles the users in order to know which one is the least busy, and depending on the result, the load balancer(which is a process itself) redirects the user and in the process eliminating third party load balancers such as nginx.

1 Like

You can, however depending on your needs Elixir may be not the best choice for such low-level infrastructure component as it may introduce too much latency. In general such adaptive load balancing isn’t common, as it is often much quicker to use simpler strategy for load balancing (least recently used, RR, random, etc.). The reason for that is that defining “least busy” is quite complex task on it’s own.

4 Likes

I wondered that myself several times and never took the time to do a deep research, but I know some exist already, like:

(not maintained)

You can also read this chapter to have more insights on what you want:

2 Likes