Google Interview Question
Country: United States
The data structure can have a Queue for input requests.
It should also have a Heap data structure with get_min() method that returns the one with min load.
Should?
There are many types of load balancing requirements. Some require fancy forests and such.
The function of load balancer is to distribute the load on all available backends equally.
Assuming load balancer has details of load of all backends, now if new request comes it should be directed to the backend with minimum load and this can be done in O(1) using min Heap data structure.
1. Request arrives at load balancer.
2. Load balancer picks the minimum load backed and route the request to it.
3. Load balancer increases the load on this backend server and performs heapify operation. O(logn).
Load balancer algorithm is an algorithm where the no of task or jobs to be processed should be less than that of threshold value.
- Debabrata Kundu September 25, 2013Example of some load balancing algorithm are MAX-MAX,MAX-MIN,MIN-MAX,MIN-MIN. And the values are to be consider are execution time and conclusion time.
MAX-MAX is stands for maximum execution and maximum conclusion time and so on... .