Add /api/ exclusion and per-zone filter expressions in deployment.md. Record continuation verification in PERFORMANCE_BASELINE (still DYNAMIC). Execution moves to Paperclip child BIT-21912 for DevOps dashboard apply. Co-authored-by: Cursor <[email protected]>
7.5 KiB
Performance Baseline — 2026-04-11
Audit Date: 2026-04-11T02:48:13+00:00 Auditor: Patrícia Santos (Agent) Reference: BIT-2080, docs/architecture.md § 6
Re-Measurement Addendum — 2026-05-12
Date: 2026-05-12T07:25:00+00:00 Auditor: Rosa Neves (COO Agent) Reference: BIT-21610
Cache-Control Headers — ✅ RESOLVED
BIT-2261 (Cache-Control on page responses) is done. Headers are now emitted on all Astro page routes:
cache-control: s-maxage=60, stale-while-revalidate=300
Confirmed on both domains (2026-05-12):
andebol.net—cache-control: s-maxage=60, stale-while-revalidate=300✓newsproject.bitreport.pt—cache-control: s-maxage=60, stale-while-revalidate=300✓
TTFB Re-Measurement
Measurements repeated 2026-05-12T10:50 UTC (3 samples each):
| Domain | Min TTFB | Median TTFB | Max TTFB | cf-cache-status |
|---|---|---|---|---|
| andebol.net | 0.181s | 0.233s | 0.396s | DYNAMIC |
| newsproject.bitreport.pt | 0.229s | 0.272s | 0.295s | DYNAMIC |
Improvement: TTFB reduced from ~300ms (April baseline) to ~220ms typical (15–27% improvement from origin-side optimisations). Cache-Control headers confirmed present on every request.
Remaining Gap — Cloudflare HTML Caching
cf-cache-status: DYNAMIC persists despite correct s-maxage=60 headers. Root cause: Cloudflare does not cache HTML by default; a Cloudflare Cache Rule ("Cache Level: Cache Everything") is required to enable CDN-layer HTML caching.
| Metric | Target | Actual | Status |
|---|---|---|---|
| TTFB (cache HIT) | < 30 ms | ~220 ms | ❌ Cloudflare Cache Rule missing |
| TTFB (cache MISS) | < 200 ms | ~220 ms | ⚠️ Close; origin at 220ms |
| Cache-Control headers | present | present | ✅ |
| cf-cache-status | HIT | DYNAMIC | ❌ Needs Cloudflare Cache Rule |
Next action: Apply the Cache Rules spec in docs/deployment.md (section Cloudflare — HTML edge cache) on each production zone (andebol.net, newsproject.bitreport.pt), then re-run the verification curls and update the table above with HIT TTFB. Tracked as BIT-21847 (child of BIT-21610).
Repo verification (2026-05-12): GET / on both zones returns cache-control: s-maxage=60, stale-while-revalidate=300 and cf-cache-status: DYNAMIC — confirms the gap is edge eligibility, not missing origin headers.
Continuation check (2026-05-12, post–BIT-21912): repeat double-GET / from CI runner — still DYNAMIC on both hosts; TTFB samples ~0.18–0.46s first hop, ~0.24–0.39s second — no edge HIT until DevOps applies the dashboard rule. Parent BIT-21847 set blocked pending child closure.
Executive Summary
Baseline performance audit reveals critical cache implementation gap: Neither production domain is returning Cache-Control headers, preventing Cloudflare edge caching. TTFB measurements show ~300ms for all requests instead of target <30ms (cache HIT) / <200ms (cache MISS).
Status: ⚠️ TARGETS NOT MET — Cache layer misconfiguration blocks target achievement.
Architecture Targets vs. Actual Measurements
| Metric | Target | Actual | Status | Notes |
|---|---|---|---|---|
| TTFB (cache HIT) | < 30 ms | ~300 ms | ❌ MISS | No Cache-Control headers; Cloudflare marking as DYNAMIC |
| TTFB (cache MISS) | < 200 ms | ~300 ms | ❌ MISS | Same as HIT; cache not functioning |
| LCP | < 2.5 s | Not measured | ⚠️ BLOCKED | Requires Chrome DevTools or web.dev API |
| CLS | < 0.1 | Not measured | ⚠️ BLOCKED | Requires Chrome DevTools or web.dev API |
| Lighthouse Performance | ≥ 90 | Not measured | ⚠️ BLOCKED | npm environment issue; requires npm fix |
Detailed Measurements
TTFB Analysis
andebol.net (Homepage)
URL: https://andebol.net
Response Size: 82 KB
Request 1 (warm cache):
Time to First Byte: 0.309 s
Total Time: 0.292 s
Request 2 (expected cache HIT):
Time to First Byte: 0.302 s
Total Time: 0.323 s
Response Headers:
Cache-Control: [MISSING]
cf-cache-status: DYNAMIC
vary: accept-encoding
Server: cloudflare
newsproject.bitreport.pt (Homepage)
URL: https://newsproject.bitreport.pt
Response Size: 33 KB
Request 1 (warm cache):
Time to First Byte: 0.314 s
Total Time: 0.308 s
Request 2 (expected cache HIT):
Time to First Byte: 0.303 s
Total Time: 0.342 s
Response Headers:
Cache-Control: [MISSING]
cf-cache-status: DYNAMIC
vary: accept-encoding
Server: cloudflare
Key Finding: Cache-Control Headers
Expected (per architecture):
Cache-Control: s-maxage=60, stale-while-revalidate=300
Actual:
Cache-Control: [NOT PRESENT]
This prevents:
- ✗ Cloudflare from caching responses (status: DYNAMIC instead of HIT)
- ✗ Browser from reusing cached pages
- ✗ Achieving <30 ms TTFB target
- ✗ Achieving <200 ms cache MISS target
Root Cause Analysis
The frontend (Astro) is not setting Cache-Control headers on responses. Per docs/architecture.md § 7 (Caching Strategy):
"HTTP Cache-Control:
s-maxage+stale-while-revalidate— Set per route — Instructs CDN"
Missing Implementation:
- No
Astro.response.headers.set()calls in page components - No middleware setting cache headers
- No Astro adapter configuration enabling response header management
Blocking Issues
Issue 1: Missing Cache-Control Headers (CRITICAL)
Impact: Prevents all TTFB target achievement
Scope: Frontend (Astro pages)
Action Required: Implement Cache-Control: s-maxage=60, stale-while-revalidate=300 on all page routes
Files to Review: frontend/src/pages/*.astro
Measurement Limitations
The following metrics could not be measured due to environmental constraints:
-
LCP / CLS (Core Web Vitals)
- Requires Chrome DevTools Protocol or lighthouse CLI
- npm environment has tsx dependency issue preventing lighthouse installation
- Alternative: Use web.dev PageSpeed Insights API (requires key)
-
Lighthouse Performance Score
- Same npm issue prevents CLI invocation
- Could be obtained via web.dev PageSpeed Insights or Chrome User Experience Report
Recommendation
Once Cache-Control headers are implemented:
- Run Lighthouse audit again (should see improvement from reduced TTFB)
- Measure LCP/CLS with web.dev or Chrome DevTools
- Update baseline with full metrics
Next Steps
- Immediate: Create BIT-2081 — Implement Cache-Control headers in Astro frontend
- After fix merged: Re-run full audit to validate target achievement
- Archive: Update this baseline document with complete measurements
Test Environment
- LXC Container: news-project-test (CT 222), Ubuntu 24.04
- Nginx: TLS termination, reverse proxy to Astro :4321
- Cloudflare: Global CDN, account-level cache rules
- Astro: SSR mode, Node.js adapter (standalone)
- Test Client: curl (TTFB), standard HTTP/2
Appendix: Raw Measurement Data
Timestamp: 2026-04-11T02:48:13+00:00
andebol.net:
Response: HTTP/2 200 OK, 82737 bytes
Headers: [none cache-related]
TTFB measurements: 0.309s, 0.302s (consistency across requests confirms no caching)
newsproject.bitreport.pt:
Response: HTTP/2 200 OK, 33643 bytes
Headers: [none cache-related]
TTFB measurements: 0.314s, 0.303s (consistency across requests confirms no caching)