load-test #516
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "load-test" | |
on: | |
push: | |
branches: | |
- 'release-**' | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
schedule: | |
- cron: '0 19 * * *' | |
workflow_dispatch: | |
inputs: | |
debug: | |
type: boolean | |
description: "Run the build with tmate debugging enabled" | |
required: false | |
default: false | |
jobs: | |
load: | |
strategy: | |
fail-fast: false | |
matrix: | |
meta: [ 'sqlite3', 'redis', 'mysql', 'tikv', 'tidb', 'postgres', 'mariadb', 'badger', 'fdb'] | |
# meta: ['redis'] | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Set Variable | |
id: vars | |
run: | | |
if [ "${{matrix.meta}}" == "fdb" ]; then | |
echo "target=juicefs.fdb" >> $GITHUB_OUTPUT | |
else | |
echo "target=juicefs" >> $GITHUB_OUTPUT | |
fi | |
- name: Build | |
uses: ./.github/actions/build | |
with: | |
target: ${{steps.vars.outputs.target}} | |
- name: Prepare meta db | |
run: | | |
chmod +x .github/scripts/start_meta_engine.sh | |
source .github/scripts/start_meta_engine.sh | |
start_meta_engine ${{matrix.meta}} | |
- name: Install tools | |
run: | | |
sudo pip install mysqlclient | |
- name: Load and dump with small directory | |
timeout-minutes: 30 | |
run: | | |
source .github/scripts/start_meta_engine.sh | |
meta_url=$(get_meta_url ${{matrix.meta}}) | |
create_database $meta_url | |
echo meta_url is: $meta_url | |
mount_point=/tmp/juicefs-load-test | |
wget -q https://s.juicefs.com/static/bench/2M_emtpy_files.dump.gz | |
gzip -dk 2M_emtpy_files.dump.gz | |
load_file=2M_emtpy_files.dump | |
start=`date +%s` | |
./juicefs load $meta_url $load_file | |
end=`date +%s` | |
runtime=$((end-start)) | |
export MYSQL_PASSWORD=${{secrets.MYSQL_PASSWORD_FOR_JUICEDATA}} | |
sudo chmod +x .github/scripts/db.py | |
version=$(./juicefs -V|cut -b 17- | sed 's/:/-/g') | |
python3 .github/scripts/db.py --name load_small_dir --result $runtime --version $version --meta ${{matrix.meta}} --storage file | |
echo "load cost $runtime seconds" | |
start=`date +%s` | |
./juicefs dump $meta_url dump.json | |
end=`date +%s` | |
runtime=$((end-start)) | |
echo "dump cost $runtime seconds" | |
python3 .github/scripts/db.py --name dump_small_dir --result $runtime --version $version --meta ${{matrix.meta}} --storage file | |
sudo mkdir /var/jfs | |
sudo chmod 777 /var/jfs | |
./juicefs mount $meta_url $mount_point -d --no-usage-report | |
inode=$(df -i $mount_point | grep JuiceFS |awk -F" " '{print $3}') | |
if [ "$inode" -ne "2233313" ]; then | |
echo "<FATAL>: inode error: $inode" | |
exit 1 | |
fi | |
- name: Clear | |
run: | | |
source .github/scripts/start_meta_engine.sh | |
meta_url=$(get_meta_url ${{matrix.meta}}) | |
mp=/tmp/juicefs-load-test | |
volume=jfs | |
test -d $mp && ./juicefs umount -f $mp | |
./juicefs status $meta_url && UUID=$(./juicefs status $meta_url | grep UUID | cut -d '"' -f 4) || echo "meta not exist" | |
if [ -n "$UUID" ];then | |
./juicefs destroy --yes $meta_url $UUID | |
fi | |
test -d /var/jfs/$volume && rm -rf /var/jfs/$volume || true | |
shell: bash | |
- name: Load and dump with big directory | |
timeout-minutes: 30 | |
run: | | |
source .github/scripts/start_meta_engine.sh | |
meta_url=$(get_meta_url ${{matrix.meta}}) | |
create_database $meta_url | |
echo meta_url is: $meta_url | |
mount_point=/tmp/juicefs-load-test | |
wget -q https://s.juicefs.com/static/bench/1M_files_in_one_dir.dump.gz | |
gzip -dk 1M_files_in_one_dir.dump.gz | |
load_file=1M_files_in_one_dir.dump | |
start=`date +%s` | |
./juicefs load $meta_url $load_file | |
end=`date +%s` | |
runtime=$((end-start)) | |
echo "load cost $runtime seconds" | |
export MYSQL_PASSWORD=${{secrets.MYSQL_PASSWORD_FOR_JUICEDATA}} | |
sudo chmod +x .github/scripts/db.py | |
version=$(./juicefs -V|cut -b 17- | sed 's/:/-/g') | |
python3 .github/scripts/db.py --name load_big_dir --result $runtime --version $version --meta ${{matrix.meta}} --storage file | |
start=`date +%s` | |
./juicefs dump $meta_url dump.json | |
end=`date +%s` | |
runtime=$((end-start)) | |
echo "dump cost $runtime seconds" | |
python3 .github/scripts/db.py --name dump_big_dir --result $runtime --version $version --meta ${{matrix.meta}} --storage file | |
sudo chmod 777 /var/jfs | |
./juicefs mount $meta_url $mount_point -d --no-usage-report | |
df -i $mount_point | |
inode=$(df -i $mount_point | grep JuiceFS |awk -F" " '{print $3}') | |
echo "inode: $inode" | |
if [ "$inode" -ne "1000003" ]; then | |
echo "<FATAL>: inode error: $inode" | |
exit 1 | |
fi | |
- name: List big directory | |
timeout-minutes: 30 | |
run: | | |
mount_point=/tmp/juicefs-load-test | |
start=`date +%s` | |
file_count=$(ls -l $mount_point/test/test-dir.0-0/mdtest_tree.0/ | wc -l) | |
echo "file_count: $file_count" | |
end=`date +%s` | |
runtime=$((end-start)) | |
echo "list cost $runtime seconds" | |
export MYSQL_PASSWORD=${{secrets.MYSQL_PASSWORD_FOR_JUICEDATA}} | |
version=$(./juicefs -V|cut -b 17- | sed 's/:/-/g') | |
python3 .github/scripts/db.py --name list_big_dir --result $runtime --version $version --meta ${{matrix.meta}} --storage file | |
if [ "$file_count" -ne "1000001" ]; then | |
echo "<FATAL>: file_count error: $file_count" | |
exit 1 | |
fi | |
- name: log | |
if: ${{ always() }} | |
shell: bash | |
run: | | |
if [ -f ~/.juicefs/juicefs.log ]; then | |
tail -300 ~/.juicefs/juicefs.log | |
grep "<FATAL>:" ~/.juicefs/juicefs.log && exit 1 || true | |
fi | |
- name: Setup upterm session | |
if: ${{ failure() && github.event_name == 'workflow_dispatch' && github.event.inputs.debug == 'true' }} | |
timeout-minutes: 60 | |
uses: lhotari/action-upterm@v1 | |
success-all-test: | |
runs-on: ubuntu-latest | |
needs: [load] | |
if: always() | |
steps: | |
- uses: technote-space/workflow-conclusion-action@v3 | |
- uses: actions/checkout@v3 | |
- name: Check Failure | |
if: env.WORKFLOW_CONCLUSION == 'failure' | |
run: exit 1 | |
- name: Send Slack Notification | |
if: ${{ failure() && github.event_name != 'workflow_dispatch' }} | |
uses: juicedata/slack-notify-action@main | |
with: | |
channel-id: "${{ secrets.SLACK_CHANNEL_ID_FOR_PR_CHECK_NOTIFY }}" | |
slack_bot_token: "${{ secrets.SLACK_BOT_TOKEN }}" | |
- name: Success | |
if: ${{ success() }} | |
run: echo "All Done" |