-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
squash a lot of debuging to a single commit
- Loading branch information
1 parent
1e5b365
commit 7f1c104
Showing
5 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Benchmarks | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main, eran/ci/benchmark-tests] | ||
|
||
jobs: | ||
storage-benchmark: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: "write" | ||
id-token: "write" | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
# - name: Set a unique run identifier | ||
# run: echo "UNIQE_ID=${{ github.run_number }}-${{ github.run_attempt }}" >> $GITHUB_ENV | ||
|
||
- id: "auth" | ||
name: "Authenticate to Google Cloud" | ||
uses: "google-github-actions/auth@v1" | ||
with: | ||
credentials_json: "${{ secrets.GOOGLE_CI_SA_CREDENTIALS }}" | ||
|
||
- id: "get-credentials" | ||
name: Get GKE credentials | ||
uses: "google-github-actions/get-gke-credentials@v1" | ||
with: | ||
cluster_name: "${{ secrets.GKE_CI_CLUSTER_NAME }}" | ||
location: "${{ secrets.GKE_CI_CLUSTER_REGION }}" | ||
|
||
- name: Run load test | ||
run: sh -c "deployments/storage-benchmark/run_benchmark.bash 5m" | ||
|
||
- name: Download previous benchmark data | ||
uses: actions/cache@v4 | ||
with: | ||
path: ./cache | ||
key: ${{ runner.os }}-benchmark | ||
|
||
# Run `github-action-benchmark` action | ||
- name: Store benchmark result | ||
uses: benchmark-action/github-action-benchmark@v1 | ||
with: | ||
name: "Papyrus storage benchmark" | ||
# What benchmark tool the output.txt came from | ||
tool: 'customSmallerIsBetter' | ||
# Where the output from the benchmark tool is stored | ||
output-file-path: output.txt | ||
|
||
# Push to gh-pages branch | ||
- name: Push benchmark result | ||
run: | | ||
git switch gh-pages | ||
git push https://github.com/starkware-libs/papyrus.git gh-pages:gh-pages --no-verify | ||
git checkout - | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
apiVersion: v1 | ||
data: | ||
queries.txt: | | ||
{"get_nonce_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a69999"]} | ||
{"get_nonce_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a69999"]} | ||
{"get_nonce_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a69999"]} | ||
{"get_nonce_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a69999"]} | ||
{"get_nonce_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]} | ||
{"get_storage_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6","0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c7"]} | ||
{"get_class_hash_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]} | ||
{"get_storage_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6","0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c7"]} | ||
{"get_class_hash_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]} | ||
{"get_storage_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6","0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a62647"]} | ||
{"get_class_hash_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]} | ||
{"get_class_hash_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]} | ||
{"get_class_hash_at":[121,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]} | ||
{"get_class_hash_at":[201,"0x20cfa74ee3564b4cd5435cdace0f9c4d43b939620e4a0bb5076105df0a626c6"]} | ||
kind: ConfigMap | ||
metadata: | ||
name: queries |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
app: storage-benchmark | ||
name: storage-benchmark | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: storage-benchmark | ||
template: | ||
metadata: | ||
labels: | ||
app: storage-benchmark | ||
spec: | ||
securityContext: | ||
fsGroup: 1000 | ||
initContainers: | ||
- image: us.gcr.io/starkware-dev/papyrus-utils:latest | ||
imagePullPolicy: Always | ||
command: | ||
- "storage_benchmark" | ||
- "--queries_file_path" | ||
- "/app/queries/queries.txt" | ||
- "--db_path" | ||
- "/app/data/" | ||
- "--output_file_path" | ||
- "/tmp/results/output.txt" | ||
- "--chain_id" | ||
- "SN_MAIN" | ||
name: storage-benchmark | ||
volumeMounts: | ||
- mountPath: /app/data | ||
name: data | ||
- mountPath: /app/queries | ||
name: queries | ||
- mountPath: /tmp/results | ||
name: results | ||
containers: | ||
- image: ubuntu | ||
command: | ||
- "sleep" | ||
- "3600" | ||
name: results-export | ||
volumeMounts: | ||
- mountPath: /tmp/results | ||
name: results | ||
volumes: | ||
- name: data | ||
persistentVolumeClaim: | ||
claimName: data | ||
- name: queries | ||
configMap: | ||
name: queries | ||
- name: results | ||
emptyDir: {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: data | ||
spec: | ||
storageClassName: premium-rwo | ||
dataSource: | ||
name: papyrus-db-snapshot | ||
kind: VolumeSnapshot | ||
apiGroup: snapshot.storage.k8s.io | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Gi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
|
||
BASE_PATH="deployments/storage-benchmark" | ||
PVC_FILE="$BASE_PATH/pvc.yaml" | ||
DEPLOYMENT_FILE="$BASE_PATH/deployment.yaml" | ||
CM_FILE="$BASE_PATH/cm.yaml" | ||
|
||
NS="papyrus-storage-benchmark" | ||
DURRATION_TIMEOUT=$1 | ||
|
||
# create a PVC with the benchmarked storage | ||
kubectl --namespace "$NS" apply -f "$PVC_FILE" --wait=true | ||
|
||
# create a configmap with the actions to run | ||
kubectl --namespace "$NS" apply -f "$CM_FILE" | ||
|
||
# create the storage-benchmark deployment | ||
kubectl --namespace "$NS" apply -f "$DEPLOYMENT_FILE" --wait=true | ||
|
||
# get the created pod name | ||
POD=$(kubectl get pods -l app=storage-benchmark --namespace "$NS" --no-headers -o custom-columns=":metadata.name") | ||
|
||
# wait for pod to start (since the benchmark is done in an initContainer, when the pod is Ready it | ||
# means the benchmark is done). | ||
kubectl wait --namespace "$NS" --for=condition=ready pod "$POD" --timeout "$DURRATION_TIMEOUT" | ||
|
||
# get the results file | ||
kubectl --namespace "$NS" cp --container results-export "$POD":/tmp/results/output.txt output.txt | ||
|
||
# delete all temp resources from the cluster | ||
kubectl --namespace "$NS" delete -f "$BASE_PATH/*.yaml" --wait=true |