|
| 1 | +--- |
| 2 | +id: index |
| 3 | +title: Serverless Workers |
| 4 | +sidebar_label: Serverless Workers |
| 5 | +slug: /evaluate/serverless-workers |
| 6 | +description: Understand the benefits of Serverless Workers and when to use them. Run Temporal Workers on serverless compute with no infrastructure to manage. |
| 7 | +toc_max_heading_level: 4 |
| 8 | +keywords: |
| 9 | + - serverless |
| 10 | + - lambda |
| 11 | + - aws |
| 12 | + - worker |
| 13 | + - serverless worker |
| 14 | + - evaluate |
| 15 | +tags: |
| 16 | + - Workers |
| 17 | + - Serverless |
| 18 | +--- |
| 19 | + |
| 20 | +Serverless Workers let you run Temporal Workers on serverless compute platforms like AWS Lambda. |
| 21 | +There are no servers to provision, no clusters to scale, and no idle compute to pay for. |
| 22 | +Temporal invokes the Worker when Tasks arrive, and the Worker shuts down when the work is done. |
| 23 | + |
| 24 | +Serverless Workers use the same Temporal SDKs as traditional Workers. |
| 25 | +You register Workflows and Activities the same way. |
| 26 | +The difference is in the lifecycle: instead of a long-lived process that polls continuously, Temporal triggers the compute environment on demand, the Worker processes available Tasks, and then exits. |
| 27 | + |
| 28 | +For a deeper look at how Serverless invocation works under the hood, see [Serverless Workers](/serverless-workers) in the encyclopedia. |
| 29 | + |
| 30 | +## Benefits |
| 31 | + |
| 32 | +### Reduce operational overhead |
| 33 | + |
| 34 | +Traditional Workers require you to provision infrastructure, configure scaling policies, manage deployments, and monitor host-level health. |
| 35 | +Serverless Workers remove this burden. |
| 36 | +The compute provider handles provisioning, scaling, and infrastructure management. |
| 37 | + |
| 38 | +Worker management is one of the most common sources of support questions for Temporal users. |
| 39 | +Serverless Workers offer a prescriptive deployment path that reduces the operational surface area and lets you focus on writing Workflows instead of managing infrastructure. |
| 40 | + |
| 41 | +### Get started faster |
| 42 | + |
| 43 | +Running a traditional Worker requires choosing a hosting strategy, configuring compute resources, and setting up deployment pipelines before you can execute your first Workflow. |
| 44 | + |
| 45 | +With Serverless Workers, deploying a Worker is as simple as deploying a function. |
| 46 | +Package your Worker code, deploy it to your serverless provider, and configure the connection to Temporal. There is no need to set up Kubernetes, manage container orchestration, or design a scaling strategy. |
| 47 | + |
| 48 | +### Scale automatically |
| 49 | + |
| 50 | +Serverless compute providers handle scaling natively. |
| 51 | +When Task volume increases, the provider spins up additional function instances. |
| 52 | +When traffic drops, instances scale down. When there is no work, there is no compute running. |
| 53 | + |
| 54 | +This automatic scaling is especially useful for bursty, event-driven workloads where traffic patterns are unpredictable or highly variable. |
| 55 | + |
| 56 | +### Pay only for what you use |
| 57 | + |
| 58 | +Traditional Workers run continuously, whether or not there is work to process. |
| 59 | +Serverless Workers run only when Tasks are available. |
| 60 | +For workloads with low or intermittent volume, this pay-per-invocation model can significantly reduce compute costs. |
| 61 | + |
| 62 | +## When to use Serverless Workers |
| 63 | + |
| 64 | +Serverless Workers are a good fit when: |
| 65 | + |
| 66 | +- **Workloads are bursty or event-driven.** Order processing, notifications, webhook handlers, and similar workloads that experience spiky traffic benefit from automatic scaling without over-provisioning. |
| 67 | +- **Traffic is low or intermittent.** If Workers spend most of their time idle, Serverless Workers eliminate the cost of always-on compute. |
| 68 | +- **You want a simpler getting-started path.** Deploying a function is simpler than setting up a container orchestration platform. Serverless Workers reduce the steps between writing Worker code and running your first Workflow. |
| 69 | +- **Your organization has standardized on serverless.** Teams that already run services on Lambda, Cloud Run, or similar platforms can run Temporal Workers using the same deployment patterns and tooling. |
| 70 | +- **You serve multiple tenants with infrequent workloads.** Platforms that run Workflows on behalf of many users or customers can avoid running dedicated Workers per tenant. |
| 71 | + |
| 72 | +Serverless Workers may not be ideal when: |
| 73 | + |
| 74 | +- **Workloads are long-running.** Serverless platforms enforce execution time limits (for example, AWS Lambda has a 15-minute maximum). Activities that run longer than the provider's timeout need a different hosting strategy. |
| 75 | +- **Workloads require sustained high throughput.** For consistently high-volume Task Queues, long-lived Workers on dedicated compute may be more cost-effective and performant. |
| 76 | +- **You need persistent connections.** Some features require a persistent connection between the Worker and Temporal, which serverless invocations do not maintain. |
| 77 | + |
| 78 | +## How Serverless Workers compare to traditional Workers |
| 79 | + |
| 80 | +| | Traditional Worker | Serverless Worker | |
| 81 | +|---|---|---| |
| 82 | +| **Lifecycle** | Long-lived process that runs continuously. | Invoked on demand. Starts and stops per invocation. | |
| 83 | +| **Scaling** | You manage scaling (Kubernetes HPA, instance count, etc.). | Temporal invokes additional instances as needed, within the compute provider's concurrency limits. | |
| 84 | +| **Connection** | Persistent connection to Temporal. | Fresh connection on each invocation. | |
| 85 | +| **Worker Versioning** | Optional but recommended. | Required. | |
| 86 | + |
| 87 | +## Supported providers |
| 88 | + |
| 89 | +| Provider | Status | |
| 90 | +|---|---| |
| 91 | +| AWS Lambda | Available | |
| 92 | + |
| 93 | +## Next steps |
| 94 | + |
| 95 | +- [Interactive demo](/evaluate/serverless-workers/demo) to explore the configuration and invocation flow. |
| 96 | +- [How Serverless Workers work](/serverless-workers) for a deeper look at the invocation lifecycle, compute providers, and architecture. |
| 97 | +- [Deploy a Serverless Worker](/production-deployment/worker-deployments/serverless-workers) for the end-to-end deployment guide. |
| 98 | +- [Serverless Workers - Go SDK](/develop/go/workers/serverless-workers/aws-lambda) for SDK-specific configuration and defaults. |
0 commit comments