A containerized microservices testbed (3 FastAPI REST APIs) with a C++17 profiling engine and full observability using Prometheus and Grafana.
- 3 FastAPI services with health/readiness endpoints and Prometheus metrics
- Prometheus scraping and Grafana provisioning with ready-to-use dashboards
- C++17 profiler (libcurl + nlohmann/json) with rolling-window percentile computation scaffolding
- Pytest unit/integration tests and GitHub Actions CI (lint, tests, compose up, artifact export)
- Load testing scripts (k6/hey) to reproduce ~1,000 rps locally
Prereqs: Docker, Docker Compose, Python 3.10+, Node (for k6 optional) or install hey.
- Build and run the stack
docker compose up --build -d- Verify services
curl -s localhost:8000/healthz
curl -s localhost:8001/healthz
curl -s localhost:8002/healthz- Open Observability
- Prometheus:
http://localhost:9090 - Grafana:
http://localhost:3000(admin/admin)
- Load test (example: 1,000 rps for 60s)
bash scripts/hey.sh
# or
k6 run scripts/k6.js- Run tests locally
python -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt -r tests/requirements-test.txt
pytest -qBuild the C++ profiler locally:
cmake -S src/profiler_engine -B build/profiler_engine
cmake --build build/profiler_engine -jRun (example):
./build/profiler_engine/profiler_engine http://localhost:9090src/services— FastAPI microservices and shared middlewareconfig/prometheus— Prometheus scraping configconfig/grafana— Datasource + dashboards provisioningsrc/profiler_engine— C++17 profilertests— Python unit/integration testsscripts— Load testing scripts
- If Grafana dashboards are empty, check Prometheus targets page and ensure services expose
/metrics. - To tune throughput, set env
UVICORN_WORKERSandUVICORN_LOOP=uvloopin compose. - For small images, we use slim bases and non-root users in service containers.
Target: ~1,000 rps with ≥99.8% success and reasonable P95 (<300ms on laptop).
Commands:
docker compose up --build -d
RATE=1000 DURATION=60s CONCURRENCY=200 bash scripts/hey.sh http://localhost:8000/data
# Expect: non-2xx/3xx <= 0.2% and latency P95 tracked in Grafana via histogram_quantileSee CONTRIBUTING.md for guidelines.