Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved bypass4netns implementation #39

Merged
merged 55 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
5f2c5fc
enable debug mode in bypass4netns when debug mode enabled
naoki9911 Oct 26, 2023
45de507
handle fcntl(2) and apply commands
naoki9911 Oct 26, 2023
95b8190
refactored bypass4netns
naoki9911 Nov 5, 2023
1daeb04
handling connections to bypassed socket
naoki9911 Nov 6, 2023
d285ff4
handling connections to other container's bypassed socket
naoki9911 Nov 7, 2023
f8a1501
check bypassable when connecting to bypassed socket
naoki9911 Nov 8, 2023
e091d5f
set tracer check interval
naoki9911 Nov 10, 2023
07f342a
adjust log level
naoki9911 Nov 10, 2023
2333fc6
handle getpeername(2) and rewrite address
naoki9911 Nov 10, 2023
13364d4
allow bypass between non-routable subnets
naoki9911 Nov 13, 2023
ddefd30
introducing address-rewriting based overlay network
naoki9911 Nov 16, 2023
2abf918
improved based on comments
naoki9911 Nov 21, 2023
a4b692c
fix tests
naoki9911 Nov 21, 2023
796e50b
FIXME: add current branch for CI
naoki9911 Nov 21, 2023
dea596a
fix lint
naoki9911 Nov 21, 2023
b326eec
run tests in lxc container
naoki9911 Nov 21, 2023
8b03586
add option for c2c communications
naoki9911 Nov 22, 2023
5d94ce9
run only one tracer agent
naoki9911 Nov 22, 2023
caf9bdc
Add tests
naoki9911 Nov 22, 2023
9f60cb2
check interfaces via iproute2
naoki9911 Nov 23, 2023
3b9044f
wait for background task registers interfaces
naoki9911 Nov 23, 2023
d9fddce
retry until success
naoki9911 Nov 23, 2023
e2a7c0e
add benchmark with redis
naoki9911 Nov 23, 2023
71c01a1
fix comments
naoki9911 Nov 23, 2023
e575f7a
add benchmark for multinode
naoki9911 Nov 24, 2023
8ef1436
read/write non-default user's process mem via agent
naoki9911 Nov 26, 2023
0fd3f7d
add PostgreSQL benchmark
naoki9911 Nov 26, 2023
442ba53
benchmark/redis: output logs as csv
naoki9911 Nov 27, 2023
3ba037d
add iperf3 benchmark
naoki9911 Nov 27, 2023
9ccca76
run test and benchmarks parallel
naoki9911 Nov 27, 2023
ebce700
plot redis benchmark result
naoki9911 Nov 28, 2023
456fd95
bump golangci/golangci-lint-action
naoki9911 Nov 28, 2023
9fa097a
bump actions/checkout
naoki9911 Nov 28, 2023
be27193
joint single/multinode benchmark results into one plot
naoki9911 Nov 28, 2023
61a8add
add iperf3 plot
naoki9911 Nov 28, 2023
f50cc1a
use common extension
naoki9911 Nov 28, 2023
26c2ac6
add postgres plot
naoki9911 Nov 29, 2023
68888af
move benchmarks to directories
naoki9911 Nov 30, 2023
c2ef9e3
handle threads
naoki9911 Nov 30, 2023
28c5945
try to re-register NotBypassable socket when connect(2) called.
naoki9911 Nov 30, 2023
70d73e3
add block benchmark (nginx, static linked go-based http client)
naoki9911 Nov 30, 2023
b7dc9ff
add static linked binary bypassing test
naoki9911 Nov 30, 2023
6724783
enable lxc privileged mode to run rootful nerdctl
naoki9911 Dec 1, 2023
eb7be2a
run rootful container test
naoki9911 Dec 1, 2023
4b15d23
add rootful container benchmarks
naoki9911 Dec 1, 2023
d33f3d6
split plots
naoki9911 Dec 1, 2023
be42b62
add memcached benchmark
naoki9911 Dec 3, 2023
b758625
add rabbitmq benchmark
naoki9911 Dec 3, 2023
b297fe6
add etcd benchmark
naoki9911 Dec 5, 2023
ac9e09f
add mysql benchmark
naoki9911 Dec 5, 2023
89622fa
add run_bench.sh
naoki9911 Dec 8, 2023
d06e9bc
improved benchmarks
naoki9911 Dec 9, 2023
4203229
ci: change hooked branches
naoki9911 Jan 10, 2024
4aef232
re-enable test
naoki9911 Jan 10, 2024
4b874fe
cleanup
naoki9911 Jan 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 192 additions & 16 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,215 @@
---
name: Test
on:
push:
branches:
- master
- 'release/**'
pull_request:
- main
- release/**
pull_request: null
workflow_dispatch:

jobs:
golangci-lint:
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v3.0.2
- uses: actions/checkout@v4.1.1
with:
fetch-depth: 1
- uses: actions/setup-go@v3
with:
go-version: 1.19.x
- run: sudo apt-get update && sudo apt-get install -y libseccomp-dev
- name: golangci-lint
uses: golangci/golangci-lint-action@v3.2.0
uses: golangci/golangci-lint-action@v3.7.0
with:
version: v1.49.0
version: v1.55.2
args: --verbose
ubuntu-2204:
name: "Ubuntu 22.04"
# nested virtualization is only available on macOS hosts
runs-on: macos-12
timeout-minutes: 30

create-lxc-image:
name: create-lxc-image
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/[email protected]

- uses: actions/cache/restore@v3
id: cache-restore
with:
key: lxc-image-base-${{ hashFiles('go.sum', 'test/init_test.sh') }}
path: /tmp/test-image.tar.zst
lookup-only: true

- name: setup lxd
id: s1
if: steps.cache-restore.outputs.cache-hit != 'true'
run: ./test/setup_lxd.sh

- name: launch lxc container
id: s2
if: steps.s1.conclusion == 'success'
run: ./test/launch_test_lxc.sh

- name: install dependencies and build
id: s3
if: steps.s2.conclusion == 'success'
run: sudo lxc exec test -- sudo --login --user ubuntu /host/test/init_test.sh

- name: export image
id: s4
if: steps.s3.conclusion == 'success'
run: ./test/export_lxc_image.sh test

- uses: actions/cache/save@v3
id: s5
if: steps.s4.conclusion == 'success'
with:
key: lxc-image-base-${{ hashFiles('go.sum', 'test/init_test.sh') }}
path: /tmp/test-image.tar.zst

test:
runs-on: ubuntu-22.04
needs: create-lxc-image
timeout-minutes: 20
steps:
- uses: actions/[email protected]
- name: setup lxd
run: ./test/setup_lxd.sh
- uses: actions/cache/restore@v3
id: cache-restore
with:
key: lxc-image-base-${{ hashFiles('go.sum', 'test/init_test.sh') }}
path: /tmp/test-image.tar.zst
fail-on-cache-miss: true
- name: load lxc image
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export
- name: launch lxc container
run: ./test/launch_test_lxc.sh test-export
- name: run test
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && /home/ubuntu/bypass4netns/test/run_test.sh SYNC"
# some source codes may be updated. re-export new image.
- name: export image
run: sudo lxc image alias delete test-export && rm -f /tmp/test-image.tar.zst && ./test/export_lxc_image.sh test
- uses: actions/cache/save@v3
with:
key: lxc-image-${{ github.sha }}
path: /tmp/test-image.tar.zst
#- name: debug
# run: ./debug.sh

benchmark:
runs-on: ubuntu-22.04
needs: test
timeout-minutes: 20
strategy:
matrix:
script: ["iperf3/iperf3_host", "iperf3/iperf3", "postgres/postgres", "redis/redis", "block/block", "memcached/memcached", "rabbitmq/rabbitmq", "etcd/etcd", "mysql/mysql"]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
- name: setup lxd
run: ./test/setup_lxd.sh
- uses: actions/cache/restore@v3
id: cache-restore
with:
key: lxc-image-${{ github.sha }}
path: /tmp/test-image.tar.zst
fail-on-cache-miss: true
- name: load lxc image
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export
- name: launch lxc container
run: ./test/launch_test_lxc.sh test-export
- name: run benchmark (${{ matrix.script }})
run: sudo lxc exec test -- sudo --login --user ubuntu /bin/bash -c "sleep 3 && /home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}.sh"
- name: upload plot
id: get_plot
if: matrix.script != 'iperf3/iperf3_host'
run: |
mkdir /tmp/benchmark-results
sudo lxc file pull test/home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}-rootful-direct.log /tmp/benchmark-results/.
sudo lxc file pull test/home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}-rootful-host.log /tmp/benchmark-results/.
sudo lxc file pull test/home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}-wo-b4ns-direct.log /tmp/benchmark-results/.
sudo lxc file pull test/home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}-wo-b4ns-host.log /tmp/benchmark-results/.
sudo lxc file pull test/home/ubuntu/bypass4netns/benchmark/${{ matrix.script }}-w-b4ns.log /tmp/benchmark-results/.
- uses: actions/upload-artifact@v3
if: steps.get_plot.conclusion == 'success'
with:
name: benchmark-results
path: /tmp/benchmark-results


- name: "Cache ~/.vagrant.d/boxes"
uses: actions/cache@v3
benchmark-multinode:
runs-on: ubuntu-22.04
needs: test
timeout-minutes: 20
strategy:
matrix:
script: ["iperf3/iperf3", "postgres/postgres", "redis/redis", "block/block", "memcached/memcached", "rabbitmq/rabbitmq", "etcd/etcd", "mysql/mysql"]
steps:
- uses: actions/[email protected]
- name: setup lxd
run: ./test/setup_lxd.sh
- uses: actions/cache/restore@v3
id: cache-restore
with:
key: lxc-image-${{ github.sha }}
path: /tmp/test-image.tar.zst
fail-on-cache-miss: true
- name: load lxc image
run: sudo lxc image import /tmp/test-image.tar.zst --alias test-export
- name: launch lxc container
run: ./test/launch_test_lxc.sh test-export
- name: run benchmark (${{ matrix.script }})
run: ./benchmark/${{ matrix.script }}_multinode.sh
- name: upload plot
run: |
mkdir /tmp/benchmark-results
cp benchmark/${{ matrix.script }}-multinode-rootful.log /tmp/benchmark-results/.
cp benchmark/${{ matrix.script }}-multinode-wo-b4ns.log /tmp/benchmark-results/.
cp benchmark/${{ matrix.script }}-multinode-w-b4ns.log /tmp/benchmark-results/.
- uses: actions/upload-artifact@v3
with:
name: benchmark-results
path: /tmp/benchmark-results

plot:
runs-on: ubuntu-22.04
needs: [benchmark, benchmark-multinode]
steps:
- uses: actions/[email protected]
- run: sudo apt update && sudo apt install python3 python3-pip
- run: pip3 install matplotlib numpy
- uses: actions/download-artifact@v3
with:
name: benchmark-results
path: ./
- run: mkdir /tmp/benchmark-plots
- run: python3 benchmark/redis/redis_plot.py redis-rootful-direct.log redis-rootful-host.log redis-wo-b4ns-direct.log redis-wo-b4ns-host.log redis-w-b4ns.log /tmp/benchmark-plots/redis.png
- run: python3 benchmark/redis/redis_plot.py redis-multinode-rootful.log redis-multinode-wo-b4ns.log redis-multinode-w-b4ns.log /tmp/benchmark-plots/redis-multinode.png
- run: python3 benchmark/iperf3/iperf3_plot.py iperf3-rootful-direct.log iperf3-rootful-host.log iperf3-wo-b4ns-direct.log iperf3-wo-b4ns-host.log iperf3-w-b4ns.log /tmp/benchmark-plots/iperf3.png
- run: python3 benchmark/iperf3/iperf3_plot.py iperf3-multinode-rootful.log iperf3-multinode-wo-b4ns.log iperf3-multinode-w-b4ns.log /tmp/benchmark-plots/iperf3-multinode.png
- run: python3 benchmark/postgres/postgres_plot.py postgres-rootful-direct.log postgres-rootful-host.log postgres-wo-b4ns-direct.log postgres-wo-b4ns-host.log postgres-w-b4ns.log /tmp/benchmark-plots/postgres.png
- run: python3 benchmark/postgres/postgres_plot.py postgres-multinode-rootful.log postgres-multinode-wo-b4ns.log postgres-multinode-w-b4ns.log /tmp/benchmark-plots/postgres-multinode.png
- run: python3 benchmark/block/block_plot.py block-rootful-direct.log block-rootful-host.log block-wo-b4ns-direct.log block-wo-b4ns-host.log block-w-b4ns.log /tmp/benchmark-plots/block.png
- run: python3 benchmark/block/block_plot.py block-multinode-rootful.log block-multinode-wo-b4ns.log block-multinode-w-b4ns.log /tmp/benchmark-plots/block-multinode.png
- run: python3 benchmark/memcached/memcached_plot.py memcached-rootful-direct.log memcached-rootful-host.log memcached-wo-b4ns-direct.log memcached-wo-b4ns-host.log memcached-w-b4ns.log /tmp/benchmark-plots/memcached.png
- run: python3 benchmark/memcached/memcached_plot.py memcached-multinode-rootful.log memcached-multinode-wo-b4ns.log memcached-multinode-w-b4ns.log /tmp/benchmark-plots/memcached-multinode.png
- run: python3 benchmark/rabbitmq/rabbitmq_plot.py rabbitmq-rootful-direct.log rabbitmq-rootful-host.log rabbitmq-wo-b4ns-direct.log rabbitmq-wo-b4ns-host.log rabbitmq-w-b4ns.log /tmp/benchmark-plots/rabbitmq.png
- run: python3 benchmark/rabbitmq/rabbitmq_plot.py rabbitmq-multinode-rootful.log rabbitmq-multinode-wo-b4ns.log rabbitmq-multinode-w-b4ns.log /tmp/benchmark-plots/rabbitmq-multinode.png
- run: python3 benchmark/etcd/etcd_plot.py etcd-rootful-direct.log etcd-rootful-host.log etcd-wo-b4ns-direct.log etcd-wo-b4ns-host.log etcd-w-b4ns.log /tmp/benchmark-plots/etcd.png
- run: python3 benchmark/etcd/etcd_plot.py etcd-multinode-rootful.log etcd-multinode-wo-b4ns.log etcd-multinode-w-b4ns.log /tmp/benchmark-plots/etcd-multinode.png
- run: python3 benchmark/mysql/mysql_plot.py mysql-rootful-direct.log mysql-rootful-host.log mysql-wo-b4ns-direct.log mysql-wo-b4ns-host.log mysql-w-b4ns.log /tmp/benchmark-plots/mysql.png
- run: python3 benchmark/mysql/mysql_plot.py mysql-multinode-rootful.log mysql-multinode-wo-b4ns.log mysql-multinode-w-b4ns.log /tmp/benchmark-plots/mysql-multinode.png
- uses: actions/upload-artifact@v3
with:
path: ~/.vagrant.d/boxes
key: vagrant-${{ hashFiles('Vagrantfile*') }}
name: benchmark-plots
path: /tmp/benchmark-plots

- run: vagrant up
bench-script:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- run: sudo ip a add 192.168.6.2/32 dev eth0
- run: hostname -I
- run: ./test/init_test.sh
- run: ~/bypass4netns/benchmark/run_bench.sh
122 changes: 0 additions & 122 deletions Vagrantfile

This file was deleted.

4 changes: 4 additions & 0 deletions benchmark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.csv
*.png
*.json
*.log
2 changes: 2 additions & 0 deletions benchmark/block/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
blk-*
bench
14 changes: 14 additions & 0 deletions benchmark/block/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang:1.21.3 as bench-builder

COPY bench.go .
# static link
RUN CGO_ENABLED=0 go build -o /bench bench.go

FROM ubuntu:22.04

RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y wget multitime nginx
COPY --from=bench-builder /bench /bench

CMD ["/bin/bash", "-c", "sleep infinity"]

Loading