This repository implements the simulation code for (a family of four different) churn-tolerant leader election protocols.
The simple option is to run the leader election protocols with simulated membership
files (generated by bin/scripts/gen_membership.py
). Start by building the project:
$ mvn clean package
And then go to the bin/
folder. To run a single experiment:
$ ./run.sh <config_file> # we provide a default file (config.json) for <config_file>
To run multiple experiments with different network configurations:
$ ./scripts/run_multiple.sh # set run_medley to false
Another option is to run the leader election protocols with real membership traces injected (as we did in our paper). We use Medley as our underlying weakly-consistent membership protocol. Start by cloning both this repository and the Medley repository and place both folders under the same directory:
folder/
LeaderElection/
Inconsistency-on-Medley/
Both projects are built using Apache Maven. Run the following command in your terminal:
$ cd folder/LeaderElection/ && mvn clean package
$ cd folder/Inconsistency-on-Medley/ && mvn clean package
All the scripts are inside the bin/
folder:
$ cd folder/Leader/Election/bin/
To run multiple experiments with different network configurations:
$ ./scripts/run_multiple.sh # set run_medley to true
After running multiple experiments with different network configurations, you can use the
script analyze/scripts/plot_algos.py
to plot the figures. The results in the paper can
be reproduced in this way.
membership_file
: the path of the folder that stores the membership files- If membership files are simulated, the default path is
membership/
- If the membership files are generated from Medley, the default path is
../../Inconsistency-on-Medley/bin/membership/
- If membership files are simulated, the default path is
topology_file
: topology file path. We provide some example topology files stored inbin/topo/
stats_file
: file path that stores the statistics of the leader election runnum_servers
: number of servers in the systemone_hop_delay
: simulated one way hop delayone_hop_radius
: node communication rangemsg_drop_rate
: message drop rate in percentagegranularity
: the frequency that reads from the membership filesend_time
: simulation end timeevent_check_timeout
: timeout to check for message responsesalgorithm
: which algorithm to run (1-Base Protocol, 2-Optimistic Protocol, 3-Preferred Protocol, 4-Hybrid Protocol)k
: inconsistency value cf
: number of maximum simultaneous failurenum_low_node
: number of low hash nodes included in the Response message (for algorithm 3 and 4)num_suspect_count
: number of top suspect count nodes included in the Response message (for algorithm 3 and 4)num_coordinator
: number of initiatorssuspect_count_threshold
: the lowest number of suspect count for a node to be included in the top suspect count nodesverbose
: verbosity for the statistic file
LeaderElection/
analyze/
results/ # experiment result .json files
scripts/ # scripts to plot data
bin/ # bash scripts
membership/ # stores the simulated membership files
scripts/ # scripts to run the experiment
topo/ # topology files
src/main/java/ # source code
enums/ # enumerate types
network/ # network simulation
message/ # different types of message details
simulator/ # contains the entrypoint of the code
event/ # different types of simulated events
utils/ # utiliy functions