Skip to content

Commit 4a06899

Browse files
kevariableclaude
andcommitted
feat(k6): add wrk-style benchmarks and product ID testing scripts
- Add k6 benchmark scripts for wrk-style output format - Add benchmark targets to Makefile for all environments - Create product-by-id benchmark scripts for DB and projection endpoints - Add cycling through product IDs for realistic testing - Update documentation with benchmark usage instructions - Add performance testing images and examples New scripts: - k6/wrk_style_benchmark.js: Sequential wrk-style benchmarks - k6/get_product_by_id.js: Single product ID testing - k6/get_product_by_id_random.js: Cycling through DB product IDs - k6/get_product_by_id_projection.js: Cycling through projection IDs - k6/benchmark_comparison.js: Parallel benchmark comparison - run_benchmarks.sh: Shell script for sequential testing Makefile additions: - benchmark-franken, benchmark-franken-worker, benchmark-fpm - benchmark-product-by-id-* targets for single ID testing - benchmark-product-random-* targets for DB endpoint cycling - benchmark-product-projection-* targets for projection endpoint cycling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 86e73d8 commit 4a06899

19 files changed

+5330
-3435
lines changed

Makefile

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ K6_SERVICE := k6
44
FRANKEN_URL := http://localhost:8080
55
FRANKEN_WORKER_URL := http://localhost:8081
66
FPM_URL := http://localhost:8088
7+
PRODUCT_ID := 105069
78

89
.PHONY: k6 clean
910

@@ -14,7 +15,7 @@ pull-docker:
1415
docker pull prom/prometheus:v2.53.4
1516
docker pull grafana/grafana:latest
1617
docker pull hipages/php-fpm_exporter:latest
17-
docker pull dunglas/frankenphp
18+
docker pull dunglas/frankenphp:php8.4-bookworm
1819
@echo "All Docker images pulled successfully!"
1920

2021
# Individual Docker image pull commands
@@ -283,6 +284,90 @@ k6-install:
283284
fi; \
284285
fi
285286

287+
# Product by ID benchmark targets (single ID)
288+
.PHONY: benchmark-product-by-id-franken
289+
benchmark-product-by-id-franken:
290+
@echo "Running product by ID benchmark against Franken (port 8080)..."
291+
BASE_URL=$(FRANKEN_URL) PRODUCT_ID=$(PRODUCT_ID) k6 run k6/get_product_by_id.js
292+
293+
.PHONY: benchmark-product-by-id-franken-worker
294+
benchmark-product-by-id-franken-worker:
295+
@echo "Running product by ID benchmark against Franken Worker (port 8081)..."
296+
BASE_URL=$(FRANKEN_WORKER_URL) PRODUCT_ID=$(PRODUCT_ID) k6 run k6/get_product_by_id.js
297+
298+
.PHONY: benchmark-product-by-id-fpm
299+
benchmark-product-by-id-fpm:
300+
@echo "Running product by ID benchmark against FPM (port 8088)..."
301+
BASE_URL=$(FPM_URL) PRODUCT_ID=$(PRODUCT_ID) k6 run k6/get_product_by_id.js
302+
303+
.PHONY: benchmark-product-by-id-all
304+
benchmark-product-by-id-all:
305+
@echo "Running product by ID benchmarks against all environments..."
306+
@echo ""
307+
$(MAKE) benchmark-product-by-id-franken
308+
@echo ""
309+
@echo ""
310+
$(MAKE) benchmark-product-by-id-franken-worker
311+
@echo ""
312+
@echo ""
313+
$(MAKE) benchmark-product-by-id-fpm
314+
315+
# Product by ID benchmark targets (random IDs from projection)
316+
.PHONY: benchmark-product-random-franken
317+
benchmark-product-random-franken:
318+
@echo "Running random product ID benchmark against Franken (port 8080)..."
319+
BASE_URL=$(FRANKEN_URL) k6 run k6/get_product_by_id_random.js
320+
321+
.PHONY: benchmark-product-random-franken-worker
322+
benchmark-product-random-franken-worker:
323+
@echo "Running random product ID benchmark against Franken Worker (port 8081)..."
324+
BASE_URL=$(FRANKEN_WORKER_URL) k6 run k6/get_product_by_id_random.js
325+
326+
.PHONY: benchmark-product-random-fpm
327+
benchmark-product-random-fpm:
328+
@echo "Running random product ID benchmark against FPM (port 8088)..."
329+
BASE_URL=$(FPM_URL) k6 run k6/get_product_by_id_random.js
330+
331+
.PHONY: benchmark-product-random-all
332+
benchmark-product-random-all:
333+
@echo "Running random product ID benchmarks against all environments..."
334+
@echo ""
335+
$(MAKE) benchmark-product-random-franken
336+
@echo ""
337+
@echo ""
338+
$(MAKE) benchmark-product-random-franken-worker
339+
@echo ""
340+
@echo ""
341+
$(MAKE) benchmark-product-random-fpm
342+
343+
# Product by ID benchmark targets (cycling through IDs from /projection)
344+
.PHONY: benchmark-product-projection-franken
345+
benchmark-product-projection-franken:
346+
@echo "Running cycling product ID benchmark (Projection) against Franken (port 8080)..."
347+
BASE_URL=$(FRANKEN_URL) k6 run k6/get_product_by_id_projection.js
348+
349+
.PHONY: benchmark-product-projection-franken-worker
350+
benchmark-product-projection-franken-worker:
351+
@echo "Running cycling product ID benchmark (Projection) against Franken Worker (port 8081)..."
352+
BASE_URL=$(FRANKEN_WORKER_URL) k6 run k6/get_product_by_id_projection.js
353+
354+
.PHONY: benchmark-product-projection-fpm
355+
benchmark-product-projection-fpm:
356+
@echo "Running cycling product ID benchmark (Projection) against FPM (port 8088)..."
357+
BASE_URL=$(FPM_URL) k6 run k6/get_product_by_id_projection.js
358+
359+
.PHONY: benchmark-product-projection-all
360+
benchmark-product-projection-all:
361+
@echo "Running cycling product ID benchmarks (Projection) against all environments..."
362+
@echo ""
363+
$(MAKE) benchmark-product-projection-franken
364+
@echo ""
365+
@echo ""
366+
$(MAKE) benchmark-product-projection-franken-worker
367+
@echo ""
368+
@echo ""
369+
$(MAKE) benchmark-product-projection-fpm
370+
286371
# Projection rebuild targets
287372
.PHONY: rebuild-projections
288373
rebuild-projections:

0 commit comments

Comments
 (0)