From 18f5a5965edf9ea507d9c90c9bb2a92072e7947b Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:44:55 -0400 Subject: [PATCH 01/16] feat: Adding ci/cd benchmark --- .github/workflows/benchmark.yml | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 0000000000..81effd1c35 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,36 @@ +name: "Benchmarks" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: [pull_request] +jobs: + lint: + name: Benchmark + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Prepare env + run: | + sed -i 's/traefik/localhost/g' .env + docker compose up -d + sleep 10 + - name: Install Oha + run: | + echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ stable main" | sudo tee /etc/apt/sources.list.d/azlux.list + sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg + apt update + apt install oha + - name: Benchmark + run: | + oha -z 180s http://localhost:9501/v1/health/version -j > benchmark.json + - name: Save results + uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: benchmark.json + path: benchmark.json + retention-days: 7 From d0b87fe4ae302e25dff59e605905a06ac2680077 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 15:49:49 -0400 Subject: [PATCH 02/16] feat: Adding ci/cd benchmark --- .github/workflows/benchmark.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 81effd1c35..a271fcaa1d 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -6,24 +6,23 @@ concurrency: on: [pull_request] jobs: - lint: + benchmarking: name: Benchmark runs-on: ubuntu-latest - steps: - name: Checkout repository uses: actions/checkout@v3 - - name: Prepare env - run: | - sed -i 's/traefik/localhost/g' .env - docker compose up -d - sleep 10 - name: Install Oha run: | echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ stable main" | sudo tee /etc/apt/sources.list.d/azlux.list sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg - apt update - apt install oha + sudo apt update + sudo apt install oha + - name: Preparing environment + run: | + sed -i 's/traefik/localhost/g' .env + docker compose up -d + sleep 10 - name: Benchmark run: | oha -z 180s http://localhost:9501/v1/health/version -j > benchmark.json From 79b5698e26a93c7edd7cbb489a12075045f3c6a4 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 16:19:40 -0400 Subject: [PATCH 03/16] feat: Adding ci/cd benchmark --- .github/workflows/benchmark.yml | 58 +++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index a271fcaa1d..101baa6e3e 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -4,32 +4,42 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -on: [pull_request] +on: [ pull_request ] jobs: benchmarking: name: Benchmark runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Install Oha - run: | - echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ stable main" | sudo tee /etc/apt/sources.list.d/azlux.list - sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg - sudo apt update - sudo apt install oha - - name: Preparing environment - run: | - sed -i 's/traefik/localhost/g' .env - docker compose up -d - sleep 10 - - name: Benchmark - run: | - oha -z 180s http://localhost:9501/v1/health/version -j > benchmark.json - - name: Save results - uses: actions/upload-artifact@v4 - if: ${{ !cancelled() }} - with: - name: benchmark.json - path: benchmark.json - retention-days: 7 + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install Oha + run: | + echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ stable main" | sudo tee /etc/apt/sources.list.d/azlux.list + sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg + sudo apt update + sudo apt install oha + - name: Preparing environment + run: | + sed -i 's/traefik/localhost/g' .env + docker compose up -d + sleep 10 + - name: Benchmark + run: oha -z 180s http://localhost:9501/v1/health/version -j > benchmark.json + - name: Prepare comment + run: | + echo '## :sparkles: Benchmark results' > benchmark.txt + echo ' ' >> >> benchmark.txt + echo "- Requests per second: $(jq -r '.summary.requestsPerSec' benchmark.json)" >> benchmark.txt + echo "- Total 200 requests: (jq -r '.statusCodeDistribution.200' benchmark.json)" >> benchmark.txt + echo "- 99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt + - name: Save results + uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: benchmark.json + path: benchmark.json + retention-days: 7 + - name: Comment on PR + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: benchmark.txt From a616c87d055a41bdb42b45eb7d823a29003f3315 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 16:25:16 -0400 Subject: [PATCH 04/16] feat: Adding ci/cd benchmark --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 101baa6e3e..6507fc2aca 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -28,7 +28,7 @@ jobs: - name: Prepare comment run: | echo '## :sparkles: Benchmark results' > benchmark.txt - echo ' ' >> >> benchmark.txt + echo ' ' >> benchmark.txt echo "- Requests per second: $(jq -r '.summary.requestsPerSec' benchmark.json)" >> benchmark.txt echo "- Total 200 requests: (jq -r '.statusCodeDistribution.200' benchmark.json)" >> benchmark.txt echo "- 99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt From 62837eebbc77641b9be5cbfc139ea35d2dae30b4 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 16:35:08 -0400 Subject: [PATCH 05/16] feat: Adding ci/cd benchmark --- .github/workflows/benchmark.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6507fc2aca..8de4451070 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -29,9 +29,9 @@ jobs: run: | echo '## :sparkles: Benchmark results' > benchmark.txt echo ' ' >> benchmark.txt - echo "- Requests per second: $(jq -r '.summary.requestsPerSec' benchmark.json)" >> benchmark.txt - echo "- Total 200 requests: (jq -r '.statusCodeDistribution.200' benchmark.json)" >> benchmark.txt - echo "- 99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt + echo "- :zap: Requests per second: $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark.json)" >> benchmark.txt + echo "- :white_check_mark: Total 200 requests: $(jq -r '.statusCodeDistribution.200' benchmark.json)" >> benchmark.txt + echo "- :top: 99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt - name: Save results uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} From 4a265c52bd98e5478557acbf0a05531f94f6278f Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 16:46:56 -0400 Subject: [PATCH 06/16] feat: Adding ci/cd benchmark --- .github/workflows/benchmark.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 8de4451070..f93e00016d 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -18,19 +18,19 @@ jobs: sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg sudo apt update sudo apt install oha - - name: Preparing environment + - name: Prepare environment run: | sed -i 's/traefik/localhost/g' .env docker compose up -d sleep 10 - name: Benchmark - run: oha -z 180s http://localhost:9501/v1/health/version -j > benchmark.json + run: oha -z 180s http://localhost/v1/health/version -j > benchmark.json - name: Prepare comment run: | echo '## :sparkles: Benchmark results' > benchmark.txt echo ' ' >> benchmark.txt echo "- :zap: Requests per second: $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark.json)" >> benchmark.txt - echo "- :white_check_mark: Total 200 requests: $(jq -r '.statusCodeDistribution.200' benchmark.json)" >> benchmark.txt + echo "- :white_check_mark: Total 200 requests: $(jq -r '.statusCodeDistribution."200"' benchmark.json)" >> benchmark.txt echo "- :top: 99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt - name: Save results uses: actions/upload-artifact@v4 From a9ed4f77fa96ee41ec00e0c0af28133255bf633b Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 16:58:24 -0400 Subject: [PATCH 07/16] feat: Compering to latest version --- .github/workflows/benchmark.yml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index f93e00016d..79be43db38 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -23,15 +23,37 @@ jobs: sed -i 's/traefik/localhost/g' .env docker compose up -d sleep 10 - - name: Benchmark - run: oha -z 180s http://localhost/v1/health/version -j > benchmark.json + - name: Benchmark PR + run: oha -z 10s http://localhost/v1/health/version -j > benchmark.json + - name: cleaning + run: docker compose down -v + - name: Installing latest version + run: | + rm docker-compose.yml + rm .env + curl https://appwrite.io/install/compose -o docker-compose.yml + curl https://appwrite.io/install/env -o .env + sed -i 's/_APP_OPTIONS_ABUSE=enabled/_APP_OPTIONS_ABUSE=disabled/g' .env + docker compose up -d + sleep 10 + - name: Benchmark Latest + run: oha -z 10s http://localhost/v1/health/version -j > benchmark-latest.json - name: Prepare comment run: | echo '## :sparkles: Benchmark results' > benchmark.txt echo ' ' >> benchmark.txt - echo "- :zap: Requests per second: $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark.json)" >> benchmark.txt - echo "- :white_check_mark: Total 200 requests: $(jq -r '.statusCodeDistribution."200"' benchmark.json)" >> benchmark.txt - echo "- :top: 99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt + echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark.json)" >> benchmark.txt + echo "- Total 200 requests: $(jq -r '.statusCodeDistribution."200"' benchmark.json)" >> benchmark.txt + echo "- 99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt + echo ' ' >> benchmark.txt + echo ' ' >> benchmark.txt + echo '## :zap: Benchmark results' >> benchmark.txt + echo ' ' >> benchmark.txt + echo '| Metric | PR | Latest version | ' >> benchmark.txt + echo '| --- | --- | --- | ' >> benchmark.txt + echo '| RPS | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark-latest.json) | ' >> benchmark.txt + echo '| 200 | $(jq -r '.statusCodeDistribution."200"' benchmark.json) | $(jq -r '.statusCodeDistribution."200"' benchmark-latest.json) | ' >> benchmark.txt + echo '| P99 | $(jq -r '.latencyPercentiles.p99' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | ' >> benchmark.txt - name: Save results uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} From 314dcf8cd158b4e019a9065ab4e85bf7a2bd995e Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 17:12:20 -0400 Subject: [PATCH 08/16] feat: Compering to latest version --- .github/workflows/benchmark.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 79be43db38..e975262779 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -25,7 +25,7 @@ jobs: sleep 10 - name: Benchmark PR run: oha -z 10s http://localhost/v1/health/version -j > benchmark.json - - name: cleaning + - name: Cleaning run: docker compose down -v - name: Installing latest version run: | @@ -42,18 +42,18 @@ jobs: run: | echo '## :sparkles: Benchmark results' > benchmark.txt echo ' ' >> benchmark.txt - echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark.json)" >> benchmark.txt + echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber?|floor' benchmark.json)" >> benchmark.txt echo "- Total 200 requests: $(jq -r '.statusCodeDistribution."200"' benchmark.json)" >> benchmark.txt echo "- 99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt - echo ' ' >> benchmark.txt - echo ' ' >> benchmark.txt - echo '## :zap: Benchmark results' >> benchmark.txt - echo ' ' >> benchmark.txt - echo '| Metric | PR | Latest version | ' >> benchmark.txt - echo '| --- | --- | --- | ' >> benchmark.txt - echo '| RPS | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark-latest.json) | ' >> benchmark.txt - echo '| 200 | $(jq -r '.statusCodeDistribution."200"' benchmark.json) | $(jq -r '.statusCodeDistribution."200"' benchmark-latest.json) | ' >> benchmark.txt - echo '| P99 | $(jq -r '.latencyPercentiles.p99' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | ' >> benchmark.txt + echo " " >> benchmark.txt + echo " " >> benchmark.txt + echo "## :zap: Benchmark results" >> benchmark.txt + echo " " >> benchmark.txt + echo "| Metric | PR | Latest version | " >> benchmark.txt + echo "| --- | --- | --- | " >> benchmark.txt + echo "| RPS | $(jq -r '.summary.requestsPerSec|tonumber?|floor' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark-latest.json) | " >> benchmark.txt + echo "| 200 | $(jq -r '.statusCodeDistribution."200"' benchmark.json) | $(jq -r '.statusCodeDistribution."200"' benchmark-latest.json) | " >> benchmark.txt + echo "| P99 | $(jq -r '.latencyPercentiles.p99' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | " >> benchmark.txt - name: Save results uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} From 5caff5abd3d19dafe8138b430936b54368264b75 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 17:16:43 -0400 Subject: [PATCH 09/16] feat: Compering to latest version --- .github/workflows/benchmark.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index e975262779..ad22706291 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -24,7 +24,7 @@ jobs: docker compose up -d sleep 10 - name: Benchmark PR - run: oha -z 10s http://localhost/v1/health/version -j > benchmark.json + run: oha -z 180s http://localhost/v1/health/version -j > benchmark.json - name: Cleaning run: docker compose down -v - name: Installing latest version @@ -37,7 +37,7 @@ jobs: docker compose up -d sleep 10 - name: Benchmark Latest - run: oha -z 10s http://localhost/v1/health/version -j > benchmark-latest.json + run: oha -z 180s http://localhost/v1/health/version -j > benchmark-latest.json - name: Prepare comment run: | echo '## :sparkles: Benchmark results' > benchmark.txt From da3a60cc5067f170fa1fd6af5f06aafd68e8abb4 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 17:19:04 -0400 Subject: [PATCH 10/16] fix: Wording --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index ad22706291..fea5cf9eb8 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -47,7 +47,7 @@ jobs: echo "- 99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt echo " " >> benchmark.txt echo " " >> benchmark.txt - echo "## :zap: Benchmark results" >> benchmark.txt + echo "## :zap: Benchmark Compering" >> benchmark.txt echo " " >> benchmark.txt echo "| Metric | PR | Latest version | " >> benchmark.txt echo "| --- | --- | --- | " >> benchmark.txt From 8b7c76de915865c50124aa20c41e0eaca7f3007c Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 17:20:55 -0400 Subject: [PATCH 11/16] feat: Making sure benchmark uses production version --- .github/workflows/benchmark.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index fea5cf9eb8..1a29f232d8 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -21,6 +21,8 @@ jobs: - name: Prepare environment run: | sed -i 's/traefik/localhost/g' .env + sed -i 's/TESTING: true/TESTING: false/g' docker-compose.yml + sed -i 's/VERSION: dev/VERSION: production/g' docker-compose.yml docker compose up -d sleep 10 - name: Benchmark PR From bf29d9c1af7ad9acef0c4bfdb86a7eaacc7be638 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Thu, 18 Jul 2024 18:21:58 -0400 Subject: [PATCH 12/16] fixes: Review --- .github/workflows/benchmark.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 1a29f232d8..8ad56c0ddd 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -45,13 +45,13 @@ jobs: echo '## :sparkles: Benchmark results' > benchmark.txt echo ' ' >> benchmark.txt echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber?|floor' benchmark.json)" >> benchmark.txt - echo "- Total 200 requests: $(jq -r '.statusCodeDistribution."200"' benchmark.json)" >> benchmark.txt - echo "- 99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt + echo "- Requests with 200 status code: $(jq -r '.statusCodeDistribution."200"' benchmark.json)" >> benchmark.txt + echo "- P99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt echo " " >> benchmark.txt echo " " >> benchmark.txt - echo "## :zap: Benchmark Compering" >> benchmark.txt + echo "## :zap: Benchmark Comparison" >> benchmark.txt echo " " >> benchmark.txt - echo "| Metric | PR | Latest version | " >> benchmark.txt + echo "| Metric | This PR | Latest version | " >> benchmark.txt echo "| --- | --- | --- | " >> benchmark.txt echo "| RPS | $(jq -r '.summary.requestsPerSec|tonumber?|floor' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark-latest.json) | " >> benchmark.txt echo "| 200 | $(jq -r '.statusCodeDistribution."200"' benchmark.json) | $(jq -r '.statusCodeDistribution."200"' benchmark-latest.json) | " >> benchmark.txt From a4eeebef88e99362e3bfdf91a839449f424607c0 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:47:39 -0400 Subject: [PATCH 13/16] feat: Benchmark to sub-job in test --- .github/workflows/benchmark.yml | 69 -------------------------------- .github/workflows/tests.yml | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 69 deletions(-) delete mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 8ad56c0ddd..0000000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: "Benchmarks" - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -on: [ pull_request ] -jobs: - benchmarking: - name: Benchmark - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Install Oha - run: | - echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ stable main" | sudo tee /etc/apt/sources.list.d/azlux.list - sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg - sudo apt update - sudo apt install oha - - name: Prepare environment - run: | - sed -i 's/traefik/localhost/g' .env - sed -i 's/TESTING: true/TESTING: false/g' docker-compose.yml - sed -i 's/VERSION: dev/VERSION: production/g' docker-compose.yml - docker compose up -d - sleep 10 - - name: Benchmark PR - run: oha -z 180s http://localhost/v1/health/version -j > benchmark.json - - name: Cleaning - run: docker compose down -v - - name: Installing latest version - run: | - rm docker-compose.yml - rm .env - curl https://appwrite.io/install/compose -o docker-compose.yml - curl https://appwrite.io/install/env -o .env - sed -i 's/_APP_OPTIONS_ABUSE=enabled/_APP_OPTIONS_ABUSE=disabled/g' .env - docker compose up -d - sleep 10 - - name: Benchmark Latest - run: oha -z 180s http://localhost/v1/health/version -j > benchmark-latest.json - - name: Prepare comment - run: | - echo '## :sparkles: Benchmark results' > benchmark.txt - echo ' ' >> benchmark.txt - echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber?|floor' benchmark.json)" >> benchmark.txt - echo "- Requests with 200 status code: $(jq -r '.statusCodeDistribution."200"' benchmark.json)" >> benchmark.txt - echo "- P99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt - echo " " >> benchmark.txt - echo " " >> benchmark.txt - echo "## :zap: Benchmark Comparison" >> benchmark.txt - echo " " >> benchmark.txt - echo "| Metric | This PR | Latest version | " >> benchmark.txt - echo "| --- | --- | --- | " >> benchmark.txt - echo "| RPS | $(jq -r '.summary.requestsPerSec|tonumber?|floor' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark-latest.json) | " >> benchmark.txt - echo "| 200 | $(jq -r '.statusCodeDistribution."200"' benchmark.json) | $(jq -r '.statusCodeDistribution."200"' benchmark-latest.json) | " >> benchmark.txt - echo "| P99 | $(jq -r '.latencyPercentiles.p99' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | " >> benchmark.txt - - name: Save results - uses: actions/upload-artifact@v4 - if: ${{ !cancelled() }} - with: - name: benchmark.json - path: benchmark.json - retention-days: 7 - - name: Comment on PR - uses: thollander/actions-comment-pull-request@v2 - with: - filePath: benchmark.txt diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7bc39392ef..c0bedd0797 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -148,3 +148,73 @@ jobs: - name: Run ${{matrix.service}} Shared Tables Tests run: _APP_DATABASE_SHARED_TABLES=database_db_main docker compose exec -T appwrite test /usr/src/code/tests/e2e/Services/${{matrix.service}} --debug + + benchamrking: + name: Benchmark + runs-on: ubuntu-latest + needs: setup + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Load Cache + uses: actions/cache@v3 + with: + key: ${{ env.CACHE_KEY }} + path: /tmp/${{ env.IMAGE }}.tar + fail-on-cache-miss: true + - name: Load and Start Appwrite + run: | + sed -i 's/traefik/localhost/g' .env + sed -i 's/TESTING: true/TESTING: false/g' docker-compose.yml + sed -i 's/VERSION: dev/VERSION: production/g' docker-compose.yml + docker load --input /tmp/${{ env.IMAGE }}.tar + docker compose up -d + sleep 10 + - name: Install Oha + run: | + echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ stable main" | sudo tee /etc/apt/sources.list.d/azlux.list + sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg + sudo apt update + sudo apt install oha + - name: Benchmark PR + run: oha -z 180s http://localhost/v1/health/version -j > benchmark.json + - name: Cleaning + run: docker compose down -v + - name: Installing latest version + run: | + rm docker-compose.yml + rm .env + curl https://appwrite.io/install/compose -o docker-compose.yml + curl https://appwrite.io/install/env -o .env + sed -i 's/_APP_OPTIONS_ABUSE=enabled/_APP_OPTIONS_ABUSE=disabled/g' .env + docker compose up -d + sleep 10 + - name: Benchmark Latest + run: oha -z 180s http://localhost/v1/health/version -j > benchmark-latest.json + - name: Prepare comment + run: | + echo '## :sparkles: Benchmark results' > benchmark.txt + echo ' ' >> benchmark.txt + echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber?|floor' benchmark.json)" >> benchmark.txt + echo "- Requests with 200 status code: $(jq -r '.statusCodeDistribution."200"' benchmark.json)" >> benchmark.txt + echo "- P99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt + echo " " >> benchmark.txt + echo " " >> benchmark.txt + echo "## :zap: Benchmark Comparison" >> benchmark.txt + echo " " >> benchmark.txt + echo "| Metric | This PR | Latest version | " >> benchmark.txt + echo "| --- | --- | --- | " >> benchmark.txt + echo "| RPS | $(jq -r '.summary.requestsPerSec|tonumber?|floor' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark-latest.json) | " >> benchmark.txt + echo "| 200 | $(jq -r '.statusCodeDistribution."200"' benchmark.json) | $(jq -r '.statusCodeDistribution."200"' benchmark-latest.json) | " >> benchmark.txt + echo "| P99 | $(jq -r '.latencyPercentiles.p99' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | " >> benchmark.txt + - name: Save results + uses: actions/upload-artifact@v4 + if: ${{ !cancelled() }} + with: + name: benchmark.json + path: benchmark.json + retention-days: 7 + - name: Comment on PR + uses: thollander/actions-comment-pull-request@v2 + with: + filePath: benchmark.txt From 546161ce08157b09722d38ffe2cf87399f48d962 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:48:30 -0400 Subject: [PATCH 14/16] feat: Benchmark to sub-job in test --- .github/workflows/tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c0bedd0797..7ffe08e082 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -165,8 +165,6 @@ jobs: - name: Load and Start Appwrite run: | sed -i 's/traefik/localhost/g' .env - sed -i 's/TESTING: true/TESTING: false/g' docker-compose.yml - sed -i 's/VERSION: dev/VERSION: production/g' docker-compose.yml docker load --input /tmp/${{ env.IMAGE }}.tar docker compose up -d sleep 10 From 0cc75b6c8712de537883cae1ad220a912fc024b9 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:19:34 -0400 Subject: [PATCH 15/16] feat: Adding thousands' comma --- .github/workflows/tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7ffe08e082..ba18a9acea 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -193,18 +193,18 @@ jobs: run: | echo '## :sparkles: Benchmark results' > benchmark.txt echo ' ' >> benchmark.txt - echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber?|floor' benchmark.json)" >> benchmark.txt - echo "- Requests with 200 status code: $(jq -r '.statusCodeDistribution."200"' benchmark.json)" >> benchmark.txt - echo "- P99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt + echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber?|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json)" >> benchmark.txt + echo "- Requests with 200 status code: $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json)" >> benchmark.txt + echo "- P99 latency: $(jq -r '.latencyPercentiles.p99|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json )" >> benchmark.txt echo " " >> benchmark.txt echo " " >> benchmark.txt echo "## :zap: Benchmark Comparison" >> benchmark.txt echo " " >> benchmark.txt echo "| Metric | This PR | Latest version | " >> benchmark.txt echo "| --- | --- | --- | " >> benchmark.txt - echo "| RPS | $(jq -r '.summary.requestsPerSec|tonumber?|floor' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark-latest.json) | " >> benchmark.txt - echo "| 200 | $(jq -r '.statusCodeDistribution."200"' benchmark.json) | $(jq -r '.statusCodeDistribution."200"' benchmark-latest.json) | " >> benchmark.txt - echo "| P99 | $(jq -r '.latencyPercentiles.p99' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | " >> benchmark.txt + echo "| RPS | $(jq -r '.summary.requestsPerSec|tonumber?|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark-latest.json) | " >> benchmark.txt + echo "| 200 | $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json) | $(jq -r '.statusCodeDistribution."200"' benchmark-latest.json) | " >> benchmark.txt + echo "| P99 | $(jq -r '.latencyPercentiles.p99|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | " >> benchmark.txt - name: Save results uses: actions/upload-artifact@v4 if: ${{ !cancelled() }} From be4c0f52a7ecf3a136018ab3de3f011a901d3d69 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Fri, 19 Jul 2024 13:40:15 -0400 Subject: [PATCH 16/16] feat: Adding thousands' comma --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ba18a9acea..3e5cb35721 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -195,16 +195,16 @@ jobs: echo ' ' >> benchmark.txt echo "- Requests per second: $(jq -r '.summary.requestsPerSec|tonumber?|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json)" >> benchmark.txt echo "- Requests with 200 status code: $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json)" >> benchmark.txt - echo "- P99 latency: $(jq -r '.latencyPercentiles.p99|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json )" >> benchmark.txt + echo "- P99 latency: $(jq -r '.latencyPercentiles.p99' benchmark.json )" >> benchmark.txt echo " " >> benchmark.txt echo " " >> benchmark.txt echo "## :zap: Benchmark Comparison" >> benchmark.txt echo " " >> benchmark.txt echo "| Metric | This PR | Latest version | " >> benchmark.txt echo "| --- | --- | --- | " >> benchmark.txt - echo "| RPS | $(jq -r '.summary.requestsPerSec|tonumber?|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor' benchmark-latest.json) | " >> benchmark.txt - echo "| 200 | $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json) | $(jq -r '.statusCodeDistribution."200"' benchmark-latest.json) | " >> benchmark.txt - echo "| P99 | $(jq -r '.latencyPercentiles.p99|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | " >> benchmark.txt + echo "| RPS | $(jq -r '.summary.requestsPerSec|tonumber?|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json) | $(jq -r '.summary.requestsPerSec|tonumber|floor|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark-latest.json) | " >> benchmark.txt + echo "| 200 | $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark.json) | $(jq -r '.statusCodeDistribution."200"|tostring|[while(length>0;.[:-3])|.[-3:]]|reverse|join(",")' benchmark-latest.json) | " >> benchmark.txt + echo "| P99 | $(jq -r '.latencyPercentiles.p99' benchmark.json ) | $(jq -r '.latencyPercentiles.p99' benchmark-latest.json ) | " >> benchmark.txt - name: Save results uses: actions/upload-artifact@v4 if: ${{ !cancelled() }}