improvement(db): further increase db limits (#696)

* increase sockets connection pool

* correct comment

* increase limits

* remove comments
This commit is contained in:
Vikhyath Mondreti
2025-07-15 12:02:32 -07:00
committed by GitHub
parent fd96e446ae
commit 2d83bbf769
3 changed files with 10 additions and 10 deletions

View File

@@ -11,22 +11,22 @@ const connectionString = env.POSTGRES_URL ?? env.DATABASE_URL
/**
* Connection Pool Allocation Strategy
*
* Main App: 25 connections per instance
* Socket Server: 5 connections (operations) + 2 connections (room manager) = 7 total
* Main App: 60 connections per instance
* Socket Server: 25 connections (operations) + 5 connections (room manager) = 30 total
*
* With ~3-4 Vercel serverless instances typically active:
* - Main app: 25 × 4 = 100 connections
* - Socket server: 7 connections total
* - Buffer: 21 connections
* - Total: ~128 connections
* - Supabase limit: 128 connections (16XL instance)
* - Main app: 60 × 4 = 240 connections
* - Socket server: 30 connections total
* - Buffer: 130 connections
* - Total: ~400 connections
* - Supabase limit: 400 connections (16XL instance direct connection pool)
*/
const postgresClient = postgres(connectionString, {
prepare: false,
idle_timeout: 20,
connect_timeout: 30,
max: 25,
max: 60,
onnotice: () => {},
})

View File

@@ -16,7 +16,7 @@ const socketDb = drizzle(
prepare: false,
idle_timeout: 10,
connect_timeout: 20,
max: 5,
max: 25,
onnotice: () => {},
debug: false,
}),

View File

@@ -14,7 +14,7 @@ const db = drizzle(
prepare: false,
idle_timeout: 15,
connect_timeout: 20,
max: 2,
max: 5,
onnotice: () => {},
}),
{ schema }