Skip to content

Commit d85b09c

Browse files
committed
First commit
1 parent dea021c commit d85b09c

File tree

135 files changed

+14373
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+14373
-1
lines changed

.github/workflows/morpheus-build.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Morpheus Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
BUILD_TYPE: Release
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-20.04, ubuntu-18.04, ubuntu-latest]
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
submodules: 'recursive'
22+
- name: System info
23+
run: |
24+
uname -a
25+
- name: Configure and Build
26+
run: |
27+
chmod +x "${GITHUB_WORKSPACE}/setup_dut.sh"
28+
${GITHUB_WORKSPACE}/setup_dut.sh
29+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Morpheus Packet Generator Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
BUILD_TYPE: Release
10+
11+
jobs:
12+
build:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [ubuntu-20.04, ubuntu-18.04, ubuntu-latest]
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
with:
21+
submodules: 'recursive'
22+
- name: System info
23+
run: |
24+
uname -a
25+
- name: Configure and Build
26+
run: |
27+
chmod +x "${GITHUB_WORKSPACE}/setup_pktgen.sh"
28+
${GITHUB_WORKSPACE}/setup_pktgen.sh -q
29+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
polycube/
2+
deps/

README.md

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,93 @@
1-
# Morpheus
1+
# Morpheus: Domain Specific Run Time Optimization for Software Data Planes
2+
3+
[![Morpheus DUT Build](https://github.com/Morpheus-compiler/Morpheus/actions/workflows/morpheus-build.yml/badge.svg)](https://github.com/Morpheus-compiler/Morpheus/actions/workflows/morpheus-build.yml)
4+
[![Morpheus Packet Generator Build](https://github.com/Morpheus-compiler/Morpheus/actions/workflows/morpheus-pktgen-build.yml/badge.svg)](https://github.com/Morpheus-compiler/Morpheus/actions/workflows/morpheus-pktgen-build.yml)
5+
6+
Morpheus is a system working alongside static compilers that continuously optimizes the targeted networking code.
7+
It introduces a number of new techniques, from static code analysis to adaptive code instrumentation, together with a toolbox of domain specific optimizations used to manipulate the code on-the-fly depending on runtime traffic patterns and control plane configurations.
8+
9+
<p align="center">
10+
<img src="morpheus-logo.svg" alt="Morpheus" width="80%">
11+
</p>
12+
<p align="center">
13+
<sub>Morpheus compilation pipeline.</sub>
14+
</p>
15+
16+
The Morpheus core exploits the **LLVM compiler** toolchain (v10.0.1) for code manipulation and run-time code generation. It works at the *intermediate representation* (IR) level as it allows to reason about the running code using a relatively high-level language framework without compromising on code generation time.
17+
18+
The Morpheus compilation pipeline is characterized of three main steps:
19+
1. **Code Analysis**: In the first pass, Morpheus uses ***static code analysis*** to identify all map access sites in
20+
the code, understand whether a particular access is a read or a write operation, and reason about the way the result is
21+
used later in the code. In particular, signature-based call site analysis is used to track map lookup and update calls, and then a combination of ***memory dependency analysis*** and ***alias analysis*** is performed to match map lookups to map updates.
22+
2. **Instrumentation**: In the second pass, Morpheus profiles the dynamics of the input traffic by generating ***heatmaps*** of the maps’ access patterns, so that the collected statistics can then be used to drive the subsequent optimization passes.
23+
3. **Optimization Passes**: The third step of the compilation pipeline is where all online code transformations are applied (e.g., *JIT compilation*, *Dead code elimination*, *Constant Propagation*, *Guard Elision*).
24+
25+
For more information, please read the Morpheus's [paper](https://sebymiano.github.io/publication/2022-morpheus/2022-morpheus.pdf) and the [extended abstract](https://sebymiano.github.io/publication/2022-morpheus/2022-morpheus_abstract.pdf) accepted to [ASPLOS '22](https://asplos-conference.org/2022/).
26+
27+
## Compile and run Morpheus
28+
29+
### eBPF Plugin
30+
Morpheus leverages the [Polycube](https://sebymiano.github.io/publication/2021-polycube/2021-polycube.pdf) framework as an eBPF backend to manage chains of in-kernel packet processing programs.
31+
Polycube readily delivers almost all the needed components for an eBPF backend. We extended the original Polycube framework with [our custom version](https://github.com/Morpheus-compiler/polycube) (original repo is [here](https://github.com/polycube-network/polycube)), and we added a mechanism for updating the data plane program on-the-fly and defined templates to inject guards.
32+
33+
Most of the Morpheus compilation toolchain is instead implemented inside the [BCC framework](https://github.com/iovisor/bcc) (our custom version is [here](https://github.com/Morpheus-compiler/bcc)).
34+
35+
### Installation
36+
37+
To install Morpheus, you can use the script `setup_dut.sh` provided in this repository.
38+
It will download all the dependencies and the required files, and it will install the *Polycube* framework with **Morpheus** support.
39+
40+
```console
41+
$ git clone git@github.com:Morpheus-compiler/Morpheus.git
42+
$ chmod +x setup_dut.sh
43+
$ ./setup_dut.sh
44+
```
45+
46+
**Note: All the scripts and results have been performed with Ubuntu 20.04 and kernel version 5.12. You can still install Morpheus even if your kernel version is lower, but the results may be different from the one presented in the paper.**
47+
48+
If you want to upgrade your kernel, you can follow [this](https://polycube-network.readthedocs.io/en/latest/installation.html#updating-linux-kernel) guide.
49+
50+
### Run Morpheus
51+
In this section we provide instructions to run Morpheus with a sample eBPF service (e.g., the router), just to see it up and running (in case you do not trust us!).
52+
For all the experiments presented in the paper please look at Section [*Experiments*](#experiments), which however require a careful testbed preparation.
53+
54+
After Morpheus is installed, you can start the Polycube daemon (i.e., *polycubed*) and create new services.
55+
56+
### Example of Morpheus optimizer (Router service)
57+
58+
We provide here an example of how Morpheus works. This setup does not requires testbed preparation, and it can be executed on a single machine.
59+
It uses two namespaces and attaches the Polycube eBPF *router* Network Function (NF) to the *Traffic Control* (TC) hook of the *veth* interfaces connected to the namespaces.
60+
61+
To run this example, follow these instructions:
62+
63+
```console
64+
$ cd experiments/router/simple/pcap
65+
$ git lfs pull #This pull the PCAP file that we use in our test
66+
```
67+
68+
Now open a new terminal, and type the following command to start the Polycube daemon:
69+
```console
70+
$ sudo polycubed
71+
```
72+
after few seconds, the *Polycube* daemon will start and it will load a set of NFs.
73+
74+
Now go on another terminal, and run the test:
75+
```console
76+
$ cd experiments/router/simple
77+
$ sudo ./router-simple-start.sh
78+
```
79+
80+
This test will first create the containers and instantiate the Router service. At a given point, it will ask the user to start sending the PCAP trace from the first to the second namespace, and it will print the throughput before and after *Morpheus* is enabled.
81+
You will notice that, when *Morpheus* is active the throughput will start increasing as soon as the traffic-level optimizations are applied.
82+
83+
## Experiments
84+
85+
In addition to the previously presented experiment, which allows to run the first simple application under Morpheus, we provide under the [`experiments/`](./experiments) folder the experiments presented in the paper.
86+
The folder contains a [`README.md`](./experiments//README.md) file with all the instructions needed to set up the testbed, generate the trace used for the tests, produce the results and create the final figures.
87+
88+
**Please note that all the experiments require two servers connected back-to-back with 2 different interface. The first server is used as packet generator (uses DPDK), while the second is used as Device Under Test (DUT) and runs the data plane application together with the *Morheus* compiler/optimizer.**
89+
90+
## Need help?
91+
92+
If you have problems installing the code or executing the scripts available in this repo, please open an issue.
93+
If you have other question about the code or the paper, contact [Sebastiano Miano](https://sebymiano.github.io) (`s.miano at qmul.ac.uk`).

download_pcaps.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
COLOR_RED='\033[0;31m'
4+
COLOR_GREEN='\033[0;32m'
5+
COLOR_YELLOW='\033[0;33m'
6+
COLOR_OFF='\033[0m' # No Color
7+
8+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
9+
10+
bpf_iptables_PCAP_URL=https://github.com/Morpheus-compiler/Morpheus/releases/download/v0.1/bpf-iptables-pcap.tar.gz
11+
katran_PCAP_URL=https://github.com/Morpheus-compiler/Morpheus/releases/download/v0.1/katran-pcap.tar.gz
12+
router_PCAP_URL=https://github.com/Morpheus-compiler/Morpheus/releases/download/v0.1/router-pcap.tar.gz
13+
switch_PCAP_URL=https://github.com/Morpheus-compiler/Morpheus/releases/download/v0.1/switch-pcap.tar.gz
14+
15+
declare -a services=("router" "bpf-iptables" "switch" "katran")
16+
17+
for service in "${services[@]}"; do
18+
pushd .
19+
cd "${DIR}/experiments/${service}"
20+
if [ ${service} == "bpf-iptables" ]; then
21+
url_var_name=bpf_iptables_PCAP_URL
22+
else
23+
url_var_name=${service}_PCAP_URL
24+
fi
25+
26+
wget ${!url_var_name}
27+
rm -rf ${DIR}/experiments/${service}/pcap
28+
mkdir -p ${DIR}/experiments/${service}/pcap
29+
tar -xf ${service}-pcap.tar.gz -C ${DIR}/experiments/${service}/pcap
30+
rm ${service}-pcap.tar.gz
31+
popd
32+
done

experiments/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
config_*.sh
2+
router/pcap/
3+
switch/pcap/
4+
katran/pcap/
5+
bpf-iptables/pcap/

0 commit comments

Comments
 (0)