Skip to content

Commit d793d1e

Browse files
feat: update slo (#216)
1 parent 37e9696 commit d793d1e

File tree

17 files changed

+646
-1008
lines changed

17 files changed

+646
-1008
lines changed

.github/workflows/slo.yml

Lines changed: 66 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,83 @@
1+
name: SLO
2+
13
on:
24
push:
3-
branches: [main]
5+
branches:
6+
- main
47
pull_request:
5-
branches: [main]
8+
branches:
9+
- main
610
workflow_dispatch:
7-
8-
name: SLO
11+
inputs:
12+
github_pull_request_number:
13+
required: true
14+
slo_workload_duration_seconds:
15+
default: '600'
16+
required: false
17+
slo_workload_read_max_rps:
18+
default: '1000'
19+
required: false
20+
slo_workload_write_max_rps:
21+
default: '1000'
22+
required: false
923

1024
jobs:
11-
test-slo:
12-
concurrency:
13-
group: slo-${{ github.ref }}
25+
ydb-slo-action:
1426
if: (!contains(github.event.pull_request.labels.*.name, 'no slo'))
1527

16-
runs-on: ubuntu-latest
1728
name: SLO test
18-
permissions:
19-
checks: write
20-
pull-requests: write
21-
contents: read
22-
issues: write
23-
29+
runs-on: ubuntu-latest
30+
strategy:
31+
matrix:
32+
workload:
33+
- AdoNet
34+
35+
concurrency:
36+
group: slo-${{ github.ref }}-${{ matrix.workload }}
37+
cancel-in-progress: true
38+
2439
steps:
2540
- name: Checkout repository
2641
uses: actions/checkout@v4
27-
if: env.DOCKER_REPO != null
28-
env:
29-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
3042

31-
- name: Run SLO
32-
uses: ydb-platform/slo-tests@main
33-
if: env.DOCKER_REPO != null
34-
env:
35-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
36-
continue-on-error: true
43+
- name: Install .NET
44+
uses: actions/setup-dotnet@v4
45+
with:
46+
dotnet-version: 8.0.x
47+
48+
- name: Initialize YDB SLO
49+
uses: ydb-platform/ydb-slo-action/init@main
3750
with:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
KUBECONFIG_B64: ${{ secrets.SLO_KUBE_CONFIG }}
40-
AWS_CREDENTIALS_B64: ${{ secrets.SLO_AWS_CREDENTIALS }}
41-
AWS_CONFIG_B64: ${{ secrets.SLO_AWS_CONFIG }}
42-
DOCKER_USERNAME: ${{ secrets.SLO_DOCKER_USERNAME }}
43-
DOCKER_PASSWORD: ${{ secrets.SLO_DOCKER_PASSWORD }}
44-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
45-
DOCKER_FOLDER: ${{ secrets.SLO_DOCKER_FOLDER }}
46-
s3_endpoint: ${{ secrets.SLO_S3_ENDPOINT }}
47-
s3_images_folder: ${{ vars.SLO_S3_IMAGES_FOLDER }}
48-
grafana_domain: ${{ vars.SLO_GRAFANA_DOMAIN }}
49-
# grafana_dashboard: ${{ vars.SLO_GRAFANA_DASHBOARD }}
50-
grafana_dashboard: dca60386-0d3d-43f5-a2af-5f3fd3e3b295
51-
grafana_dashboard_width: 2000
52-
grafana_dashboard_height: 2300
53-
ydb_version: 'newest'
54-
timeBetweenPhases: 30
55-
shutdownTime: 30
51+
github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }}
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
workload_name: ${{ matrix.workload }}
54+
ydb_database_node_count: 5
55+
56+
- name: Prepare SLO Database
57+
run: |
58+
cd slo/src/${{ matrix.workload }}
59+
dotnet run create grpc://localhost:2135 /Root/testdb
60+
61+
- name: Run SLO Tests
62+
run: |
63+
cd slo/src/${{ matrix.workload }}
64+
dotnet run run grpc://localhost:2135 /Root/testdb \
65+
--prom-pgw http://localhost:9091 \
66+
--report-period 250 \
67+
--time ${{inputs.slo_workload_duration_seconds || 600 }} \
68+
--read-rps ${{inputs.slo_workload_read_max_rps || 1000 }} \
69+
--write-rps ${{inputs.slo_workload_write_max_rps || 1000 }} \
70+
--read-timeout 1000 \
71+
--write-timeout 1000
5672
57-
language_id0: 'table-service'
58-
workload_path0: 'slo/src'
59-
language0: '.NET SDK over table-service'
60-
workload_build_context0: ../..
61-
workload_build_options0: -f Dockerfile --build-arg SRC_PATH=TableService
62-
63-
language_id1: 'ado-net'
64-
workload_path1: 'slo/src'
65-
language1: 'ADO.NET over query-service'
66-
workload_build_context1: ../..
67-
workload_build_options1: -f Dockerfile --build-arg SRC_PATH=AdoNet
73+
- if: always()
74+
name: Store ydb chaos testing logs
75+
run: |
76+
docker logs ydb-chaos > chaos-ydb.log
6877
69-
- uses: actions/upload-artifact@v3
70-
if: always() && env.DOCKER_REPO != null
71-
env:
72-
DOCKER_REPO: ${{ secrets.SLO_DOCKER_REPO }}
78+
- if: always()
79+
uses: actions/upload-artifact@v4
7380
with:
74-
name: slo-logs
75-
path: logs/
81+
name: ${{ matrix.workload }}-chaos-ydb.log
82+
path: ./chaos-ydb.log
83+
retention-days: 1

slo/playground/configs/chaos.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh -e
2+
3+
get_random_container() {
4+
# Get a list of all containers starting with ydb-database-*
5+
containers=$(docker ps --format '{{.Names}}' | grep '^ydb-database-')
6+
7+
# Convert the list to a newline-separated string
8+
containers=$(echo "$containers" | tr ' ' '\n')
9+
10+
# Count the number of containers
11+
containersCount=$(echo "$containers" | wc -l)
12+
13+
# Generate a random number between 0 and containersCount - 1
14+
randomIndex=$(shuf -i 0-$(($containersCount - 1)) -n 1)
15+
16+
# Get the container name at the random index
17+
nodeForChaos=$(echo "$containers" | sed -n "$(($randomIndex + 1))p")
18+
}
19+
20+
21+
sleep 60
22+
23+
get_random_container
24+
25+
sh -c "docker stop ${nodeForChaos} -t 30"
26+
sh -c "docker start ${nodeForChaos}"
27+
28+
sleep 60
29+
30+
get_random_container
31+
32+
sh -c "docker restart ${nodeForChaos} -t 0"
33+
34+
sleep 60
35+
36+
get_random_container
37+
38+
sh -c "docker kill -s SIGKILL ${nodeForChaos}"
39+
40+
sleep 60

0 commit comments

Comments
 (0)