aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiogo464 <[email protected]>2025-07-11 15:00:45 +0100
committerdiogo464 <[email protected]>2025-07-11 15:00:45 +0100
commitaf95ee49b8c13139d82901b94dcb83335bd358ac (patch)
tree65b2dc62f51b83384973d6c277c92aa175d428de
parent916e97a81aff708edf4dc8162132c764b3921079 (diff)
updated README
-rw-r--r--.gitignore2
-rw-r--r--Justfile3
-rw-r--r--README.md97
-rw-r--r--demo.containerfile4
-rw-r--r--demo.sh5
5 files changed, 109 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index b574ffd..3d6cdcb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,9 @@
1/target 1/target
2/logs
2__pycache__/ 3__pycache__/
3.envrc 4.envrc
4latency-matrix-*.txt 5latency-matrix-*.txt
6latency.txt
5schedule.json 7schedule.json
6 8
7 9
diff --git a/Justfile b/Justfile
new file mode 100644
index 0000000..c784714
--- /dev/null
+++ b/Justfile
@@ -0,0 +1,3 @@
1demo-build-push:
2 docker build -t ghcr.io/diogo464/oar-p2p/demo:latest -f demo.containerfile .
3 docker push ghcr.io/diogo464/oar-p2p/demo:latest
diff --git a/README.md b/README.md
index 5872521..7c325e0 100644
--- a/README.md
+++ b/README.md
@@ -39,17 +39,110 @@ you can now use a tool like [direnv](https://direnv.net) or just `source` the fi
39to create a network you will need a latency matrix. you can generate a sample using [bonsai](https://codelab.fct.unl.pt/di/computer-systems/bonsai) or using the [web version](https://bonsai.d464.sh). 39to create a network you will need a latency matrix. you can generate a sample using [bonsai](https://codelab.fct.unl.pt/di/computer-systems/bonsai) or using the [web version](https://bonsai.d464.sh).
40Here is an example matrix: 40Here is an example matrix:
41``` 41```
42cat << EOF > latency.txt
420.0 25.5687 78.64806 83.50032 99.91315 430.0 25.5687 78.64806 83.50032 99.91315
4325.5687 0.0 63.165894 66.74037 110.71518 4425.5687 0.0 63.165894 66.74037 110.71518
4478.64806 63.165894 0.0 2.4708898 93.90618 4578.64806 63.165894 0.0 2.4708898 93.90618
4583.50032 66.74037 2.4708898 0.0 84.67561 4683.50032 66.74037 2.4708898 0.0 84.67561
4699.91315 110.71518 93.90618 84.67561 0.0 4799.91315 110.71518 93.90618 84.67561 0.0
48EOF
47``` 49```
48 50
49TODO: update this with addr
50once you have the latency matrix run: 51once you have the latency matrix run:
51```bash 52```bash
52oar-p2p net up --addr-per-cpu 4 --latency-matrix latency.txt 53# this will create 4 address in total, across the job machines
54# it is also possible to specify a number of addresses per machine or per cpu
55# 4/cpu will create 4 addressses per cpu on every machine
56# 4/machine will create 4 addresses per machine on every machine
57oar-p2p net up --addresses 4 --latency-matrix latency.txt
53``` 58```
54 59
60to view the created network and the nodes they are on run:
61```bash
62oar-p2p net show
63```
64
65which should output something like
66```
67gengar-1 10.16.0.1
68gengar-1 10.16.0.2
69gengar-2 10.17.0.1
70gengar-2 10.17.0.2
71```
72
73at this point the network is setup, you can check if the latencies are working properly by running a ping
74```
75~/d/d/oar-p2p (main)> ssh -J cluster gengar-1 ping -I 10.16.0.1 10.17.0.2 -c 3
76PING 10.17.0.2 (10.17.0.2) from 10.16.0.1 : 56(84) bytes of data.
7764 bytes from 10.17.0.2: icmp_seq=1 ttl=64 time=166 ms
7864 bytes from 10.17.0.2: icmp_seq=2 ttl=64 time=166 ms
7964 bytes from 10.17.0.2: icmp_seq=3 ttl=64 time=166 ms
80
81--- 10.17.0.2 ping statistics ---
823 packets transmitted, 3 received, 0% packet loss, time 2003ms
83rtt min/avg/max/mdev = 166.263/166.300/166.366/0.046 ms
84```
85which shows the expected latency that is about 2x88ms between address 0 and 3 in the matrix.
55 86
87### 3. removing the network
88this step is optional since the network up command already clears everything before setup, but if you want to remove all the addresses and nft/tc rules just run:
89```bash
90oar-p2p net down
91```
92
93### 4. running containerized experiments
94afer having setup the network, how you run the experiments is up to you, but `oar-p2p` has a helper subcommand to automate the process of starting containers, running them and collecting all the logs.
95
96the subcommand is `oar-p2p run` and it requires a "schedule" file to run. a schedule is a json array of objects, where each object describes a container to be executed. here is an example:
97```bash
98cat << EOF | oar-p2p run --output-dir logs
99[
100 {
101 "address": "10.16.0.1",
102 "image": "ghcr.io/diogo464/oar-p2p/demo:latest",
103 "env": { "ADDRESS": "10.16.0.1", "REMOTE": "10.17.0.1", "MESSAGE": "I am container 1" }
104 },
105 {
106 "address": "10.17.0.1",
107 "image": "ghcr.io/diogo464/oar-p2p/demo:latest",
108 "env": { "ADDRESS": "10.17.0.1", "REMOTE": "10.16.0.1", "MESSAGE": "I am container 2" }
109 }
110]
111EOF
112```
113
114when the command finishes running the logs should be under the `logs/` directory and contain something like:
115```
116───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
117 │ File: logs/10.16.0.1.stderr <EMPTY>
118───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
119───────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
120 │ File: logs/10.16.0.1.stdout
121───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
122 1 │ I am container 1
123 2 │ PING 10.17.0.1 (10.17.0.1) from 10.16.0.1: 56 data bytes
124 3 │ 64 bytes from 10.17.0.1: seq=0 ttl=64 time=50.423 ms
125 4 │ 64 bytes from 10.17.0.1: seq=1 ttl=64 time=50.376 ms
126 5 │ 64 bytes from 10.17.0.1: seq=2 ttl=64 time=50.356 ms
127 6 │
128 7 │ --- 10.17.0.1 ping statistics ---
129 8 │ 3 packets transmitted, 3 packets received, 0% packet loss
130 9 │ round-trip min/avg/max = 50.356/50.385/50.423 ms
131───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
132───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
133 │ File: logs/10.17.0.1.stderr <EMPTY>
134───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
135───────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
136 │ File: logs/10.17.0.1.stdout
137───────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
138 1 │ I am container 2
139 2 │ PING 10.16.0.1 (10.16.0.1) from 10.17.0.1: 56 data bytes
140 3 │ 64 bytes from 10.16.0.1: seq=0 ttl=64 time=50.421 ms
141 4 │ 64 bytes from 10.16.0.1: seq=1 ttl=64 time=50.375 ms
142 5 │ 64 bytes from 10.16.0.1: seq=2 ttl=64 time=50.337 ms
143 6 │
144 7 │ --- 10.16.0.1 ping statistics ---
145 8 │ 3 packets transmitted, 3 packets received, 0% packet loss
146 9 │ round-trip min/avg/max = 50.337/50.377/50.421 ms
147───────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
148```
diff --git a/demo.containerfile b/demo.containerfile
new file mode 100644
index 0000000..27218b6
--- /dev/null
+++ b/demo.containerfile
@@ -0,0 +1,4 @@
1FROM alpine:latest
2COPY demo.sh /bin/demo.sh
3RUN chmod +x /bin/demo.sh
4ENTRYPOINT ["/bin/demo.sh"]
diff --git a/demo.sh b/demo.sh
new file mode 100644
index 0000000..bde67f9
--- /dev/null
+++ b/demo.sh
@@ -0,0 +1,5 @@
1#!/bin/sh
2echo $MESSAGE
3sleep 2
4ping -c 3 -I $ADDRESS $REMOTE
5sleep 1