2nd Homework for Data Structures and Algorithms, Year I - Faculty of Automation Control and Computer Science, Polytechnic University of Bucharest
This program implements a Load Balancer which makes the connection between clients and servers using Consistent Hashing method. Consistent Hashing is a distributed hashing scheme that operates independently of the number of servers or objects in a distributed hash table. It powers many high-traffic dynamic websites and web applications. (according to Toptotal )
-->add_server 0
-->add_server 1
-->add_server 2
-->store "c674390f9" "Keyboard"
-->store "a3529213e15" "Headphones"
-->store "5a51719f5ec" "Router"
-->store "2fe5f9f583" "Laptop"
-->retrieve "c674390f9"
-->retrieve "2fe5f9f583"
-->remove_server 2
-->retrieve "2fe5f9f583"
Stored Keyboard on server 0.
Stored Headphones on server 1.
Stored Router on server 2.
Stored Laptop on server 2.
Retrieved Keyboard from server 0.
Retrieved Laptop from server 2.
Retrieved Laptop from server 1.
The program is divided into 4 main parts:
- main.c - contains the main function and the functions for parsing the input and calling the functions from the other files
- hashtable.c - contains the functions for creating and managing the hash table
- server.c - contains the functions for managing the servers, with each server being a hashtable
- load_balancer.c - contains the functions for managing the load balancer, which makes the connection between the clients and the servers, redistributes keys and values between the servers if a new server is added or removed
Each file has a header file with the declarations of the functions and the structures used in the respective file.
||| For more information regarding the functions purposes and their arguments, check the comments in the header(.h) files.
||| For more information regarding the implemenation of each function, please check the comments in .c files.