[hw-ci] Add MySQL to hw mode test

This commit is contained in:
Shaowei Song 2022-12-29 10:58:31 +08:00 committed by volcano
parent d7d485de27
commit b3e2d6c873
7 changed files with 142 additions and 7 deletions

@ -922,6 +922,52 @@ jobs:
if: ${{ always() }} if: ${{ always() }}
run: docker stop ${{ env.CONTAINER_NAME }} 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: Stress_test_with_musl:
timeout-minutes: 360 timeout-minutes: 360
if: github.event_name == 'schedule' if: github.event_name == 'schedule'

@ -21,6 +21,7 @@ This set of demos shows how real-world apps can be easily run inside SGX enclave
* [font](font/font_support_for_java): A demo of supporting font with Java. * [font](font/font_support_for_java): A demo of supporting font with Java.
* [grpc](grpc/): A client and server communicating through [gRPC](https://grpc.io), containing [glibc-supported demo](grpc/grpc_glibc) and [musl-supported demo](grpc/grpc_musl). * [grpc](grpc/): A client and server communicating through [gRPC](https://grpc.io), containing [glibc-supported demo](grpc/grpc_glibc) and [musl-supported demo](grpc/grpc_musl).
* [https_server](https_server/): A HTTPS file server based on [Mongoose Embedded Web Server Library](https://github.com/cesanta/mongoose). * [https_server](https_server/): A HTTPS file server based on [Mongoose Embedded Web Server Library](https://github.com/cesanta/mongoose).
* [mysql](mysql/): A demo of [MySQL](https://www.mysql.com/).
* [openvino](openvino/) A benchmark of [OpenVINO Inference Engine](https://docs.openvinotoolkit.org/2019_R3/_docs_IE_DG_inference_engine_intro.html). * [openvino](openvino/) A benchmark of [OpenVINO Inference Engine](https://docs.openvinotoolkit.org/2019_R3/_docs_IE_DG_inference_engine_intro.html).
* [pytorch](pytorch/): Demos of standalone and distributed [PyTorch](https://pytorch.org/). * [pytorch](pytorch/): Demos of standalone and distributed [PyTorch](https://pytorch.org/).
* [redis](redis/): A demo of [Redis](https://redis.io). * [redis](redis/): A demo of [Redis](https://redis.io).

@ -39,10 +39,36 @@ patch -s -p0 < apply-mysql-to-occlum.patch
pushd mysql_src pushd mysql_src
mkdir bld && cd bld mkdir bld && cd bld
cmake -j$(nproc) .. -DCMAKE_CXX_FLAGS="-fpic -pie" -DCMAKE_C_FLAGS="-fpic -pie" cmake -j$(nproc) .. \
-DCMAKE_CXX_FLAGS="-fpic -pie" -DCMAKE_C_FLAGS="-fpic -pie" \
CC="-fpic -pie" CXX="-fpic -pie" make -j$(nproc) -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) make install -j$(nproc)
cd .. cd ..

@ -11,7 +11,6 @@ port = 3306
bind-address = 127.0.0.1 bind-address = 127.0.0.1
skip-networking = 0 skip-networking = 0
skip_ssl = 0 skip_ssl = 0
mysqlx = 0
wait_timeout = 60 wait_timeout = 60
interactive_timeout = 120 interactive_timeout = 120

@ -27,7 +27,7 @@ targets:
- target: /opt/occlum/glibc/lib - target: /opt/occlum/glibc/lib
copy: copy:
- files: - 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: / - target: /
copy: copy:
- files: - files:

63
demos/mysql/run_benchmarks.sh Executable file

@ -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

@ -14,8 +14,8 @@ MYSQLD=mysqld
rm -rf occlum_instance && occlum new occlum_instance rm -rf occlum_instance && occlum new occlum_instance
pushd occlum_instance pushd occlum_instance
new_json="$(jq '.resource_limits.user_space_size = "3500MB" | new_json="$(jq '.resource_limits.user_space_size = "8000MB" |
.resource_limits.kernel_space_heap_size ="3000MB" | .resource_limits.kernel_space_heap_size ="1000MB" |
.resource_limits.max_num_of_threads = 96' Occlum.json)" && \ .resource_limits.max_num_of_threads = 96' Occlum.json)" && \
echo "${new_json}" > Occlum.json echo "${new_json}" > Occlum.json