Docs

Worker behavior and limits

What a Worker guarantees, its limits, and how it runs and scales on each platform.

Guarantees

Stateless execution. An instance can be stopped, frozen, or replaced at any time. Don't keep state in memory or on local disk between requests. Use KV, Storage, or Postgres.

At-least-once delivery. Queue messages, storage events, and commands can arrive more than once. Make handlers idempotent. Queue batches are unordered.

Access only to linked resources. A Worker gets bindings and cloud permissions only for resources it .link()s, granted through its permission profile. The cloud enforces this with IAM or RBAC.

Private by default. A Worker without a public endpoint has no internet-facing URL. On Google Cloud its Cloud Run service accepts internal traffic only. On Azure its Container App has no ingress.

Checked deploys. With a readiness probe, a deploy succeeds only after the probe returns a 2xx status.

Limits

LimitValue
timeoutSeconds1 to 3,600 (default 180)
memoryMb128 to 32,768 (default 512), narrowed per platform below
Queue triggers per Worker1
Batch maxMessages1 to 100. Above 10 needs a maxWindowSeconds above 0.
Batch maxWindowSeconds0 to 300
Worker IDLowercase letters, digits, single hyphens. Max 23 characters on Azure, 55 on AWS.
Readiness probeUp to 10 attempts, 30 seconds per request, backoff up to 60 seconds
waitUntil drain at shutdownUp to 15 seconds

Cloud limits that apply

LimitAWSGoogle CloudAzure
Max execution time15 minutes (900 s)60 minutesNo cloud cap on event work
Synchronous request body6 MB32 MB
Public HTTP request duration30 seconds (API Gateway HTTP API)Up to timeoutSeconds240 seconds (Container Apps ingress)
Concurrent requests per instance1Up to 1,000 (100 with queue batching)Container Apps default

Alien doesn't check timeoutSeconds against the AWS 900-second cap before deploy. Lambda refuses the function during deployment.

Memory and CPU

PlatformAccepted memoryMbCPU
AWS128 to 10,240 in 1 MB stepsScales with memory. 1 vCPU at 1,769 MB.
Google Cloud512 to 32,768. The gen2 environment refuses less than 512.Cloud Run allocates CPU. Throttled when idle, boosted at startup.
Azure512, 1,024, 1,536, 2,048, 2,560, 3,072, 3,584, 4,096. Other values round up to the next pair, with a warning. Above 4,096 is an error.Half a vCPU per GiB: 0.25 vCPU at 512 MB up to 2 vCPU at 4,096 MB.
Kubernetes, LocalNot checked

Scaling

PlatformMinimumMaximum
AWS0Account concurrency, or concurrencyLimit as reserved concurrency
Google Cloud0concurrencyLimit instances, otherwise Cloud Run's default
Azure0 for a private Worker, 1 with a public endpointconcurrencyLimit replicas, otherwise 10
Kubernetes1 replica1 replica

On AWS, concurrencyLimit reserves concurrency out of the account pool. Before deploy, Alien checks that the reservation leaves at least 100 unreserved executions, the Lambda minimum. concurrencyLimit(0) stops the function from running and reserves nothing.

Platform details

AWS

  • Lambda function packaged as a container image, ARM64 (Graviton).
  • Public endpoints go through an API Gateway HTTP API with a Lambda proxy integration, which ends requests at 30 seconds.
  • To stream responses, set WORKER_RESPONSE_STREAMING=true in the Worker's environment. Alien then uses a regional REST API with response streaming and a 15-minute integration timeout.
  • Queue triggers use an SQS event source mapping. Single delivery uses batch size 1. Batches use ReportBatchItemFailures, so only failed deliveries return to the queue.
  • The queue's visibility timeout is max(30s, min(12h, timeoutSeconds × 6)), plus maxWindowSeconds with batching.
  • If the queue is "frozen" (created during initial setup) and its visibility timeout is too short, the deploy stops and asks the admin to rerun initial setup.
  • With batching and concurrencyLimit, each queue mapping gets a maximum concurrency of concurrencyLimit divided by the number of queue sources, capped at 1,000. AWS needs at least 2, so below that the function's reserved concurrency is the only cap.
  • Storage triggers use S3 event notifications: created maps to s3:ObjectCreated:*, deleted to s3:ObjectRemoved:*.
  • Schedule triggers use EventBridge rules.
  • If the image lives in ECR in another region, Alien points the function at the replicated copy in the Worker's region. ECR replication must be configured separately.

Google Cloud

  • Cloud Run service on the gen2 execution environment. Containers listen on port 8080.
  • A Worker with a public endpoint accepts all traffic, and Alien turns off the Cloud Run invoker IAM check instead of granting allUsers. This works in organizations that restrict domain sharing. A private Worker accepts internal traffic only.
  • Custom domains use a global external HTTPS load balancer with a serverless network endpoint group.
  • Queue triggers use Pub/Sub push subscriptions. The ack deadline is timeoutSeconds clamped to 10 to 600 seconds.
  • Storage triggers use Cloud Storage notifications to a dedicated Pub/Sub topic. created maps to OBJECT_FINALIZE, deleted to OBJECT_DELETE, archived to OBJECT_ARCHIVE, metadataUpdated to OBJECT_METADATA_UPDATE.
  • Schedule triggers use Cloud Scheduler jobs in UTC.
  • With a Network, the service uses Direct VPC egress.

Azure

  • Container App in the stack's Container Apps environment. Containers listen on port 8080.
  • Queue triggers use a Dapr Service Bus input binding. With batching, Alien also adds a KEDA azure-servicebus scale rule with messageCount set to maxMessages.
  • Storage triggers go from Event Grid to a dedicated Service Bus queue, then to the Worker through a Dapr Service Bus binding. Supported events are created, deleted, and tierChanged. Any other event name is refused.
  • Schedule triggers use a Dapr cron binding.
  • The Worker authenticates with a user-assigned managed identity.

Kubernetes

  • Deployment and Service in the deployment namespace, one replica. The container listens on port 8080.
  • Triggers aren't wired on Kubernetes. Use a Container that consumes the queue itself, or call the Worker over HTTP.

Local

  • The built image is extracted and run as a native process with a port picked at start.
  • Alien saves Worker metadata to disk. After a crash or restart, the controller starts the Worker and its triggers again from the current configuration.
  • A local trigger service delivers queue messages (acknowledged only on success), storage events (file notifications plus reconciliation of stored objects), and cron events. Cron state is saved, so missed runs catch up after a restart.

Design decisions

One queue per Worker. A Worker consumes at most one queue, though it can combine that queue with storage and schedule triggers. To consume several queues, declare several Workers. The build refuses a second queue trigger.

Batching is opt-in. Without batch, each message is one invocation and existing handlers keep working. Batches report per-delivery outcomes, so one failure doesn't redeliver the whole batch.

Public endpoints are fixed at create. Changing a Worker's public endpoints is refused as an update. Delete and recreate the Worker to change them.

Scaling is the cloud's. Alien sets a ceiling with concurrencyLimit and otherwise leaves scaling to Lambda, Cloud Run, or Container Apps.

Next

On this page