Very simples HTTP/TCP Load Balancer. Implemented in Python3, single thread, using OS selector. The code contains 4 classes that implement different strategies to select the next back-end server:
- N to 1: all the requests are routed to a single server
- Round Robin: the requests are routed to all servers in sequence
- Least Connections: the request are routed to the server with fewer processed connections
- Least Response Time: the request are routed to the server with less execution time
At the moment only the fist strategy is fully implemented.
The back-end server was implemented with flask. It provides a simple service that computes the number Pi with a certain precision.
$ python3 -m venv venv
$ source venv/bin/activate
$ pip3 install -r requirements.txt
$ source venv/bin/activate
$ ./setup.sh
Go to a browser and open this link. The number after the URL specifies the precision of the computation.
$ ./stress_test.sh
$ git remote add upstream git@github.com:mariolpantunes/restaurant-p2p.git
$ git fetch upstream
$ git checkout master
$ git merge upstream/master
- Mário Antunes - mariolpantunes
This project is licensed under the MIT License - see the LICENSE.md file for details