Skip to content

Commit c3ed214

Browse files
committed
added more caching
Signed-off-by: Lior Sventitzky <liorsve@amazon.com>
1 parent 8602e9d commit c3ed214

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

.github/workflows/benchmark.yml

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ jobs:
150150
git clone --depth 1 ${{ env.RESP_BENCH_REPO }} resp-bench
151151
RESP_BENCH_COMMIT=$(git -C resp-bench rev-parse HEAD)
152152
echo "commit=$RESP_BENCH_COMMIT" >> $GITHUB_OUTPUT
153-
echo "✓ resp-bench cloned (commit: ${RESP_BENCH_COMMIT:0:7})"
153+
154+
VALKEY_SERVER_VERSION=$(grep '^SERVER_VERSION?=' resp-bench/Makefile | cut -d= -f2)
155+
echo "valkey_version=$VALKEY_SERVER_VERSION" >> $GITHUB_OUTPUT
156+
echo "✓ resp-bench cloned (commit: ${RESP_BENCH_COMMIT:0:7}, valkey: $VALKEY_SERVER_VERSION)"
154157
155158
- name: Resolve inputs
156159
id: inputs
@@ -392,6 +395,28 @@ jobs:
392395
echo "primary_version=$PRIMARY_VERSION" >> $GITHUB_OUTPUT
393396
echo "secondary_version=$SECONDARY_VERSION" >> $GITHUB_OUTPUT
394397
398+
- name: Cache Valkey server binary
399+
id: cache-valkey
400+
uses: actions/cache@v4
401+
with:
402+
path: resp-bench/work/valkey
403+
key: valkey-server-${{ steps.resp-bench.outputs.valkey_version }}
404+
405+
- name: Cache Maven repository
406+
uses: actions/cache@v4
407+
with:
408+
path: ~/.m2/repository
409+
key: maven-bench-${{ steps.resp-bench.outputs.commit }}
410+
restore-keys: |
411+
maven-bench-
412+
413+
- name: Cache async-profiler
414+
id: cache-profiler
415+
uses: actions/cache@v4
416+
with:
417+
path: /opt/async-profiler
418+
key: async-profiler-3.0
419+
395420
- name: Restore SDV build from cache
396421
if: steps.driver-info.outputs.build_sdv == 'true'
397422
id: cache-sdv
@@ -418,13 +443,17 @@ jobs:
418443
PIDS=()
419444
NAMES=()
420445
421-
# 1. Pre-compile Valkey server (needed by orchestrator)
422-
echo "Starting Valkey server compilation..."
423-
(
424-
set -euo pipefail
425-
cd resp-bench && make "$(pwd)/work/valkey/bin/valkey-server"
426-
) > "$LOG_DIR/valkey.log" 2>&1 &
427-
PIDS+=($!); NAMES+=("valkey")
446+
# 1. Pre-compile Valkey server (skip if cached)
447+
if [ "${{ steps.cache-valkey.outputs.cache-hit }}" != "true" ]; then
448+
echo "Starting Valkey server compilation..."
449+
(
450+
set -euo pipefail
451+
cd resp-bench && make "$(pwd)/work/valkey/bin/valkey-server"
452+
) > "$LOG_DIR/valkey.log" 2>&1 &
453+
PIDS+=($!); NAMES+=("valkey")
454+
else
455+
echo "Valkey server restored from cache"
456+
fi
428457
429458
# 2. Build SDV from source (if needed and cache miss)
430459
if [ "${{ steps.driver-info.outputs.build_sdv }}" = "true" ] && [ "${{ steps.cache-sdv.outputs.cache-hit }}" != "true" ]; then
@@ -497,8 +526,8 @@ jobs:
497526
) > "$LOG_DIR/pip.log" 2>&1 &
498527
PIDS+=($!); NAMES+=("pip")
499528
500-
# 5. Install async-profiler
501-
if [ ! -f "/opt/async-profiler/bin/asprof" ]; then
529+
# 5. Install async-profiler (skip if cached)
530+
if [ "${{ steps.cache-profiler.outputs.cache-hit }}" != "true" ]; then
502531
echo "Downloading async-profiler..."
503532
(
504533
set -euo pipefail
@@ -507,7 +536,7 @@ jobs:
507536
) > "$LOG_DIR/ap.log" 2>&1 &
508537
PIDS+=($!); NAMES+=("ap")
509538
else
510-
echo "async-profiler already installed"
539+
echo "async-profiler restored from cache"
511540
fi
512541
513542
# Wait for all background processes

0 commit comments

Comments
 (0)