Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
name: Benchmarks Test

on:
push:
branches:
- 1.0.0-preview
schedule:
# Schedule to run everyday at 10PM UTC (6AM CST)
- cron: '0 22 * * *'

jobs:
Sysbench_Test:
timeout-minutes: 20
timeout-minutes: 40
runs-on: ${{ matrix.self_runner }}
strategy:
matrix:
Expand Down Expand Up @@ -57,7 +60,7 @@ jobs:
run: docker stop ${{ env.CONTAINER_NAME }}

Iperf3_Test:
timeout-minutes: 20
timeout-minutes: 40
runs-on: ${{ matrix.self_runner }}
strategy:
matrix:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/demo_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -553,11 +553,11 @@ jobs:
- name: Download and build Enclave TLS
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/enclave_tls && ./download_and_build_enclave_tls.sh"

- name: Run the encalve tls server on Occlum
- name: Run the enclave tls server on Occlum
run: docker exec ${{ github.job }} bash -c "cd /root/occlum/demos/enclave_tls && SGX_MODE=SIM ./run_enclave_tls_server_in_occlum.sh"

# Ignore the result here as simulation mode doesn't have RA capabilities
- name: Run the encalve tls client
- name: Run the enclave tls client
run: |
sleep ${{ env.nap_time }};
docker exec ${{ github.job }} bash -c "/usr/share/enclave-tls/samples/enclave-tls-client" || true
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/hw_mode_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,52 @@ jobs:
if: ${{ always() }}
run: docker stop ${{ env.CONTAINER_NAME }}

MySQL_test:
timeout-minutes: 180
if: github.event_name == 'push' || ${{ contains(github.event.pull_request.labels.*.name, 'SGX-hardware-test-required') }}
runs-on: ${{ matrix.self_runner }}
strategy:
matrix:
self_runner: [[self-hosted, SGX2-HW]]

steps:
- name: Clean before running
run: |
sudo chown -R ${{ secrets.CI_ADMIN }} "${{ github.workspace }}"

- name: Checkout code
if: github.event_name == 'push'
uses: actions/checkout@v2
with:
submodules: true

- name: Checkout code from fork
if: ${{ contains(github.event.pull_request.labels.*.name, 'SGX-hardware-test-required') }}
uses: actions/checkout@v2
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
submodules: true

- uses: ./.github/workflows/composite_action/hw
with:
container-name: ${{ github.job }}
build-envs: 'OCCLUM_RELEASE_BUILD=1'

- name: Download and build mysql
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/mysql && ./dl_and_build_mysql.sh"

- name: Run mysql server
run: docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/mysql && ./run_mysql_server.sh" &

- name: Run mysql benchmarks
run: |
sleep 120;
docker exec ${{ env.CONTAINER_NAME }} bash -c "cd /root/occlum/demos/mysql && ./run_benchmarks.sh"

- name: Clean the environment
if: ${{ always() }}
run: docker stop ${{ env.CONTAINER_NAME }}

Stress_test_with_musl:
timeout-minutes: 500
if: github.event_name == 'schedule'
Expand Down
4 changes: 2 additions & 2 deletions demos/benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ This set of demos shows how commonly used benchmarking tools can be run inside S

## Benchmarks Data

There is a enabled [`benchmarks CI`](https://github.com/occlum/ngo/blob/master/.github/workflows/benchmarks.yml) for continuous benchmarking. It utilizes the [`github-action-benchmark`](https://github.com/benchmark-action/github-action-benchmark) to provide a chart view for visualized historical benchmarks data on the GitHub pages.
There is a enabled [`benchmarks CI`](https://github.com/occlum/occlum/blob/1.0.0-preview/.github/workflows/benchmarks.yml) for continuous benchmarking. It utilizes the [`github-action-benchmark`](https://github.com/benchmark-action/github-action-benchmark) to provide a chart view for visualized historical benchmarks data on the GitHub pages.

[**History Data**](https://occlum.io/ngo/dev/benchmarks/)
[**History Data**](https://occlum.io/occlum/dev/benchmarks/)
32 changes: 29 additions & 3 deletions demos/mysql/dl_and_build_mysql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,36 @@ patch -s -p0 < apply-mysql-to-occlum.patch
pushd mysql_src
mkdir bld && cd bld

cmake -j$(nproc) .. -DCMAKE_CXX_FLAGS="-fpic -pie" -DCMAKE_C_FLAGS="-fpic -pie"

CC="-fpic -pie" CXX="-fpic -pie" make -j$(nproc)
cmake -j$(nproc) .. \
-DCMAKE_CXX_FLAGS="-fpic -pie" -DCMAKE_C_FLAGS="-fpic -pie" \
-DWITH_ARCHIVE_STORAGE_ENGINE=0 \
-DWITH_EXAMPLE_STORAGE_ENGINE=0 \
-DWITH_FEDERATED_STORAGE_ENGINE=0 \
-DDISABLE_PSI_COND=1 \
-DDISABLE_PSI_DATA_LOCK=1 \
-DDISABLE_PSI_ERROR=1 \
-DDISABLE_PSI_FILE=1 \
-DDISABLE_PSI_IDLE=1 \
-DDISABLE_PSI_MEMORY=1 \
-DDISABLE_PSI_METADATA=1 \
-DDISABLE_PSI_MUTEX=1 \
-DDISABLE_PSI_PS=1 \
-DDISABLE_PSI_RWLOCK=1 \
-DDISABLE_PSI_SOCKET=1 \
-DDISABLE_PSI_SP=1 \
-DDISABLE_PSI_STAGE=0 \
-DDISABLE_PSI_STATEMENT=1 \
-DDISABLE_PSI_STATEMENT_DIGEST=1 \
-DDISABLE_PSI_TABLE=1 \
-DDISABLE_PSI_THREAD=0 \
-DDISABLE_PSI_TRANSACTION=1 \
-DWITH_MYSQLX=0 \
-DWITH_NDB_JAVA=0 \
-DWITH_RAPID=0 \
-DWITH_ROUTER=0 \
-DWITH_UNIT_TESTS=0

make -j4
make install -j$(nproc)
cd ..

Expand Down
1 change: 0 additions & 1 deletion demos/mysql/my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ port = 3306
bind-address = 127.0.0.1
skip-networking = 0
skip_ssl = 0
mysqlx = 0
wait_timeout = 60
interactive_timeout = 120

Expand Down
2 changes: 1 addition & 1 deletion demos/mysql/mysql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ targets:
- target: /opt/occlum/glibc/lib
copy:
- files:
- /usr/local/mysql/lib/mysqlrouter/private/libprotobuf-lite.so.3.19.4
- ../mysql_src/bld/library_output_directory/libprotobuf-lite.so.3.19.4
- target: /
copy:
- files:
Expand Down
63 changes: 63 additions & 0 deletions demos/mysql/run_benchmarks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
set -e

GREEN='\033[1;32m'
NC='\033[0m'

echo -e "${GREEN}Install sysbench first${NC}"

# We use sysbench to test mysql, need to install it first
apt-get install -y sysbench

function run_benchmarks()
{
WORKLOADS=("oltp_point_select" "oltp_write_only" "oltp_read_write")
for item in ${WORKLOADS[@]}
do
echo "start to prepare for $item"
sleep 3
sysbench /usr/share/sysbench/$item.lua\
--mysql-host='127.0.0.1'\
--mysql-user=root\
--time=60\
--mysql-db=mysql\
--tables=3\
--table_size=100000\
--rand-type=pareto\
prepare

echo "start to run $item"
sleep 3
sysbench /usr/share/sysbench/$item.lua\
--mysql-host='127.0.0.1'\
--mysql-user=root\
--time=60\
--mysql-db=mysql\
--tables=3\
--table_size=100000\
--rand-type=pareto\
--threads=2\
--report-interval=10\
run

echo "start to cleanup $item"
sleep 3
sysbench /usr/share/sysbench/$item.lua\
--mysql-host='127.0.0.1'\
--mysql-user=root\
--time=60\
--mysql-db=mysql\
--tables=3\
--table_size=100000\
--rand-type=pareto\
--threads=2\
--report-interval=10\
cleanup
done

echo "all done"
}

echo -e "${GREEN}Run benchmarks using sysbench${NC}"

run_benchmarks
5 changes: 3 additions & 2 deletions demos/mysql/run_mysql_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ MYSQLD=mysqld
rm -rf occlum_instance && occlum new occlum_instance
pushd occlum_instance

yq '.resource_limits.user_space_size = "8000MB" |
.resource_limits.kernel_space_heap_size ="1000MB" ' -i Occlum.yaml
yq '.resource_limits.user_space_size.init = "8000MB" |
.resource_limits.kernel_space_heap_size.init = "1000MB" |
.resource_limits.kernel_space_heap_size.max = "2000MB" ' -i Occlum.yaml

# 2. Copy files into Occlum instance and build
rm -rf image
Expand Down
2 changes: 1 addition & 1 deletion demos/python/flask/install_python_with_conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# 2. Install python and dependencies to specified position
[ -f Miniconda3-latest-Linux-x86_64.sh ] || wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
[ -d miniconda ] || bash ./Miniconda3-latest-Linux-x86_64.sh -b -p $script_dir/miniconda
$script_dir/miniconda/bin/conda create --prefix $script_dir/python-occlum -y python=3.7.11 flask=1.1.2 flask-restful=0.3.8 jinja2=3.0
$script_dir/miniconda/bin/conda create --prefix $script_dir/python-occlum -y python=3.7.11 flask=1.1.2 flask-restful=0.3.8 jinja2=3.0 werkzeug=2.0.3
2 changes: 1 addition & 1 deletion docs/demo_contribution_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ To test and reproduce the new demo, it is better to "script-ize" the work. For e

## Step 3: Add New Demo to CI

It is the last one step before submitting but very important, which can definityly boost the speed of review and merge. And it also makes sure that this demo is tested for every PR, commit and release. So that it won't get broken in a new version.
It is the last one step before submitting but very important, which can definitely boost the speed of review and merge. And it also makes sure that this demo is tested for every PR, commit and release. So that it won't get broken in a new version.

### 3.1 - Simple dependency

Expand Down
6 changes: 3 additions & 3 deletions docs/install_occlum_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-cer

2. Install Intel® SGX Driver and Intel® SGX PSW

Please follow [Intel SGX Installation Guide](https://download.01.org/intel-sgx/sgx-linux/2.13/docs/Intel_SGX_Installation_Guide_Linux_2.13_Open_Source.pdf) to install SGX driver and SGX PSW. SGX SDK is not required. Using PSW installer is recommanded.
Please follow [Intel SGX Installation Guide](https://download.01.org/intel-sgx/sgx-linux/2.13/docs/Intel_SGX_Installation_Guide_Linux_2.13_Open_Source.pdf) to install SGX driver and SGX PSW. SGX SDK is not required. Using PSW installer is recommended.

To install PSW, follow the guide to add Intel® SGX repository to APT source. And then run:
```
Expand Down Expand Up @@ -99,11 +99,11 @@ occlum run /bin/hello_world
```


## Version Compatability Matrix
## Version Compatibility Matrix

When version is not specified, Occlum with the latest version will be installed. If a user would like to evaluate an older version, please make sure the corresponding Intel® SGX PSW is installed.

The matrix below shows the version compatability since Occlum `0.16.0`. Please check before installing or upgrading.
The matrix below shows the version compatibility since Occlum `0.16.0`. Please check before installing or upgrading.

| Occlum Version | SGX PSW Version | Tested under Ubuntu | Tested under CentOS |
| --------------- | ----------------- | ------------------- | ------------------- |
Expand Down
2 changes: 1 addition & 1 deletion docs/readthedocs/docs/source/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Supported HW

First, please make sure the basemetal or VM machine support SGX. Otherwise, users can only try SW simulation mode.
First, please make sure the baremetal or VM machine support SGX. Otherwise, users can only try SW simulation mode.

From Occlum v1.0, only SGX2 or SGX1 with [FLC](https://www.intel.com/content/www/us/en/developer/articles/technical/an-update-on-3rd-party-attestation.html)(Flexible Launch Control) feature are supported.

Expand Down
4 changes: 2 additions & 2 deletions docs/readthedocs/docs/source/tests/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ This set of demos shows how commonly used benchmarking tools can be run inside S

## Benchmarks Data

There is a enabled [benchmarks CI](https://github.com/occlum/ngo/blob/master/.github/workflows/benchmarks.yml) for continuous benchmarking. It utilizes the [github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) to provide a chart view for visualized historical benchmarks data on the GitHub pages.
There is a enabled [benchmarks CI](https://github.com/occlum/occlum/blob/1.0.0-preview/.github/workflows/benchmarks.yml) for continuous benchmarking. It utilizes the [github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark) to provide a chart view for visualized historical benchmarks data on the GitHub pages.

The CI runs periodically. For example, **sysbench** has the historical benchmarks chart as below.

![sysbench_chart](../images/benchmark.png)

[**History Data**](https://occlum.io/ngo/dev/benchmarks/)
[**History Data**](https://occlum.io/occlum/dev/benchmarks/)
2 changes: 1 addition & 1 deletion src/exec/occlum_exec.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ message ExecCommRequest {
string sockpath = 2;
string command = 3;
repeated string parameters = 4;
repeated string enviroments = 5;
repeated string environments = 5;
}

message ExecCommResponse {
Expand Down
6 changes: 3 additions & 3 deletions src/exec/src/bin/occlum_exec_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ fn exec_command(
parameter_list.push(p.to_string());
}

let mut enviroments_list = RepeatedField::default();
let mut environments_list = RepeatedField::default();
for env in envs {
enviroments_list.push(env.to_string());
environments_list.push(env.to_string());
}

let tmp_dir = TempDir::new("occlum_tmp").expect("create temp dir");
Expand Down Expand Up @@ -91,7 +91,7 @@ fn exec_command(
process_id: process::id(),
command: command.to_string(),
parameters: parameter_list,
enviroments: enviroments_list,
environments: environments_list,
sockpath: String::from(sockpath.as_path().to_str().unwrap()),
..Default::default()
},
Expand Down
4 changes: 2 additions & 2 deletions src/exec/src/bin/occlum_exec_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn main() {
while !*server_stopped {
server_stopped = cvar.wait(server_stopped).unwrap();
}
rust_occlum_pal_destroy().expect("Destory occlum image failed");
rust_occlum_pal_destroy().expect("Destroy occlum image failed");
println!("server stopped");
}
}
Expand Down Expand Up @@ -186,7 +186,7 @@ fn rust_occlum_pal_init(num_vcpus: u32) -> Result<(), i32> {
}
}

///Destroyes the Occlum enclave image
///Destroys the Occlum enclave image
fn rust_occlum_pal_destroy() -> Result<(), i32> {
let ret = unsafe { occlum_pal_destroy() };
match ret {
Expand Down
2 changes: 1 addition & 1 deletion src/exec/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ impl OcclumExec for OcclumExecImpl {

let cmd = req.command.clone();
let args = req.parameters.into_vec().clone();
let envs = req.enviroments.into_vec().clone();
let envs = req.environments.into_vec().clone();
let client_process_id = req.process_id;
let exit_status = Box::new(Futex::<Shared>::new(-1));

Expand Down
Loading