Add iperf2 demo
This commit is contained in:
parent
40ad9d1648
commit
495c6695a9
25
.github/workflows/demo_test.yml
vendored
25
.github/workflows/demo_test.yml
vendored
@ -707,6 +707,31 @@ jobs:
|
||||
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/python/flask;
|
||||
curl --cacert flask.crt -X GET https://localhost:4996/customer/1"
|
||||
|
||||
iperf2_test:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- uses: ./.github/workflows/composite_action/sim
|
||||
with:
|
||||
container-name: ${{ github.job }}
|
||||
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"
|
||||
|
||||
- name: Start iperf2 server
|
||||
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/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;
|
||||
occlum run /bin/iperf -c 127.0.0.1 -p 6888 -P 16"
|
||||
|
||||
Linux_LTP_test:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
|
28
demos/iperf2/README.md
Normal file
28
demos/iperf2/README.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Run iperf2 on Occlum
|
||||
|
||||
[`Iperf2`](https://sourceforge.net/projects/iperf2/) 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 iperf2 server
|
||||
```
|
||||
cd occlum_server
|
||||
occlum run /bin/iperf -s -p 6888
|
||||
```
|
||||
|
||||
* Start the iperf2 client with 16 threads
|
||||
```
|
||||
cd occlum_client
|
||||
occlum run /bin/iperf -c 127.0.0.1 -p 6888 -P 16
|
||||
```
|
38
demos/iperf2/build.sh
Executable file
38
demos/iperf2/build.sh
Executable file
@ -0,0 +1,38 @@
|
||||
#! /bin/bash
|
||||
set -e
|
||||
|
||||
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
|
||||
export IPERF_INSTALL_DIR=${script_dir}/iperf2-install
|
||||
|
||||
function dl_and_build_iperf()
|
||||
{
|
||||
rm -rf iperf2-*
|
||||
rm -rf ${IPERF_INSTALL_DIR}
|
||||
mkdir -p ${IPERF_INSTALL_DIR}
|
||||
git clone https://git.code.sf.net/p/iperf2/code iperf2-code
|
||||
pushd iperf2-code
|
||||
./configure
|
||||
make install exec_prefix=${IPERF_INSTALL_DIR}
|
||||
popd
|
||||
}
|
||||
|
||||
function build_occlum_instance()
|
||||
{
|
||||
name=$1
|
||||
rm -rf ${name}
|
||||
occlum new ${name}
|
||||
pushd ${name}
|
||||
copy_bom -f ../iperf2.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
|
9
demos/iperf2/iperf2.yaml
Normal file
9
demos/iperf2/iperf2.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
includes:
|
||||
- base.yaml
|
||||
# bash
|
||||
targets:
|
||||
# copy iperf
|
||||
- target: /bin
|
||||
copy:
|
||||
- files:
|
||||
- ${IPERF_INSTALL_DIR}/bin/iperf
|
Loading…
Reference in New Issue
Block a user