C-Load-Balancer-Using-Lists-Hashtables
所属分类:云原生工具
开发工具:C
文件大小:1588KB
下载次数:0
上传日期:2023-01-08 19:16:13
上 传 者:
sh-1993
说明: 在多个服务器上分发键值对并从适当的服务器检索值的负载平衡器
(Load balancer that distributes key-value pairs across multiple servers and retrieves values from the appropriate server)
文件列表:
CircularList.h (2911, 2023-01-09)
Hashtable.c (5641, 2023-01-09)
Hashtable.h (1335, 2023-01-09)
LinkedList.c (4355, 2023-01-09)
LinkedList.h (708, 2023-01-09)
Makefile (608, 2023-01-09)
check.sh (4202, 2023-01-09)
cpplint.py (237308, 2023-01-09)
in (0, 2023-01-09)
in\test0.in (237, 2023-01-09)
in\test1.in (238, 2023-01-09)
in\test10.in (11601, 2023-01-09)
in\test11.in (18793, 2023-01-09)
in\test12.in (49579, 2023-01-09)
in\test13.in (89448, 2023-01-09)
in\test14.in (219695, 2023-01-09)
in\test15.in (649249, 2023-01-09)
in\test16.in (1290857, 2023-01-09)
in\test2.in (503, 2023-01-09)
in\test3.in (745, 2023-01-09)
in\test4.in (866, 2023-01-09)
in\test5.in (2892, 2023-01-09)
in\test6.in (6665, 2023-01-09)
in\test7.in (3828, 2023-01-09)
in\test8.in (6192, 2023-01-09)
in\test9.in (6950, 2023-01-09)
load_balancer.c (4967, 2023-01-09)
load_balancer.h (2114, 2023-01-09)
main.c (2849, 2023-01-09)
ref (0, 2023-01-09)
ref\test1.ref (212, 2023-01-09)
ref\test10.ref (16100, 2023-01-09)
ref\test11.ref (24053, 2023-01-09)
ref\test12.ref (54928, 2023-01-09)
ref\test13.ref (104984, 2023-01-09)
ref\test14.ref (278850, 2023-01-09)
ref\test15.ref (681721, 2023-01-09)
... ...
# 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:
```make```
To run the program, use the following command:
```./load-balancer input-file```
近期下载者:
相关文件:
收藏者: