Skip to content
This repository was archived by the owner on Dec 26, 2024. It is now read-only.

Commit cd5a74f

Browse files
first commit for storage-benchmark CI
1 parent 0483361 commit cd5a74f

File tree

5 files changed

+188
-0
lines changed

5 files changed

+188
-0
lines changed

.github/workflows/benchmark.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Benchmarks
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [main, eran/ci/benchmark-tests]
7+
8+
jobs:
9+
deploy-benchmark-teardown:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: "read"
13+
id-token: "write"
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
# - name: Set a unique run identifier
20+
# run: echo "UNIQE_ID=${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV
21+
22+
- id: "auth"
23+
name: "Authenticate to Google Cloud"
24+
uses: "google-github-actions/auth@v1"
25+
with:
26+
credentials_json: "${{ secrets.GOOGLE_CI_SA_CREDENTIALS }}"
27+
28+
- id: "get-credentials"
29+
name: Get GKE credentials
30+
uses: "google-github-actions/get-gke-credentials@v1"
31+
with:
32+
cluster_name: "${{ secrets.GKE_CI_CLUSTER_NAME }}"
33+
location: "${{ secrets.GKE_CI_CLUSTER_REGION }}"
34+
35+
- name: Run load test
36+
run: sh -c "deployments/storage-benchmark/run_benchmark.bash 5m"
37+
38+
- name: Parse load test results
39+
run: |
40+
pwd
41+
ls -al
42+
43+
# - name: Clean the deployment
44+
# if: always()
45+
# run: helm delete --namespace papyrus papyrus-${UNIQE_ID}

deployments/storage-benchmark/cm.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: v1
2+
data:
3+
queries.txt: |
4+
{"get_nonce_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a69999"]}
5+
{"get_nonce_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a69999"]}
6+
{"get_nonce_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a69999"]}
7+
{"get_nonce_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a69999"]}
8+
{"get_nonce_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]}
9+
{"get_storage_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6","0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c7"]}
10+
{"get_class_hash_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]}
11+
{"get_storage_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6","0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c7"]}
12+
{"get_class_hash_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]}
13+
{"get_storage_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6","0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a62647"]}
14+
{"get_class_hash_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]}
15+
{"get_class_hash_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]}
16+
{"get_class_hash_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]}
17+
{"get_class_hash_at":[201,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]}
18+
results.json: |
19+
[
20+
{
21+
"name": "My Custom Smaller Is Better Benchmark - CPU Load",
22+
"unit": "Percent",
23+
"value": 50
24+
},
25+
{
26+
"name": "My Custom Smaller Is Better Benchmark - Memory Used",
27+
"unit": "Megabytes",
28+
"value": 100,
29+
"range": "3",
30+
"extra": "Value for Tooltip: 25\nOptional Num #2: 100\nAnything Else!"
31+
}
32+
]
33+
kind: ConfigMap
34+
metadata:
35+
creationTimestamp: null
36+
name: queries
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
labels:
5+
app: storage-benchmark
6+
name: storage-benchmark
7+
spec:
8+
replicas: 1
9+
selector:
10+
matchLabels:
11+
app: storage-benchmark
12+
template:
13+
metadata:
14+
labels:
15+
app: storage-benchmark
16+
spec:
17+
securityContext:
18+
fsGroup: 1000
19+
initContainers:
20+
- image: us.gcr.io/starkware-dev/papyrus-utils:latest
21+
imagePullPolicy: Always
22+
command:
23+
# - sh
24+
# - -c
25+
# - "sleep 3600 && cp /app/queries/results.json /tmp/results/output.txt"
26+
- "storage_benchmark"
27+
- "--queries_file_path"
28+
- "/app/queries/queries.txt"
29+
- "--db_path"
30+
- "/app/data/"
31+
- "--output_file_path"
32+
- "/tmp/results/output.txt"
33+
- "--chain_id"
34+
- "SN_MAIN"
35+
name: storage-benchmark
36+
volumeMounts:
37+
- mountPath: /app/data
38+
name: data
39+
- mountPath: /app/queries
40+
name: queries
41+
- mountPath: /tmp/results
42+
name: results
43+
containers:
44+
- image: ubuntu
45+
command:
46+
- "sleep"
47+
- "3600"
48+
name: results-export
49+
volumeMounts:
50+
- mountPath: /tmp/results
51+
name: results
52+
volumes:
53+
- name: data
54+
persistentVolumeClaim:
55+
claimName: data
56+
- name: queries
57+
configMap:
58+
name: queries
59+
- name: results
60+
emptyDir: {}
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: PersistentVolumeClaim
3+
metadata:
4+
name: data
5+
spec:
6+
storageClassName: premium-rwo
7+
dataSource:
8+
name: papyrus-db-snapshot
9+
kind: VolumeSnapshot
10+
apiGroup: snapshot.storage.k8s.io
11+
accessModes:
12+
- ReadWriteOnce
13+
resources:
14+
requests:
15+
storage: 10Gi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
set -euxo pipefail
3+
4+
BASE_PATH="deployments/storage-benchmark"
5+
PVC_FILE="$BASE_PATH/pvc.yaml"
6+
DEPLOYMENT_FILE="$BASE_PATH/deployment.yaml"
7+
CM_FILE="$BASE_PATH/cm.yaml"
8+
9+
NS="papyrus-storage-benchmark"
10+
DURRATION_TIMEOUT=$1
11+
12+
# create a PVC with the benchmarked storage
13+
kubectl --namespace "$NS" apply -f "$PVC_FILE" --wait=true
14+
15+
# create a configmap with the actions to run
16+
kubectl --namespace "$NS" apply -f "$CM_FILE"
17+
18+
# create the storage-benchmark deployment
19+
kubectl --namespace "$NS" apply -f "$DEPLOYMENT_FILE" --wait=true
20+
21+
# get the created pod name
22+
POD=$(kubectl get pods -l app=storage-benchmark --namespace "$NS" --no-headers -o custom-columns=":metadata.name")
23+
24+
# wait for pod to start (since the benchmark is done in an initContainer, when the pod is Ready it
25+
# means the benchmark is done).
26+
kubectl wait --namespace "$NS" --for=condition=ready pod "$POD" --timeout "$DURRATION_TIMEOUT"
27+
28+
# get the results file
29+
kubectl --namespace "$NS" cp --container results-export "$POD":/tmp/results/output.txt output.txt
30+
31+
# delete all temp resources from the cluster
32+
kubectl --namespace "$NS" delete -f "$BASE_PATH/*.yaml" --wait=true

0 commit comments

Comments
 (0)