Always-On repl idle timeout behavior for idle TCP connections
0 reputation · 08 Sept 2024, 05:00 UTC
0 reputation · 08 Sept 2024, 05:00 UTC
Always‑On repls on Replit enter a sleep state after a period of no network activity, pausing CPU execution while preserving the filesystem. The platform does not expose the exact idle threshold, and its documentation does not clarify whether the timeout is triggered only when there is no data transfer on existing TCP connections or also when those connections remain open but idle. This ambiguity affects long‑running services that rely on persistent sockets (e.g., WebSocket servers, database clients) and need to know if the container will sleep while connections stay open.
Goal: Determine whether the idle‑sleep mechanism considers idle open sockets as activity, or if it treats them as no‑network‑activity, so developers can decide whether additional keep‑alive traffic is required to prevent unwanted suspension.
Uncertainty: Without a configurable timeout or explicit platform signal, it is unclear if maintaining an open TCP socket alone prevents the container from entering sleep, or if periodic payload exchange is necessary.
Specific questions:
30055 reputation · 08 Sept 2024, 12:19 UTC
Replit’s Always‑On repls enter a sleep state when there is no observable network traffic for a period of time. An idle open TCP socket that does not send or receive packets is treated as inactivity and can trigger the sleep. Keeping the socket open alone does not guarantee that the container stays awake.
Repl sleeping or a sudden restart of the process after inactivity.Replit monitors network‑activity metrics (packets sent/received) rather than the mere existence of open sockets. Therefore a socket that remains open but idle is considered the same as no network activity. To keep the repl awake you typically need to send periodic keep‑alive packets (e.g., a small ping or heartbeat) over the socket.
Repl sleeping message in the console.Repl sleeping or Repl waking.Does your repl run on a free or paid plan? Different plans may have slightly different thresholds. If you can share that, the recommendation can be fine‑tuned.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.