website/src/content/docs/general/architecture.mdx
actors have create, destroy, wake, and sleep lifecycle hooks that you can implement to modify behavior. see the lifecycle docs for reference on actor lifecycel hook sequences
options.sleepTimeout) that decides how long to keep the actor in memory with no recent activityc.setPreventSleep(true)actor definitions include the following generic parameters that you'll see frequently in the code:
POST /gateway/{actor id}/actions/{action name}c.log that automatically logs the actor id + keyRIVET_LOG_LEVEL env varthe behavior for each is described below:
| Event | Restart | Sleep | Destroy |
|---|---|---|---|
| Graceful exit (StopCode::Ok) | Destroy | Destroy | Destroy |
| Crash (non-Ok exit) | Reschedule | Sleep | Destroy |
| Lost (runner disappeared) | Reschedule | Sleep | Destroy |
| Lost + force_reschedule | Reschedule | Reschedule | Reschedule |
| GoingAway (runner draining) | Reschedule | Sleep | Destroy |
| No capacity (allocation) | Queue (wait) | Sleep | Queue (wait) |
| No capacity + serverless | Queue (wait) | Queue (wait) | Queue (wait) |
| Wake signal (while sleeping) | Reschedule | Reschedule | Reschedule |
this is how actors with different crash policies behave when when there's backpressure:
see the above matrix for more details on actor crash policy on how it handles no capacity.
the actor queue is built to withstand high amounts of backpressure on rivet, so queueing actors is fine here
a large queue means it'll take more time for your application to process the queue to catch up with demand when it comes online.
there are 2 types of runners:
TODO
/health that lets you check if your actor is reachable (e.g. curl https://api.rivet.dev/gateway/{actor id}/health)actors is a loose term, but there are generally 2 types of schedulign in practice:
rivet has similarities with both to provide more flexibility: