A Runtime Instance is a running production VM that serves a dynamic deployment. Static deployments do not have runtime instances; they’re served from MIOSA’s edge directly.
What a runtime instance is
A microVM booted by Firecracker from the customer’s release rootfs (not from the sandbox image, not from the builder image). The release is the customer’s app, fully packaged. The instance:
- Boots in under a few seconds.
- Receives
PORT,DATABASE_URL,AUTH_URL, and other env vars injected by MIOSA at boot. - Starts the configured
run_command. - Listens on
port. - Responds to
GET health_check_pathwith 2xx. - Joins the deployment’s backend pool; the router starts sending it traffic.
When a runtime instance dies (crash, host failure, configured restart), MIOSA’s reconciler notices and schedules a replacement on another healthy host.
What you control vs what MIOSA controls
| You | MIOSA |
|---|---|
| Release contents (your code + dependencies) | Where to schedule instances |
run_command and port | When to start / stop / replace instances |
health_check_path | Routing healthy instances to traffic |
| Desired replica count (eventually; defaults to 1) | Boot-time env var injection |
| Env vars set on the deployment | Telemetry, logs streaming |
You don’t pick a host directly. MIOSA’s scheduler matches your workload’s requirements (CPU, RAM, GPU if requested, region) against the fleet’s free capacity.
Lifecycle
pending → starting → healthy → stopping → stopped
↘ unhealthy ─┘
↘ failed pending: scheduled, not yet booting.starting: VM is booting; health check not yet passing.healthy: serving traffic.unhealthy: failing health checks; router has removed it from the pool. Reconciler decides whether to restart or replace.stopping/stopped: deliberately torn down.failed: terminal — exceeded crashloop budget. Reconciler stops trying.
Health checks and the grace period
When a runtime instance starts, it has a configurable grace period (default 60s) to become healthy. During grace, repeated 5xx / connection-refused are tolerated.
After grace, the health check is enforced strictly:
- 3 consecutive failures → instance marked
unhealthy, removed from routing. - If a replacement is needed and starts healthily, the old instance is torn down.
- Repeated rapid failures invoke crashloop backoff: 1s → 2s → 5s → 30s → 5min between restart attempts.
Blue/green during publish
When you publish a new dynamic version, MIOSA does NOT terminate the existing healthy instances first. The sequence is:
- Start new runtime instances from the new release.
- Wait until enough new instances pass health checks.
- Update the router so the deployment’s hostname points at the new instances.
- Drain (stop accepting new connections) and tear down old instances after old in-flight requests complete.
If step 2 never succeeds, step 3 never runs. The old version stays live, the new version is marked failed.
Replicas
By default, a dynamic service has 1 replica. Increase by setting desired_replicas on the service. The reconciler spreads replicas across hosts and across availability zones where possible.
await miosa.services.update(serviceId, { desiredReplicas: 3 }) Traffic load-balances across all healthy replicas in round-robin (or hash-based if sticky sessions are configured).
Resource sizing
| Spec | Default | Tunable per service |
|---|---|---|
| CPU | 1 vCPU | yes |
| Memory | 512 MB | yes |
| Disk | 1 GB ephemeral | yes |
| GPU | none | yes, requires GPU-eligible plan |
| Outbound bandwidth | metered | yes |
Sizing is per-service, per-deployment. A worker service can be smaller than a web service. A GPU inference service needs a GPU-capable host.
Logs
Runtime instances stream stdout/stderr to MIOSA’s log plane. Logs are retained per the tenant’s plan (default 7 days). Access them through:
GET /api/v1/deployments/:id/logs— deployment-scoped, all servicesGET /api/v1/services/:id/logs— per-serviceGET /api/v1/runtime-instances/:id/logs— per-instance
Logs include structured metadata: service_id, runtime_instance_id, version_id, host_id. Filter by external_workspace_id to scope to a white-label customer.
See also
- Releases — what runtime instances boot from
- Environments — variable / secret scope
- Domains — how traffic finds your instances
- Rollback — what happens to old instances on rollback