Description
The health endpoint DB latency has exceeded the 500ms threshold for two consecutive weeks: 799ms in W19, 658ms in W20. The health check already uses best-of-2 sampling with direct fetch (bypassing the Supabase JS client), so the bottleneck is likely on the Supabase infrastructure side — regional distance, connection pool saturation, or cold starts on the PostgREST layer.
Source: metrics/weekly/2026-W20-perf.md
Acceptance Criteria
Dependencies
None
Technical Notes
- Health endpoint:
src/app/api/health/route.ts — already optimized with direct fetch, best-of-2 sampling, keep-alive headers
- The
health_check RPC function is a simple DB ping — the latency is dominated by network round-trip, not query execution
- Supabase project config and Vercel deployment region are infrastructure settings, not code changes
- If the fix requires Supabase region migration or plan changes, document the steps for a maintainer to execute
Approval Required
This is a HIGH risk investigation:
- May require infrastructure changes (Supabase region migration, connection pooling configuration)
- Could involve Supabase plan changes with cost implications
- Region migration would require downtime planning and data migration
Comment "approved" to release this to the automation queue.
Description
The health endpoint DB latency has exceeded the 500ms threshold for two consecutive weeks: 799ms in W19, 658ms in W20. The health check already uses best-of-2 sampling with direct fetch (bypassing the Supabase JS client), so the bottleneck is likely on the Supabase infrastructure side — regional distance, connection pool saturation, or cold starts on the PostgREST layer.
Source:
metrics/weekly/2026-W20-perf.mdAcceptance Criteria
pnpm lint && pnpm typecheck && pnpm testpassDependencies
None
Technical Notes
src/app/api/health/route.ts— already optimized with direct fetch, best-of-2 sampling, keep-alive headershealth_checkRPC function is a simple DB ping — the latency is dominated by network round-trip, not query executionApproval Required
This is a HIGH risk investigation:
Comment "approved" to release this to the automation queue.