Distributed Algorithms 2022-2023 Project Validation
Distributed Algorithms 2022-2023 Project Validation
2022-2023
Project validation
Teaching Assistants:
Diana Petrescu, Athanasios Xygkis
Extra support:
Nicolas Wagner 1
Goal of the project
Implement certain building blocks necessary for distributed systems:
2
Project Evaluation (1/2)
● The project accounts for 30% of the final grade:
○ Correctness,
○ Performance test,
○ Discussion
3
Project Evaluation (2/2)
● Correctness tests under:
○ Network issues: packet delay, packet loss, packet reordering, no packet corruption
4
Implementation steps
FIFO Broadcast
Focus on correctness first!
Try to improve performance later.
To-be-announced
5
Traffic Control (1/2)
tc: linux utility for altering the network characteristics (delay, loss, reorder).
How to use:
$ sudo tc qdisc add dev lo root netem 2>/dev/null
$ sudo tc qdisc change dev lo root netem delay 200ms 50ms loss 10% 25% reorder 25% 50%
What it does:
● Adds packet delay of 200ms ± 50ms that is uniformly distributed.
● 10% of the packets are lost. Each successive probability depends by 25% on the the last one: P(n)
= 0.25 * Prob(n-1) + 0.75 * Random (Emulated burst losses)
● 25% of packets (with a correlation of 50%) will get sent immediately, others will be delayed by the
aforementioned delay factor.
More info: https://man7.org/linux/man-pages/man8/tc-netem.8.html
6
Traffic Control (2/2)
For convenience, tools/tc.py applies the TC commands of the previous slide for you.
How to use:
$ python3 tc.py
Good to know:
● The tc rules are applied for as long as this program is running. When this program exits,
the tc rules are reset.
● This program applies the following TC configuration:
config = {
'delay': ('200ms', '50ms'),
'loss': ('10%', '25%'),
'reordering': ('25%', '50%')
}
For example
# Build the application:
$ ./build.sh
Where:
● RUNSCRIPT is the path to run.sh. Remember to build your project first!
● -t specifies which deliverable you run with.
● LOGSDIR is the path to a directory where stdout, stderr and output of each process will be stored.
It also stores generated HOSTS and CONFIG files. The directory must exist as it will not be created
for you.
● PROCESSES specifies the number of processes spawn during validation.
● MESSAGES specifies the number of messages each process is broadcasting.
9
Testing (3/3)
You can edit tools/stress.py in order to test different scenarios.
Go to the bottom of the file and edit the following:
How many threads are interfering with the running
testConfig = { processes.
'concurrency' : 8, How many successful operations (SIGCONT,
'attempts' : 8 , SIGSTOP, SIGTERM) each thread will attempt
'attemptsDistribution' : { before stopping. Threads stop if a minority of
processes has been terminated.
'STOP': 0.48,
'CONT': 0.48, Each thread selects a process randomly
'TERM':0.04 and issues one of these operations with the
given probability.
}
}
10
Further info about stress.py
● You can use tc.py before running stress.py to change the network
configuration.
● You can change the rate at which interfering threads interfere with the
processes:
○ Modify this line: time.sleep(float(random.randint(50, 500)) / 1000.0) under
the StressTest class
11
Measuring performance
We measure performance under no process crashes/delays.
● Measure as follows:
○ Start all processes,
○ Wait x minutes,
○ Stop all processes,
○ Take a snapshot.
● Compute the throughput based on the generated logs and the execution time
12