diff options
| author | diogo464 <[email protected]> | 2025-07-11 15:00:45 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-07-11 15:00:45 +0100 |
| commit | af95ee49b8c13139d82901b94dcb83335bd358ac (patch) | |
| tree | 65b2dc62f51b83384973d6c277c92aa175d428de | |
| parent | 916e97a81aff708edf4dc8162132c764b3921079 (diff) | |
updated README
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | Justfile | 3 | ||||
| -rw-r--r-- | README.md | 97 | ||||
| -rw-r--r-- | demo.containerfile | 4 | ||||
| -rw-r--r-- | demo.sh | 5 |
5 files changed, 109 insertions, 2 deletions
| @@ -1,7 +1,9 @@ | |||
| 1 | /target | 1 | /target |
| 2 | /logs | ||
| 2 | __pycache__/ | 3 | __pycache__/ |
| 3 | .envrc | 4 | .envrc |
| 4 | latency-matrix-*.txt | 5 | latency-matrix-*.txt |
| 6 | latency.txt | ||
| 5 | schedule.json | 7 | schedule.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 @@ | |||
| 1 | demo-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 | ||
| @@ -39,17 +39,110 @@ you can now use a tool like [direnv](https://direnv.net) or just `source` the fi | |||
| 39 | to 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). | 39 | to 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). |
| 40 | Here is an example matrix: | 40 | Here is an example matrix: |
| 41 | ``` | 41 | ``` |
| 42 | cat << EOF > latency.txt | ||
| 42 | 0.0 25.5687 78.64806 83.50032 99.91315 | 43 | 0.0 25.5687 78.64806 83.50032 99.91315 |
| 43 | 25.5687 0.0 63.165894 66.74037 110.71518 | 44 | 25.5687 0.0 63.165894 66.74037 110.71518 |
| 44 | 78.64806 63.165894 0.0 2.4708898 93.90618 | 45 | 78.64806 63.165894 0.0 2.4708898 93.90618 |
| 45 | 83.50032 66.74037 2.4708898 0.0 84.67561 | 46 | 83.50032 66.74037 2.4708898 0.0 84.67561 |
| 46 | 99.91315 110.71518 93.90618 84.67561 0.0 | 47 | 99.91315 110.71518 93.90618 84.67561 0.0 |
| 48 | EOF | ||
| 47 | ``` | 49 | ``` |
| 48 | 50 | ||
| 49 | TODO: update this with addr | ||
| 50 | once you have the latency matrix run: | 51 | once you have the latency matrix run: |
| 51 | ```bash | 52 | ```bash |
| 52 | oar-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 | ||
| 57 | oar-p2p net up --addresses 4 --latency-matrix latency.txt | ||
| 53 | ``` | 58 | ``` |
| 54 | 59 | ||
| 60 | to view the created network and the nodes they are on run: | ||
| 61 | ```bash | ||
| 62 | oar-p2p net show | ||
| 63 | ``` | ||
| 64 | |||
| 65 | which should output something like | ||
| 66 | ``` | ||
| 67 | gengar-1 10.16.0.1 | ||
| 68 | gengar-1 10.16.0.2 | ||
| 69 | gengar-2 10.17.0.1 | ||
| 70 | gengar-2 10.17.0.2 | ||
| 71 | ``` | ||
| 72 | |||
| 73 | at 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 | ||
| 76 | PING 10.17.0.2 (10.17.0.2) from 10.16.0.1 : 56(84) bytes of data. | ||
| 77 | 64 bytes from 10.17.0.2: icmp_seq=1 ttl=64 time=166 ms | ||
| 78 | 64 bytes from 10.17.0.2: icmp_seq=2 ttl=64 time=166 ms | ||
| 79 | 64 bytes from 10.17.0.2: icmp_seq=3 ttl=64 time=166 ms | ||
| 80 | |||
| 81 | --- 10.17.0.2 ping statistics --- | ||
| 82 | 3 packets transmitted, 3 received, 0% packet loss, time 2003ms | ||
| 83 | rtt min/avg/max/mdev = 166.263/166.300/166.366/0.046 ms | ||
| 84 | ``` | ||
| 85 | which shows the expected latency that is about 2x88ms between address 0 and 3 in the matrix. | ||
| 55 | 86 | ||
| 87 | ### 3. removing the network | ||
| 88 | this 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 | ||
| 90 | oar-p2p net down | ||
| 91 | ``` | ||
| 92 | |||
| 93 | ### 4. running containerized experiments | ||
| 94 | afer 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 | |||
| 96 | the 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 | ||
| 98 | cat << 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 | ] | ||
| 111 | EOF | ||
| 112 | ``` | ||
| 113 | |||
| 114 | when 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 @@ | |||
| 1 | FROM alpine:latest | ||
| 2 | COPY demo.sh /bin/demo.sh | ||
| 3 | RUN chmod +x /bin/demo.sh | ||
| 4 | ENTRYPOINT ["/bin/demo.sh"] | ||
| @@ -0,0 +1,5 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | echo $MESSAGE | ||
| 3 | sleep 2 | ||
| 4 | ping -c 3 -I $ADDRESS $REMOTE | ||
| 5 | sleep 1 | ||
