This is a simple round-robin load balancer implemented in Golang. It distributes incoming HTTP requests evenly among a list of backend servers.
- Clone the repository:
git clone https://github.com/swarajkumarsingh/load-balancer.git
- Build and run the load balancer:
go build main.go
./main
- Send HTTP requests to the load balancer's endpoint (e.g., http://localhost:8080) to distribute them among your backend servers.
You can configure the load balancer by modifying the main.go file. Here are the key points for configuration:
- Add or remove backend server URLs in the backendServers slice in the main function.
- You can change the port on which the load balancer listens by modifying the port variable in the main function.
The load balancer uses the following Go standard library packages:
- net/http: For creating the HTTP server.
- net/http/httputil: For creating reverse proxies.
- net/url: For parsing and handling URLs.
This project is licensed under the MIT License - see the LICENSE file for details.
Feel free to contribute to this project by opening issues or pull requests. Your contributions are welcome!
Swaraj kumar singh