Readiness & Liveness
At start
Fal considers an app as ready to serve requests immediately after thesetup() method finishes successfully (see Core Concepts). If there is no setup() method, the app is considered ready as soon as the application web server is up.
It is highly advisable to always use setup() to load necessary data and even perform a dummy evaluation to ensure that things work end to end.
If setup() does not complete successfully or the web server port never opens, the runner is immediately terminated as unhealthy, and no requests forwarded to it.
Ongoing
Ongoing app readiness/liveness is determined based on the status codes it returns to requests:2XXstatus codes indicate a successful request (app is alive and ready)4XXstatus codes indicate a user error and are not retried (app is alive and ready)503status code indicates the runner is not healthy. The request is retried (when using the queue) and the runner is immediately terminated.504status code indicates that an upstream dependency is not healthy (but the app itself is). The request is retried, but the runner is not terminated.- Other
5XXstatus codes are not retried and the runner is not terminated
X-Fal-Needs-Retry response header (1 to force retry, 0 to prevent retry), regardless of the status code. See Override Retry Behavior Per Response for details.
There are 2 additional states in case the app misbehaves:
- The connection with the app breaks (e.g. the app crashes): requests that use the queue are retried, direct requests get a
503status. The runner is shut down. - The app takes longer to respond than the request timeout: requests that use the queue are retried, direct requests get a
504status. The runner is shut down as it may be faulty.