BuilderIO / BuilderIO/agent-native
Serverless Postgres: pool of 2 per instance plus about 60 requests per Documents page load exhausts a small Neon compute during deploys
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 449
- Avg merge
- 10h 24m
- Merged PRs (30d)
- 883
Description
# Serverless Postgres: pool of 2 per instance plus about 60 requests per Documents page load exhausts a small Neon compute during deploys
**Version:** `@agent-native/core` 0.176.4, Content (Documents) template, Vercel functions, Neon Postgres.
**What happens.** Right after a production deploy, Neon refused new connections ("remaining connection slots are reserved for roles with the SUPERUSER attribute"). Actions returned 500, then the workspace-app ACL returned 403, and lists rendered their empty states. Measured through the pooler: 68 of 112 server connections in use, 55 idle and held for our functions. A single Documents page load opens about 66 server connections; Documents also failed with "out of memory" on the smallest compute.
**Why.** The framework pool size is 2 per serverless instance (4 for background workers) with no configuration knob, and Content's page load fans out to roughly sixty parallel action requests, each landing on a different warm instance during deploy overlap. Three or four apps times old-plus-new instances is enough to reach a 0.25 CU cap of 112.
**Expected.** Either a documented pool-size setting, a recommended minimum Neon compute for workspaces in the deploy docs, batching of Content's initial requests, or a `PgBouncer`-style transaction pooling recommendation. A startup warning when `max_connections` is below apps x expected instances x pool would also help.
**Workaround used.** Neon compute raised to 0.5 to 1 CU (cap 450 after restart); app lists gained error states with Retry.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the framework pool settings and the Content (Documents) page-load requests described in the issue, then compare connection usage during deploy overlap with the Neon compute limit. Check the deploy documentation and the app-list error states mentioned in the report. Done means the connection surge is bounded or its supported mitigation is documented, and affected actions no longer fail silently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, typescript
- Domain
- backend, databases, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100