# 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 ## 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: 1. **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) 2. **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: 1. Run Lighthouse audit again (should see improvement from reduced TTFB) 2. Measure LCP/CLS with web.dev or Chrome DevTools 3. Update baseline with full metrics --- ## Next Steps 1. **Immediate:** Create [BIT-2081](/BIT/issues/BIT-2081) — Implement Cache-Control headers in Astro frontend 2. **After fix merged:** Re-run full audit to validate target achievement 3. **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) ```