Skip to content

Commit

Permalink
fix: ci to run in parallel
Browse files Browse the repository at this point in the history
Signed-off-by: Sahil Yeole <[email protected]>
  • Loading branch information
beelchester committed Jul 23, 2024
1 parent 95b2c65 commit dcd2360
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 50 deletions.
35 changes: 18 additions & 17 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ jobs:
if: github.event.head_commit.message != 'Update performance results in README.md'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
INFLUXDB_TOKEN: ${{ secrets.INFLUXDB_TOKEN }}
INFLUXDB_ORG: ${{ secrets.INFLUXDB_ORG }}
INFLUXDB_URL: ${{ secrets.INFLUXDB_URL }}
strategy:
matrix:
service:
Expand Down Expand Up @@ -48,19 +44,6 @@ jobs:
- name: Setup k6
uses: grafana/setup-k6-action@v1

- name: Setup influxdb-cli
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
echo "UPLOAD_TO_CLOUD=true" >> $GITHUB_ENV
mkdir -p influxdb
cd influxdb
wget https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz
tar xvzf influxdb2-client-2.7.5-linux-amd64.tar.gz
cp influx /usr/local/bin/
influx config create --config-name benchmark --host-url $INFLUXDB_URL --org $INFLUXDB_ORG --token $INFLUXDB_TOKEN --active
cd ..
rm -rf influxdb
- name: Run benchmarks
run: |
bash ./graphql/${{ matrix.service }}/setup.sh
Expand All @@ -78,10 +61,28 @@ jobs:
analyze:
needs: build
runs-on: benchmarking-runner
env:
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
INFLUXDB_TOKEN: ${{ secrets.INFLUXDB_TOKEN }}
INFLUXDB_ORG: ${{ secrets.INFLUXDB_ORG }}
INFLUXDB_URL: ${{ secrets.INFLUXDB_URL }}
steps:
- name: Checkout (GitHub)
uses: actions/checkout@v4

- name: Setup influxdb-cli
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
echo "UPLOAD_TO_CLOUD=true" >> $GITHUB_ENV
mkdir -p influxdb
cd influxdb
wget https://download.influxdata.com/influxdb/releases/influxdb2-client-2.7.5-linux-amd64.tar.gz
tar xvzf influxdb2-client-2.7.5-linux-amd64.tar.gz
cp influx /usr/local/bin/
influx config create --config-name benchmark --host-url $INFLUXDB_URL --org $INFLUXDB_ORG --token $INFLUXDB_TOKEN --active
cd ..
rm -rf influxdb
- name: Download all benchmark results
uses: actions/download-artifact@v3
with:
Expand Down
10 changes: 0 additions & 10 deletions analyze.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ for idx in "${!servers[@]}"; do
avgLatencies[${servers[$idx]}]=$(average "${latencyVals[@]}")
done

echo "Server Value" >"$reqSecData"
for server in "${servers[@]}"; do
echo "$server ${avgReqSecs[$server]}" >>"$reqSecData"
done

echo "Server Value" >"$latencyData"
for server in "${servers[@]}"; do
echo "$server ${avgLatencies[$server]}" >>"$latencyData"
done

whichBench=1
if [[ $1 == bench2* ]]; then
whichBench=2
Expand Down
9 changes: 9 additions & 0 deletions fetch_panels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Get rendered panels from grafana
from=$(date -u -d "-30 minutes" +"%Y-%m-%dT%H:%M:%S.%3NZ")
now=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")
curl -o assets/posts_users_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-1&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
curl -o assets/posts_users_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-2&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
curl -o assets/posts_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-5&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
curl -o assets/posts_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-6&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
curl -o assets/greet_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-8&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
curl -o assets/greet_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-9&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
6 changes: 5 additions & 1 deletion run_analyze_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,8 @@ for bench in 1 2 3; do
# Execute the command
echo "Executing: $cmd"
eval $cmd
done
done

if [[ "$UPLOAD_TO_CLOUD" == "true" ]]; then
bash fetch_panels.sh
fi
23 changes: 1 addition & 22 deletions run_benchmarks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,33 +89,12 @@ if [[ ! " ${valid_services[@]} " =~ " ${service} " ]]; then
exit 1
fi



runBenchmark "graphql/${service}/run.sh"
runBenchmark "${service}"

if [ "$service" == "apollo_server" ]; then
cd graphql/apollo_server/
npm stop
cd ../../
elif [ "$service" == "hasura" ]; then
bash "graphql/hasura/kill.sh"
fi

bash analyze.sh "${bench1Results[@]}"
bash analyze.sh "${bench2Results[@]}"
bash analyze.sh "${bench3Results[@]}"

if [[ "$UPLOAD_TO_CLOUD" == "true" ]]; then
# Wait for 5 seconds to ensure the results are uploaded to influxdb
sleep 5

# Get rendered panels from grafana
from=$(date -u -d "-30 minutes" +"%Y-%m-%dT%H:%M:%S.%3NZ")
now=$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")
curl -o assets/posts_users_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-1&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
curl -o assets/posts_users_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-2&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
curl -o assets/posts_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-5&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
curl -o assets/posts_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-6&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
curl -o assets/greet_req.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-8&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
curl -o assets/greet_latency.png -H "Authorization: Bearer $GRAFANA_API_KEY" "https://tailcall.grafana.net/render/d-solo/cdqucydulbfggb?tab=queries&from=$from&to=$now&panelId=panel-9&__feature.dashboardSceneSolo&width=1000&height=500&tz=Asia%2FCalcutta" --connect-timeout 120
fi

1 comment on commit dcd2360

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query Server Requests/sec Latency (ms) Relative
1 { posts { id userId title user { id name email }}}
[Tailcall] 0.00 0.00 x
[Netflix DGS] 0.00 0.00 x
[Hasura] 0.00 0.00 x
[GraphQL JIT] 0.00 0.00 x
[Gqlgen] 0.00 0.00 x
[Caliban] 0.00 0.00 x
[async-graphql] 0.00 0.00 x
[Apollo GraphQL] 0.00 0.00 x
2 { posts { title }}
[Tailcall] 0.00 0.00 x
[Netflix DGS] 0.00 0.00 x
[Hasura] 0.00 0.00 x
[GraphQL JIT] 0.00 0.00 x
[Gqlgen] 0.00 0.00 x
[Caliban] 0.00 0.00 x
[async-graphql] 0.00 0.00 x
[Apollo GraphQL] 0.00 0.00 x
3 { greet }
[Tailcall] 0.00 0.00 x
[Netflix DGS] 0.00 0.00 x
[Hasura] 0.00 0.00 x
[GraphQL JIT] 0.00 0.00 x
[Gqlgen] 0.00 0.00 x
[Caliban] 0.00 0.00 x
[async-graphql] 0.00 0.00 x
[Apollo GraphQL] 0.00 0.00 x

Please sign in to comment.