Load Balancing Algorithms-Worksheet1
Load Balancing Algorithms-Worksheet1
Introduc)on
Load balancing algorithms are cri2cal tools for managing network
traffic and ensuring op2mal performance. However, with the myriad of
op2ons available, it can be challenging to determine which is the best
fit for your unique needs.
The Importance of Load Balancing Algorithms
There are six processes named as P1, P2, P3, P4, P5 and P6. Their
arrival 2me and burst 2me are given below in the table. The 2me
quantum of the system is 4 units:
The comple*on *me, Turnaround *me and wai*ng *me will be calculated as shown in the table
below.
Turn Around Time = Comple*on Time - Arrival Time
Wai.ng Time = Turn Around Time - Burst Time
Ref: hDps://www.youtube.com/watch?v=tAAmZ3bz8AA
The Weighted Distribu2on algorithm goes a step further than the Least
Connec2ons algorithm by taking into account the processing power of
each server. In this algorithm, each server is assigned a weight based on
its capacity. Servers with higher weights receive more requests than
servers with lower weights.
This algorithm can be an excellent choice for environments where
servers have different capabili2es. It ensures that more powerful
servers handle a larger share of the traffic, which can help to prevent
less powerful servers from becoming overwhelmed
Session Persistence Algorithm
IP Hash Algorithm
The IP Hash algorithm uses the IP address of the client and server to
determine where to route traffic. This algorithm provides a consistent
mapping, meaning that as long as the number of servers remains the
same, a client will always be directed to the same server.
This can be beneficial for applica2ons that need to maintain state
between requests. However, it can lead to imbalances if a large number
of requests come from a small number of IP addresses. Therefore, it
may not be the best choice for environments with a wide distribu2on
of client IP addresses.
Ref: hDps://www.youtube.com/watch?v=dBmxNsS3BGE
Code Example: Load Balancing with TensorFlow on Colab
Configura3on:
in Google Colab, go to Run2me -> Change run2me type, and select GPU
as the hardware accelerator.