- We use Primary-Backup. We support only 2 server nodes.
Source code:
src/blockstorage_server.cc
class BlockStorageServiceImpl
: responds to client requests ofRead(Addr)
andWrite(Addr)
class ServiceCommImpl
: communicates with the other server node to propogate writesclass ServiceCommClient
: communicates witht the other server for recoveryclass LBNodeCommClient
: communicates with the Load Balancer to send heartbeats and identify failover
-
Client library Souce code:
src/client.h
andsrc/client/cc
-
Load Balancer Source code:
src/load_balancer.cc
class BlockStorageService
: forwards client request to a serverclass LBNodeCommService
: used to identify server unavailability
We use a two phase strategy of writing to a temp file and atomic rename from temp to orginal file
Source code: src/blockstorage_server.cc
We perform 4 steps to recover from a server crash viz.
- Parse log file
- Get pending writes
- Recover from other states
- Cleanup
Source code:src/util/crash_recovery.h
andsrc/util/crash_recovery.cc
Servers exchange hearbeats with the load balancer
Source code: src/blockstorage_server.cc
and src/load_balancer.cc
Present in performance/
and MACROS present in src/util/common.h
concurrent_rw.cc
: Client code that issues reads and writes concurrentlylatency_perf.cc
: Client code that issues the read and write multiple times on the same addressrecovery_perf.cc
: Client code that initialises the servers with writes to analyse recovery timerw_perf.cc
: Client code that issues reads and writes on multiple addresses concurrently
-
Address Translation Source code:
src/util/address_translation.h
andsrc/util/address_translation.cc
-
Cache Source code:
src/util/cache.h
andsrc/util/cache.cc
-
Key Value Store Source code:
src/util/kv_store.h
andsrc/util/kv_store.cc
-
Reader-Writer Locks Source code:
src/util/locks.h
andsrc/util/locks.cc
-
Handling in-flight and future writes during recovery Source code:
src/util/txn.h
andsrc/util/txn.cc
-
Write Ahead Logging Source code:
src/util/wal.h
andsrc/util/wal.cc
Follow these steps to install gRPC lib using cmake: https://grpc.io/docs/languages/cpp/quickstart/#setup.
:warning: make sure to limit the processes by passing number(e.g. 4) during make -j
command.
for example, instead of make -j
use make -j 4
- cd src/
- chmod 755 build.sh
- ./build.sh
- cd performance/
- chmod 755 build.sh
- ./build.sh
cd src/cmake/build
./blockstorage_client
OR
cd performance/
./build
cd cmake/build
<ANY OF THE EXECUTABLES LISTED IN THIS DIRECTORY>
./load_balancer
./blockstorage_server PRIMARY [self_addr_lb] [self_addr_peer] [peer_addr] [lb_addr]
Eg.
./blockstorage_server PRIMARY 20.127.48.216:40051 0.0.0.0:60052 20.127.55.97:60053 20.228.235.42:50056
./blockstorage_server BACKUP [self_addr_lb] [self_addr_peer] [peer_addr] [lb_addr]
Eg.
./blockstorage_server BACKUP 20.127.55.97:40051 0.0.0.0:60053 20.127.48.216:60052 20.228.235.42:50056
- concurrent_rw
cd performance/cmake/build
./concurrent_rw
- latency_perf
cd performance/cmake/build
./latency_perf -a <num> -j <num> -l <num> -i <num> -t <num>
Where a stands for the start address j stands for the next address jump l stands for the count of addresses / limit i stands for the number of iterations t stands for the test, 0 for read and 1 for write
- recovery_perf
./recovery_perf -a <num> -j <num> -l <num> -i <num>
Where a stands for the start address j stands for the next address jump l stands for the count of addresses / limit i stands for the number of iterations
- rw_perf
./rw_perf <num> <num>
Where the first num corresponds to 0 for read and 1 for write. The second num corresponds to the number of worker threads.