Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

leonardoflorido/Load_Balancer

Repository files navigation

Load Balancer

Very simples HTTP/TCP Load Balancer. Single thread, using OS selector. The code contains 4 classes that implement different strategies to select the next back-end server:

  1. N to 1: all the requests are routed to a single server
  2. Round Robin: the requests are routed to all servers in sequence
  3. Least Connections: the request is routed to the server with fewer processed connections
  4. Least Response Time: the request is routed to the server with less average execution time

Course

This project was developed under the Distributed Computing course of University of Aveiro.

Installation

  • Clone the repository:
$ git clone https://github.com/leo-dsf/Load_Balancer
  • Install requirements:
$ python3 -m venv venv
$ source venv/bin/activate
$ pip3 install -r requirements.txt

How To Run

  • Run Bash Script:
$ source venv/bin/activate
$ ./setup.sh
  • In another terminal:
$ curl -s http://localhost:8080/10
  • Or use a browser to open:
http://localhost:8080/10

How to access the load balancer

Go to a browser and open this link. The number after the URL specifies the precision of the computation.

How to Stress Test

  • Run Stress Test:
$ ./stress_test.sh
  • Alternative:
$ httperf --server=localhost --port=8080 --uri=/100 --num-conns=100 --rate=5

Author

License

This project is licensed under the MIT License.