Concurrent runs
A policy can limit how many copies of your application run at the same time on one device. Seatify calls each running copy a process.
Seatify counts the processes of each device on its own. Two devices of one license do not share a count.
Process tracking
Process tracking is off by default. A process interval on the policy turns it on. Process tracking needs a policy that binds devices.
| Setting | Description |
|---|---|
| Process interval | The time between two process heartbeats. A process interval turns on process tracking. |
| Process grace | Extra time for a late process heartbeat. This setting is optional. |
| Process limit per device | The number of processes that can run at the same time on one device. It needs a process interval. This setting is optional. |
- Without a process limit, Seatify tracks the processes but does not limit them.
- If the policy has no process interval, spawn and process heartbeat fail with the reason
process_tracking_not_enabled. - Process tracking does not depend on device heartbeats. A process has a lease even if the policy does not require heartbeats.
Process properties
| Property | Description |
|---|---|
| Process ID | The identifier that your application sends for the process. The process ID from the operating system works. A container or a runtime can send its own identifier. |
| Device | The device that the process runs on. |
| Lease | The time when the process stops counting, if no heartbeat arrives first. See Leases. |
- A process ID identifies one process on one device. Two devices can use the same process ID.
- The process ID is case-sensitive, so
worker-aandWorker-Aare two processes.
Lifecycle
| Call | When to call it | Result |
|---|---|---|
| Spawn | When the application starts. | Seatify registers the process and starts its lease. |
| Heartbeat | While the application runs, once in each process interval. | Seatify starts the lease again. |
| Exit | When the application closes. | Seatify removes the process. The slot is free immediately. |
- The device must claim the license before the first spawn. A spawn from a device that has not claimed fails with
not_claimed. See Seats and devices. - A spawn with a process ID that is already running returns the same process. It does not use another slot. It starts the lease again.
- Spawn and heartbeat fail if the license is not valid. For example, they fail if the license is suspended.
- Exit also works on an expired or suspended license.
Leases
Every process has a lease. The lease lasts for the process interval plus the process grace. A spawn starts the lease. Each process heartbeat starts it again.
- The responses to spawn and heartbeat show when the lease ends.
- When the lease ends, the process ends. It no longer counts against the limit.
- After that, heartbeat and exit fail with
process_not_spawned. The application must spawn the process again, and the spawn checks the limit again. - If the application stops without an exit, the slot is free when the lease ends.
- A process belongs to the device binding. If the device is released, or its device lease ends, its processes end too. After that, spawn, heartbeat and exit fail with
not_claimed.
Limit
- The process limit counts the processes on one device whose lease has not ended.
- A spawn with a new process ID when the device is at the limit fails with
process_limit_reached. A refused spawn does not change the running processes. - An empty limit means that there is no limit. A limit is at least 1.
- A license can override the limit of its policy. One device can have its own limit, which replaces the limit of the license for that device. See License overrides.
- The responses to spawn and heartbeat show the limit that applies to the device.
Processes and device limits
A device limit and a process limit work together. The device limit counts the devices of a license. The process limit counts the copies on each device. For example, a device limit of 3 and a process limit of 2 allow 6 copies at the same time, with at most 2 on each device.
Activity
The activity log records each spawn, each exit and each refused call. A successful process heartbeat is not recorded. A process whose lease ends is not recorded either.
Next steps
- Limit concurrent runs shows how your application reports its processes.