Skip to content

Commit 1fd1cef

Browse files
committed
Update ci-performance.yml
1 parent d94f348 commit 1fd1cef

File tree

1 file changed

+37
-3
lines changed

1 file changed

+37
-3
lines changed

.github/workflows/ci-performance.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,31 @@ jobs:
6565
- name: Build Parse Server (base)
6666
run: npm run build
6767

68+
- name: Setup Toxiproxy for latency simulation (baseline)
69+
run: |
70+
# Download and install toxiproxy
71+
wget -O toxiproxy.deb https://github.com/Shopify/toxiproxy/releases/download/v2.9.0/toxiproxy_2.9.0_amd64.deb
72+
sudo dpkg -i toxiproxy.deb
73+
74+
# Start toxiproxy server in background
75+
toxiproxy-server &
76+
sleep 2
77+
78+
# Create a proxy for MongoDB (27017 -> 27018)
79+
toxiproxy-cli create mongodb -l localhost:27018 -u localhost:27017
80+
81+
# Add 10ms latency to simulate network conditions
82+
toxiproxy-cli toxic add mongodb -t latency -a latency=10
83+
84+
echo "Toxiproxy setup complete - MongoDB accessible on port 27018 with 10ms latency"
85+
6886
- name: Run baseline benchmarks
6987
id: baseline
7088
env:
7189
NODE_ENV: production
90+
MONGODB_URI: mongodb://localhost:27018/parse_benchmark_test
7291
run: |
73-
echo "Running baseline benchmarks with CPU affinity (using PR's benchmark script)..."
92+
echo "Running baseline benchmarks with CPU affinity and 10ms DB latency (using PR's benchmark script)..."
7493
if [ ! -f "benchmark/performance.js" ]; then
7594
echo "⚠️ Benchmark script not found - this is expected for new features"
7695
echo "Skipping baseline benchmark"
@@ -130,12 +149,27 @@ jobs:
130149
- name: Build Parse Server (PR)
131150
run: npm run build
132151

152+
- name: Restart Toxiproxy for PR benchmarks
153+
run: |
154+
# Restart toxiproxy server (toxiproxy-cli is already installed from baseline)
155+
pkill toxiproxy-server || true
156+
sleep 1
157+
toxiproxy-server &
158+
sleep 2
159+
160+
# Recreate proxy with same configuration
161+
toxiproxy-cli create mongodb -l localhost:27018 -u localhost:27017
162+
toxiproxy-cli toxic add mongodb -t latency -a latency=10
163+
164+
echo "Toxiproxy restarted with 10ms latency"
165+
133166
- name: Run PR benchmarks
134167
id: pr-bench
135168
env:
136169
NODE_ENV: production
170+
MONGODB_URI: mongodb://localhost:27018/parse_benchmark_test
137171
run: |
138-
echo "Running PR benchmarks with CPU affinity..."
172+
echo "Running PR benchmarks with CPU affinity and 10ms DB latency..."
139173
taskset -c 0 npm run benchmark > pr-output.txt 2>&1 || npm run benchmark > pr-output.txt 2>&1 || true
140174
echo "Benchmark command completed with exit code: $?"
141175
echo "Output file size: $(wc -c < pr-output.txt) bytes"
@@ -306,7 +340,7 @@ jobs:
306340
echo "" >> comment.md
307341
echo "*Benchmarks ran with ${BENCHMARK_ITERATIONS:-1000} iterations per test on Node.js ${{ env.NODE_VERSION }} (production mode, CPU pinned)*" >> comment.md
308342
echo "" >> comment.md
309-
echo "> **Note:** Using 1k iterations with CPU affinity for measurement stability. Thresholds: ⚠️ >50%, ❌ >100%." >> comment.md
343+
echo "> **Note:** Both baseline and PR benchmarks run with 10ms simulated database latency to better measure optimization impact. Using 1k iterations with CPU affinity for measurement stability. Thresholds: ⚠️ >50%, ❌ >100%." >> comment.md
310344
311345
- name: Comment PR with results
312346
if: github.event_name == 'pull_request'

0 commit comments

Comments
 (0)