[demos] Move all the benchmark demos together

This commit is contained in:
Zheng, Qi 2022-11-30 14:14:57 +08:00 committed by volcano
parent e54a3d1844
commit 3c11d589f4
23 changed files with 110 additions and 12 deletions

@ -653,13 +653,13 @@ jobs:
build-envs: 'OCCLUM_RELEASE_BUILD=1'
- name: Run sysbench download and build
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/sysbench && SGX_MODE=SIM ./dl_and_build.sh"
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/benchmarks/sysbench && SGX_MODE=SIM ./dl_and_build.sh"
- name: Run prepare sysbench occlum instance
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/sysbench && SGX_MODE=SIM ./prepare_sysbench.sh"
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/benchmarks/sysbench && SGX_MODE=SIM ./prepare_sysbench.sh"
- name: Run sysbench threads benchmark
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/sysbench/occlum_instance;
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/benchmarks/sysbench/occlum_instance;
occlum run /bin/sysbench threads --threads=200 --thread-yields=100 --thread-locks=4 --time=30 run"
Gvisor_syscalls_test:
@ -735,16 +735,16 @@ jobs:
build-envs: 'OCCLUM_RELEASE_BUILD=1'
- name: Build iperf2
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/iperf2; SGX_MODE=SIM ./build.sh"
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/benchmarks/iperf2; SGX_MODE=SIM ./build.sh"
- name: Start iperf2 server
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/iperf2/occlum_server;
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/benchmarks/iperf2/occlum_server;
occlum run /bin/iperf -s -p 6888 &"
- name: Start iperf2 client
run: |
sleep ${{ 5 }};
docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/iperf2/occlum_client;
docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/benchmarks/iperf2/occlum_client;
occlum run /bin/iperf -c 127.0.0.1 -p 6888 -P 16"
Linux_LTP_test:
@ -782,7 +782,7 @@ jobs:
build-envs: 'OCCLUM_RELEASE_BUILD=1'
- name: Build fio dependencies
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/fio && ./download_and_build_fio.sh"
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/benchmarks/fio && ./download_and_build_fio.sh"
- name: Run fio test
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/fio && SGX_MODE=SIM ./run_fio_on_occlum.sh fio-seq-read.fio"
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/benchmarks/fio && SGX_MODE=SIM ./run_fio_on_occlum.sh fio-seq-read.fio"

@ -16,7 +16,6 @@ This set of demos shows how real-world apps can be easily run inside SGX enclave
* [bash](bash/): A demo of [Bash](https://www.gnu.org/software/bash/) shell script.
* [cluster_serving](cluster_serving/): A demo of [Analytics Zoo Cluster Serving](https://analytics-zoo.github.io/master/#ClusterServingGuide/ProgrammingGuide/) inference solution.
* [fio](fio/): A demo of [Flexible I/O Tester](https://github.com/axboe/fio).
* [fish](fish/): A demo of [FISH](https://fishshell.com) shell script.
* [flink](flink/): A demo of [Apache Flink](https://flink.apache.org).
* [font](font/font_support_for_java): A demo of supporting font with Java.
@ -33,6 +32,16 @@ This set of demos shows how real-world apps can be easily run inside SGX enclave
* [vault](golang/vault/): A demo of [HashiCorp Vault](https://github.com/hashicorp/vault).
* [xgboost](xgboost/): A demo of [XGBoost](https://xgboost.readthedocs.io/en/latest).
## Benchmark demos
This set of demos shows how commonly used benchmarking tools can be run inside SGX enclaves with Occlum.
* [fio](benchmarks/fio/): A demo of [Flexible I/O Tester](https://github.com/axboe/fio).
* [iperf2](benchmarks/iperf2/): A demo of [Iperf2](https://sourceforge.net/projects/iperf2/), a tool for measuring Internet bandwidth performance.
* [iperf3](benchmarks/iperf3/): A demo of [Iperf3](https://github.com/esnet/iperf), a tool for measuring Internet bandwidth performance.
* [sysbench](benchmarks/sysbench/): A demo of [Sysbench](https://github.com/akopytov/sysbench), a scriptable multi-threaded benchmark tool for Linux.
## Programming language demos
This set of demos shows how apps written with popular programming languages can be run inside SGX enclaves with Occlum.

@ -0,0 +1,9 @@
# Benchmark Demos
This set of demos shows how commonly used benchmarking tools can be run inside SGX enclaves with Occlum.
* [fio](fio/): A demo of [Flexible I/O Tester](https://github.com/axboe/fio).
* [iperf2](iperf2/): A demo of [Iperf2](https://sourceforge.net/projects/iperf2/), a tool for measuring Internet bandwidth performance.
* [iperf3](iperf3/): A demo of [Iperf3](https://github.com/esnet/iperf), a tool for measuring Internet bandwidth performance.
* [sysbench](sysbench/): A demo of [Sysbench](https://github.com/akopytov/sysbench), a scriptable multi-threaded benchmark tool for Linux.

@ -0,0 +1,28 @@
# Run iperf3 on Occlum
[`Iperf3`](https://github.com/esnet/iperf) is a popular tool for measuring Internet bandwidth performance.
### Build
```
./build.sh
```
If everything goes well, it generates two occlum instances.
```
occlum_server
occlum_client
```
### Run the test
* Start the iperf3 server for on one time benchmark
```
cd occlum_server
occlum run /bin/iperf3 -s -p 6777 -1
```
* Start the iperf3 client with 16 streams
```
cd occlum_client
occlum run /bin/iperf3 -c 127.0.0.1 -p 6777 -P 16
```

@ -0,0 +1,39 @@
#! /bin/bash
set -e
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export IPERF3_INSTALL_DIR=${script_dir}/iperf-install
function dl_and_build_iperf()
{
rm -rf iperf-*
rm -rf 3.11*
mkdir -p ${IPERF3_INSTALL_DIR}
wget https://github.com/esnet/iperf/archive/refs/tags/3.11.tar.gz
tar zxf 3.11.tar.gz
pushd iperf-3.11
./configure
make install exec_prefix=${IPERF3_INSTALL_DIR}
popd
}
function build_occlum_instance()
{
name=$1
rm -rf ${name}
occlum new ${name}
pushd ${name}
copy_bom -f ../iperf3.yaml --root image --include-dir /opt/occlum/etc/template
new_json="$(jq '.resource_limits.user_space_size = "1000MB" |
.resource_limits.max_num_of_threads = 64 ' Occlum.json)" && \
echo "${new_json}" > Occlum.json
occlum build
popd
}
dl_and_build_iperf
build_occlum_instance occlum_server
build_occlum_instance occlum_client

@ -0,0 +1,13 @@
includes:
- base.yaml
# bash
targets:
# copy iperf
- target: /bin
copy:
- files:
- ${IPERF3_INSTALL_DIR}/bin/iperf3
- target: /opt/occlum/glibc/lib
copy:
- files:
- ${IPERF3_INSTALL_DIR}/lib/libiperf.so.0

@ -10,7 +10,7 @@ copy_bom -f ../sysbench.yaml --root image --include-dir /opt/occlum/etc/template
new_json="$(jq '.resource_limits.user_space_size = "800MB" |
.resource_limits.max_num_of_threads = 256 ' Occlum.json)" && \
echo "${new_json}" > Occlum.json
echo "${new_json}" > Occlum.json
occlum build
#occlum run /bin/sysbench threads --threads=200 --thread-yields=100 --thread-locks=4 --time=10 run