Skip to content

Commit df993a2

Browse files
committed
RAKIS init
1 parent 0b55269 commit df993a2

File tree

185 files changed

+25740
-189
lines changed

Some content is hidden

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

185 files changed

+25740
-189
lines changed

Diff for: .gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/build
22
/install
3-
/obj-*
43

54
# No editor backup files.
65
*.sw*
@@ -49,3 +48,6 @@ TAGS
4948
cscope.*
5049
ncscope.*
5150
*cscope*
51+
52+
.cache/
53+
compile_commands.json

Diff for: CI-Examples/curl/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*-src
2+
/*-ins
3+
/.lck
4+
/curl
5+
/nghttpx
6+
/out

Diff for: CI-Examples/curl/Makefile

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
ARCH_LIBDIR ?= /lib/$(shell $(CC) -dumpmachine)
2+
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
3+
4+
ifeq ($(DEBUG),1)
5+
GRAMINE_LOG_LEVEL = debug
6+
else
7+
GRAMINE_LOG_LEVEL = error
8+
endif
9+
10+
CURL_SRC = curl-src
11+
CURL_INS = curl-ins
12+
13+
OPENSSL_SRC = openssl-src
14+
OPENSSL_INS = openssl-ins
15+
16+
NGTCP2_SRC = ngtcp2-src
17+
NGTCP2_INS = ngtcp2-ins
18+
19+
NGHTTP3_SRC = nghttp3-src
20+
NGHTTP3_INS = nghttp3-ins
21+
22+
NGHTTP2_SRC = nghttp2-src
23+
NGHTTP2_INS = nghttp2-ins
24+
25+
JANSSON_SRC = jansson-src
26+
JANSSON_INS = jansson-ins
27+
28+
EUROSYS_EXP_DOWNLOAD_SIZE ?= 1G
29+
30+
.PHONY: all
31+
all: curl curl.manifest nghttpx
32+
ifeq ($(SGX),1)
33+
all: curl.manifest.sgx curl.sig curl.token nghttpx
34+
endif
35+
36+
curl.manifest: curl.manifest.template
37+
gramine-manifest \
38+
-Dlog_level=$(GRAMINE_LOG_LEVEL) \
39+
-Darch_libdir=$(ARCH_LIBDIR) \
40+
-Dlibcurl_dir=$(ROOT_DIR)/$(CURL_INS)/lib/ \
41+
-Dlibssl_dir=$(ROOT_DIR)/$(OPENSSL_INS)/lib64/ \
42+
-Dlibnghttp3_dir=$(ROOT_DIR)/$(NGHTTP3_INS)/lib/ \
43+
-Dlibngtcp2_dir=$(ROOT_DIR)/$(NGTCP2_INS)/lib/ \
44+
$< > $@
45+
46+
curl.manifest.sgx curl.sig: sgx_sign
47+
@:
48+
49+
.INTERMEDIATE: sgx_sign
50+
sgx_sign: curl.manifest curl
51+
gramine-sgx-sign \
52+
--manifest $< \
53+
--output $<.sgx
54+
55+
curl.token: curl.sig
56+
gramine-sgx-get-token \
57+
--output curl.token --sig curl.sig
58+
59+
$(OPENSSL_INS)/lib64/:
60+
git clone --depth 1 -b openssl-3.0.9+quic \
61+
https://github.com/quictls/openssl $(OPENSSL_SRC) && \
62+
cd $(OPENSSL_SRC) && ./config enable-tls1_3 \
63+
--prefix=$(ROOT_DIR)/$(OPENSSL_INS) && make install
64+
65+
$(NGHTTP3_INS)/lib:
66+
git clone -b v0.12.0 https://github.com/ngtcp2/nghttp3 $(NGHTTP3_SRC) && \
67+
cd $(NGHTTP3_SRC) && autoreconf -i && ./configure --prefix=$(ROOT_DIR)/$(NGHTTP3_INS) --enable-lib-only && \
68+
make install
69+
70+
$(NGTCP2_INS)/lib: $(OPENSSL_INS)/lib64/ $(NGHTTP3_INS)/lib
71+
git clone -b v0.16.0 https://github.com/ngtcp2/ngtcp2 $(NGTCP2_SRC) && \
72+
cd $(NGTCP2_SRC) && autoreconf -i && \
73+
PKG_CONFIG_PATH=$(ROOT_DIR)/$(NGHTTP3_INS)/lib/pkgconfig:$(ROOT_DIR)/$(OPENSSL_INS)/lib64/pkgconfig \
74+
LDFLAGS="-Wl,-rpath,$(ROOT_DIR)/$(OPENSSL_INS)/lib64" \
75+
./configure --prefix=$(ROOT_DIR)/$(NGTCP2_INS) --enable-lib-only && \
76+
make install
77+
78+
$(CURL_INS)/bin/curl: $(NGTCP2_INS)/lib
79+
git clone https://github.com/curl/curl $(CURL_SRC) && \
80+
cd $(CURL_SRC) && git checkout 1eca27f && \
81+
autoreconf -fi && LDFLAGS="-Wl,-rpath,$(ROOT_DIR)/$(OPENSSL_INS)/lib64" \
82+
./configure --with-openssl=$(ROOT_DIR)/$(OPENSSL_INS) \
83+
--with-nghttp3=$(ROOT_DIR)/$(NGHTTP3_INS) --with-ngtcp2=$(ROOT_DIR)/$(NGTCP2_INS) \
84+
--prefix=$(ROOT_DIR)/$(CURL_INS) && \
85+
make install
86+
87+
$(JANSSON_INS)/lib:
88+
git clone https://github.com/akheron/jansson.git $(JANSSON_SRC) && \
89+
cd $(JANSSON_SRC) && git checkout 2.10 && \
90+
mkdir build && cd build && cmake ../ -DCMAKE_INSTALL_PREFIX=$(ROOT_DIR)/$(JANSSON_INS) && \
91+
make install
92+
93+
$(NGHTTP2_INS)/bin/nghttpx: $(NGTCP2_INS)/lib $(JANSSON_INS)/lib
94+
git clone https://github.com/nghttp2/nghttp2.git $(NGHTTP2_SRC) && \
95+
cd $(NGHTTP2_SRC) && git checkout e7f5940 && \
96+
autoreconf -fi && \
97+
PKG_CONFIG_PATH=$(ROOT_DIR)/$(NGHTTP3_INS)/lib/pkgconfig:$(ROOT_DIR)/$(OPENSSL_INS)/lib64/pkgconfig:$(ROOT_DIR)/$(JANSSON_INS)/lib/pkgconfig:$(ROOT_DIR)/$(NGTCP2_INS)/lib/pkgconfig \
98+
LDFLAGS="-Wl,-rpath,$(ROOT_DIR)/$(OPENSSL_INS)/lib64" \
99+
CFLAGS=-I$(ROOT_DIR)/$(OPENSSL_INS)/include \
100+
./configure --enable-maintainer-mode --prefix=$(ROOT_DIR)/$(NGHTTP2_INS) \
101+
--disable-shared --enable-app --enable-http3 --without-jemalloc \
102+
--without-libxml2 --without-systemd && \
103+
make install
104+
105+
curl: $(CURL_INS)/bin/curl
106+
cp $< $@
107+
touch out
108+
109+
nghttpx: $(NGHTTP2_INS)/bin/nghttpx
110+
cp $< $@
111+
112+
.PHONY: clean
113+
clean:
114+
$(RM) *.token *.sig *.manifest.sgx *.manifest curl .lck nghttpx out
115+
116+
.PHONY: distclean
117+
distclean: clean
118+
$(RM) -r $(CURL_SRC) $(CURL_INS) \
119+
$(OPENSSL_SRC) $(OPENSSL_INS) $(NGTCP2_SRC) \
120+
$(NGTCP2_INS) $(NGHTTP3_SRC) $(NGHTTP3_INS) \
121+
$(NGHTTP2_SRC) $(NGHTTP2_INS) $(JANSSON_SRC) $(JANSSON_INS)
122+
123+
124+
eurosys-reproduce-curl-%-sgx: export SGX := 1
125+
126+
eurosys-reproduce-curl-gramine-%: export PATH := $(HOME)/.local/gramine/bin:$(PATH)
127+
eurosys-reproduce-curl-gramine-%: export PYTHONPATH := $(HOME)/.local/gramine/lib/python3.10/site-packages:$(PYTHONPATH)
128+
eurosys-reproduce-curl-gramine-%: export PKG_CONFIG_PATH := $(HOME)/.local/gramine/lib/x86_64-linux-gnu/pkgconfig:$(PKG_CONFIG_PATH)
129+
eurosys-reproduce-curl-gramine-%: export SETTING := Gramine
130+
131+
eurosys-reproduce-curl-rakis-%: export PATH := $(HOME)/.local/rakis/bin:$(PATH)
132+
eurosys-reproduce-curl-rakis-%: export PYTHONPATH := $(HOME)/.local/rakis/lib/python3.10/site-packages:$(PYTHONPATH)
133+
eurosys-reproduce-curl-rakis-%: export PKG_CONFIG_PATH := $(HOME)/.local/rakis/lib/x86_64-linux-gnu/pkgconfig:$(PKG_CONFIG_PATH)
134+
eurosys-reproduce-curl-rakis-%: export SETTING := Rakis
135+
136+
eurosys-reproduce-curl-native: export NATIVE := 1
137+
eurosys-reproduce-curl-native: export PATH := $(HOME)/.local/rakis/bin:$(PATH)
138+
eurosys-reproduce-curl-native: export PYTHONPATH := $(HOME)/.local/rakis/lib/python3.10/site-packages:$(PYTHONPATH)
139+
eurosys-reproduce-curl-native: export PKG_CONFIG_PATH := $(HOME)/.local/rakis/lib/x86_64-linux-gnu/pkgconfig:$(PKG_CONFIG_PATH)
140+
141+
eurosys-reproduce-curl-%: clean
142+
$(MAKE) eurosys-reproduce-run-curl
143+
144+
eurosys-reproduce-run-curl: all
145+
ifeq ($(NATIVE),1)
146+
@echo "\n******************************************"
147+
@echo "[*] Running curl in NATIVE setting..."
148+
./curl --http3-only https://10.50.0.2:9443/dump$(EUROSYS_EXP_DOWNLOAD_SIZE) --insecure -o out -w "@curl-format.txt" -Z
149+
150+
else ifeq ($(SGX),1)
151+
@echo "\n******************************************"
152+
@echo "[*] Running Curl in $(SETTING)-SGX setting..."
153+
gramine-sgx ./curl --http3-only https://10.50.0.2:9443/dump$(EUROSYS_EXP_DOWNLOAD_SIZE) --insecure -o out -w "@curl-format.txt" -Z
154+
155+
else
156+
@echo "\n******************************************"
157+
@echo "[*] Running Curl in $(SETTING)-Direct setting..."
158+
gramine-direct ./curl --http3-only https://10.50.0.2:9443/dump$(EUROSYS_EXP_DOWNLOAD_SIZE) --insecure -o out -w "@curl-format.txt" -Z
159+
endif

Diff for: CI-Examples/curl/README.md

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Curl (Rakis experiment)
2+
3+
We use curl to test the performance of UDP in RAKIS. Basically, we try to
4+
download files of different sizes using the quic protocol which uses UDP.
5+
Unfortunately, as quic is still experimental in Curl, we have to build it from
6+
source with all of its dependencies, as well as a proxy server that can serve
7+
files over quic protocol.
8+
9+
Running `make SGX=1` should be enough to build everything. It may take time so
10+
grab a cup of coffee.
11+
12+
Once the build process is done, we should see two binaries: `curl` and
13+
`nghttpx`.
14+
15+
In addition to this build process, we need an http server that can run behind
16+
`nghttpx` and do the actual serving of files. For our purpose, we will use
17+
`apache`. You can choose whatever server you like.
18+
19+
Lets first take care of running the server and the proxy `nghttpx`.
20+
We want our http server and proxy to reside on the client_ns network namespace;
21+
excuse the confusing name of the network namespace as it will be hosting the
22+
server part of the experiment but it really does not matter as long as we have
23+
client part and server in two different network namespace. To do that, first we
24+
run apache as follows:
25+
```
26+
APACHE_STARTED_BY_SYSTEMD=true sudo -E ip netns exec client_ns /usr/sbin/apachectl start
27+
```
28+
29+
Then, we run the `nghttpx` proxy server in-front of it also within the
30+
client_ns namespace. For the certificates, we will just use the sample
31+
certificates provided in curl source code:
32+
```
33+
sudo ip netns exec client_ns ./nghttpx /home/mansour/rakis/CI-Examples/curl/curl-src/tests/stunnel.pem /home/mansour/rakis/CI-Examples/curl/curl-src/tests/stunnel.pem --backend=0.0.0.0,80 --frontend="10.50.0.2,9443;quic"
34+
```
35+
36+
With that, our server should be ready to serve files with quic protocol in the
37+
client_ns.
38+
39+
Now we run curl:
40+
```
41+
gramine-sgx ./curl --http3-only https://10.50.0.2:9443/dump1G --insecure -o out -w "@curl-format.txt" -Z
42+
```
43+
44+
## Eurosys artifact reviewers
45+
46+
Our server already has `apache` and the `nghttpx` proxy running on the client_ns
47+
network namespace. So you can skip setting up the server and only worry about
48+
running the curl process with different runtime settings.
49+
50+
We provide Makefile targets that will make this easier and less confusing:
51+
52+
| Target | Setting |
53+
| ------- | -------- |
54+
| eurosys-reproduce-curl-native | native |
55+
| eurosys-reproduce-curl-gramine-sgx | Gramine-SGX |
56+
| eurosys-reproduce-curl-gramine-direct | Gramine-Direct |
57+
| eurosys-reproduce-curl-rakis-sgx | Rakis-SGX |
58+
| eurosys-reproduce-curl-rakis-direct | Rakis-direct |
59+
60+
To set the size of the file to download, simply set the
61+
`EUROSYS_EXP_DOWNLOAD_SIZE` environment variable before invoking make. The
62+
default file to download is of size 1G.
63+
64+
For example, to use Rakis-SGX to download 100M file you can run:
65+
```
66+
EUROSYS_EXP_DOWNLOAD_SIZE=100M make eurosys-reproduce-curl-rakis-sgx
67+
```
68+
69+
The make command will take a long time for the first run to compile everything
70+
(about 10 mins) needed but will just run curl for later runs. The total_time in
71+
the output is what we used to report in the paper, normalized to the native
72+
execution download times.

Diff for: CI-Examples/curl/curl-format.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
time_namelookup: %{time_namelookup}s\n
2+
time_connect: %{time_connect}s\n
3+
time_appconnect: %{time_appconnect}s\n
4+
time_pretransfer: %{time_pretransfer}s\n
5+
time_redirect: %{time_redirect}s\n
6+
time_starttransfer: %{time_starttransfer}s\n
7+
----------\n
8+
time_total: %{time_total} && speed_download: %{speed_download}
9+
size_upload: %{size_upload} bytes\n
10+
speed_upload: %{speed_upload} bytes/s\n
11+
num_connects: %{num_connects}\n
12+
num_redirects: %{num_redirects}\n
13+
redirect_url: %{redirect_url}\n

Diff for: CI-Examples/curl/curl.manifest.template

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Memcached manifest file example
2+
3+
loader.entrypoint = "file:{{ gramine.libos }}"
4+
libos.entrypoint = "/curl"
5+
6+
loader.log_level = "{{ log_level }}"
7+
8+
loader.env.LD_LIBRARY_PATH = "/libcurl/:/libssl/:/libnghttp3/:/libngtcp2/:/lib:{{ arch_libdir }}:/usr/{{ arch_libdir }}"
9+
10+
loader.insecure__use_cmdline_argv = true
11+
12+
sys.enable_sigterm_injection = true
13+
14+
fs.mounts = [
15+
{ path = "/lib", uri = "file:{{ gramine.runtimedir() }}" },
16+
{ path = "{{ arch_libdir }}", uri = "file:{{ arch_libdir }}" },
17+
{ path = "/usr/{{ arch_libdir }}", uri = "file:/usr/{{ arch_libdir }}" },
18+
{ path = "/libcurl/", uri = "file:{{ libcurl_dir }}"},
19+
{ path = "/libssl/", uri = "file:{{ libssl_dir }}"},
20+
{ path = "/libnghttp3/", uri = "file:{{ libnghttp3_dir }}"},
21+
{ path = "/libngtcp2/", uri = "file:{{ libngtcp2_dir }}"},
22+
{ path = "/etc", uri = "file:/etc" },
23+
{ path = "/curl", uri = "file:curl" },
24+
{ path = "/curl-format.txt", uri = "file:curl-format.txt" },
25+
{ path = "/out", uri = "file:out" },
26+
]
27+
28+
sgx.debug = false
29+
sgx.nonpie_binary = true
30+
sgx.max_threads = 24
31+
32+
33+
# Memcached does not fail explicitly when enclave memory is exhausted. Instead, Memcached goes into
34+
# infinite loop without a listening socket. You can trigger this incorrect behavior by increasing
35+
# the number of threads to 12 (each thread requires 128MB of memory): `curl -t 12`. This is an
36+
# issue in Memcached source code, not related to Gramine.
37+
sgx.enclave_size = "1024M"
38+
39+
sgx.trusted_files = [
40+
"file:{{ gramine.libos }}",
41+
"file:curl",
42+
"file:{{ gramine.runtimedir() }}/",
43+
"file:{{ arch_libdir }}/",
44+
"file:/usr/{{ arch_libdir }}/",
45+
"file:{{ libcurl_dir }}",
46+
"file:{{ libssl_dir }}",
47+
"file:{{ libnghttp3_dir }}",
48+
"file:{{ libngtcp2_dir }}",
49+
"file:curl-format.txt"
50+
]
51+
52+
sgx.allowed_files = [
53+
"file:/etc/nsswitch.conf",
54+
"file:/etc/ethers",
55+
"file:/etc/hosts",
56+
"file:/etc/group",
57+
"file:/etc/passwd",
58+
"file:/etc/gai.conf",
59+
"file:out"
60+
]
61+
62+
rakis.enabled = true
63+
rakis.net_threads_num = 1
64+
rakis.netifs = [ { interface_name = "ens1f0", ip_addr = "10.50.0.1", gw_addr = "10.50.0.1", netmask = "255.255.0.0", mac_addr = "40:a6:b7:40:37:f8", xsks = [ { qid = 0, ctrl_prcs_path = "/tmp/rakis-xdp-def-ctrl" }] } ]
65+
rakis.io_uring.io_urings_num = 24
66+
rakis.arp_table = [ { ip_addr = "10.50.0.2", mac_addr = "40:a6:b7:40:37:f9" } ]

Diff for: CI-Examples/iperf3/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
iperf/
2+
iperf3
3+
compile_commands.json
4+
results-*.csv

0 commit comments

Comments
 (0)