-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
48 lines (38 loc) · 1.41 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Load Balancer for Distributed Key-Value Store
I implemented a load balancer in the 2nd semester of university with personal variants of data structures, such as: linked lists, circular lists and hash tables. It distributes key-value pairs across multiple servers and retrieves values from the appropriate server.
# Functionality
The load balancer provides the following functionality:
- Store key-value pairs
- Retrieve values for a given key
- Add new servers to the load balancer
- Remove existing servers from the load balancer
# How to Use
To use the load balancer, call the apply_requests function and pass it an input file. The input file should contain requests, one per line, in the following format:
- "store" followed by a key-value pair in quotes
- "retrieve" followed by a key in quotes
- "add_server" followed by a server id (integer)
- "remove_server" followed by a server id (integer)
# Example
For example, the input file:
```
store "key1" "value1"
store "key2" "value2"
retrieve "key1"
add_server 1
store "key3" "value3"
remove_server 1
retrieve "key3"
```
will produce the following output:
```
Stored value1 on server 0.
Stored value2 on server 1.
Retrieved value1 from server 0.
Stored value3 on server 2.
Key key3 not present.
```
# Compiling and Running
To compile the program, run the following command: <br>
```make``` <br>
To run the program, use the following command: <br>
```./load-balancer input-file```