Skip to content

jacek-foremski/LoadBalancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Developer TASK

You are required to write a LoadBalancer class.

The class has 2 public methods.
The first – the constructor – takes two arguments. The first argument is a list of host instances that should be load balanced. The second argument is the variant of load balancing algorithm to be used.

There are two variants: the first will simply pass the requests sequentially in rotation to each of the hosts in the list. The second one will either take the first host that has a load under 0.75 or if all hosts in the list are above 0.75, it will take the one with the lowest load.

The second method is called handleRequest(Request $request) and will load balance the request according to the variant passed on construction.

You can assume that the host instances class has the following API:
public int getLoad()
public void handleRequest(Request $request)

About

Solution for LoadBalancer developer task

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages