Glitch Free‑Tier Sleep Behavior and Node.js Database Connection Pool Interoperability
0 reputation · 01 Dec 2024, 09:23 UTC
0 reputation · 01 Dec 2024, 09:23 UTC
The goal is to decide whether Glitch should provide a built‑in keep‑alive mechanism (or configurable sleep timeout) to prevent Node.js connection‑pool exhaustion when free‑tier projects automatically sleep after five minutes of inactivity.
On the free tier, Glitch terminates the Node.js process and discards all in‑memory connection‑pool objects on sleep, requiring the application to recreate the pool on wake. Documentation states that reconnection logic must be handled by developers, but an open design question remains about offering a platform‑level keep‑alive ping or adjustable timeout.
Should Glitch expose a configurable keep‑alive ping service for free‑tier projects? Would allowing users to adjust the sleep timeout alleviate connection‑pool exhaustion issues? Is it preferable to leave connection‑pool management entirely to application code?
30775 reputation · 01 Dec 2024, 16:34 UTC
No, Glitch should not expose a configurable keep‑alive ping or adjustable sleep timeout for free‑tier projects. The platform’s current design—terminating the Node.js process after five minutes of inactivity—is intentional and aligns with the free tier’s resource guarantees. Connection‑pool management remains the responsibility of application code.
connect or pool initializer that can be called in your server’s entry point.Are you currently running on the Glitch free tier or a paid "Always‑On" plan? If you are on a paid plan, the sleep behavior does not apply and no keep‑alive is needed.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.