This project implements a simple UDP Load Balancer that distributes incoming UDP messages to a pool of backend servers using a round-robin scheduling algorithm.
The UDP Load Balancer receives messages from a client and forwards them to one of the available servers in a round-robin manner. It then waits for the server's response and forwards the response back to the client.
- Round-robin load balancing
- Timeout handling for server responses
- Error handling for communication issues
-
Clone the repository
-
Ensure you have Python installed (preferably Python 3.6+).
-
Start the load balancer:
python UDPLoadBalancer.py
-
Run your servers (Server1, Server2, Server3) on the specified ports.
-
Use the client to send messages to the load balancer:
python Client.py 127.0.0.1 12345
-
Load Balancer Address and Port:
- The load balancer listens on
127.0.0.1:12345
by default. - Modify
LB_IP
andLB_PORT
inUDPLoadBalancer.py
to change the address and port.
- The load balancer listens on
-
Server Addresses:
- The server addresses are specified in
SERVER_ADDRESSES
inUDPLoadBalancer.py
. - Add or remove server addresses as needed.
- The server addresses are specified in
Contributions are welcome! Please fork the repository and use a feature branch. Pull requests are warmly welcome.
This project is licensed under the MIT License - see the LICENSE file for details.