Skip to content

Commit 3b75b7c

Browse files
Consolidate namespace best practices guidance (#4348)
Co-authored-by: Brian MacDonald <brian.macdonald@temporal.io>
1 parent 347e92d commit 3b75b7c

4 files changed

Lines changed: 116 additions & 77 deletions

File tree

docs/best-practices/managing-aps-limits.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ An APS limit is set per Namespace, so multiple use cases with multiple traffic p
175175

176176
#### How to Mitigate
177177

178-
Plan for a set of Namespaces (one per environment) per use case. See [Managing a Namespace](/best-practices/managing-namespace) for more details.
178+
Plan for a set of Namespaces (one per environment) per use case. This gives each use case its own APS envelope and
179+
reduces the blast radius when one workload spikes or misbehaves.
180+
181+
If you are deciding whether to split by use case, service, or domain, see
182+
[Managing a Namespace](/best-practices/managing-namespace) for a topology decision framework.
179183

180184
## Provisioned Capacity and TRUs
181185

docs/best-practices/managing-namespace.mdx

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ For reference documentation, see:
2727
A [Namespace](/namespaces) is a unit of isolation within the Temporal Platform.
2828
It ensures that Workflow Executions, Task Queues, and resources are logically separated, preventing conflicts and enabling safe multi-tenant usage.
2929

30+
Use this page to decide how many Namespaces you need and where to draw boundaries between environments, services,
31+
domains, and tenants. For Cloud-specific namespace mechanics such as creation, tagging, and gRPC endpoints, see
32+
[Namespaces (Temporal Cloud)](/cloud/namespaces).
33+
34+
Related guidance:
35+
- [Managing Temporal Cloud access control](/best-practices/cloud-access-control)
36+
- [Multi-tenant application patterns](/production-deployment/multi-tenant-patterns)
37+
- [Managing Actions per Second (APS) limits in Temporal Cloud](/best-practices/managing-aps-limits)
38+
3039
## Naming Conventions
3140

3241
### Use lowercase and hyphens
@@ -66,30 +75,72 @@ If you need to include region, use short codes (e.g., `aps1`, `use1`).
6675

6776
## Organizational Patterns
6877

78+
### Choose your Namespace boundary intentionally
79+
80+
Start with the smallest number of Namespaces that gives you clear ownership and safe isolation.
81+
In Temporal Cloud, a Namespace boundary affects:
82+
83+
- [APS limits](/cloud/limits#actions-per-second) and rate limiting
84+
- access control and credential scope
85+
- blast radius for misconfigured or overloaded Workers
86+
- observability boundaries for dashboards and alerts
87+
- operational overhead for provisioning, tagging, and lifecycle management
88+
89+
Use the following decision table as a starting point:
90+
91+
| If you need... | Prefer... | Why |
92+
|---|---|---|
93+
| Basic environment isolation for a single application or use case | Namespace per use case and environment | This is the simplest pattern and works well for most initial deployments |
94+
| Separate operational ownership for services within the same use case | Namespace per use case, service, and environment | This isolates credentials, limits, and operational changes per service |
95+
| Stronger boundaries across teams, domains, or business capabilities | Namespace per use case, domain, and environment | This reduces blast radius and lets teams own their own Namespace contracts |
96+
| Tenant-specific credentials, rate limits, or compliance boundaries | Namespace per tenant | Use this only for a small number of high-value tenants because of the operational overhead |
97+
98+
As a default, start with one Namespace per use case and environment. Split later when APS pressure, security
99+
requirements, ownership boundaries, or troubleshooting needs justify the extra operational cost.
100+
69101
### Pattern 1: Namespace per use case and environment
70102

71103
For simple configurations without multiple services or team boundaries.
72104

73-
**Naming convention**: `<use-case>_<environment>`
105+
**Naming convention**: `<use-case>-<environment>`
106+
107+
**Example**: `payments-prd`, `orders-dev`
74108

75-
**Example**: `payments_prod`, `orders_dev`
109+
Choose this pattern when:
110+
111+
- one team owns the use case
112+
- environments need clean separation
113+
- workload volume and criticality do not yet require further isolation
76114

77115
### Pattern 2: Namespace per use case, service, and environment
78116

79117
When multiple services that are part of the same use case communicate externally to Temporal via API (HTTP/gRPC).
80118

81-
**Naming convention**: `<use-case>_<service>_<environment>`
119+
**Naming convention**: `<use-case>-<service>-<environment>`
120+
121+
**Example**: `payments-gateway-prd`, `payments-processor-prd`
122+
123+
Choose this pattern when:
82124

83-
**Example**: `payments_gateway_prod`, `payments_processor_prod`
125+
- services need separate credentials or access policies
126+
- one service can exhaust APS or operational limits independently of the others
127+
- teams want separate ownership of deployment, alerting, or on-call boundaries
84128

85129
### Pattern 3: Namespace per use case, domain, and environment
86130

87131
When multiple services need to communicate with each other, use [Temporal Nexus](/nexus) to connect Workflows across Namespace boundaries.
88132
This provides better security, fault isolation, and modularity than sharing a Namespace.
89133

90-
**Naming convention**: `<use-case>_<domain>_<environment>`
134+
**Naming convention**: `<use-case>-<domain>-<environment>`
91135

92-
**Example**: `payments_checkout_prod`, `payments_refunds_prod`
136+
**Example**: `payments-checkout-prd`, `payments-refunds-prd`
137+
138+
Choose this pattern when:
139+
140+
- multiple teams or domains need independent release cadence and ownership
141+
- failures in one domain should not affect the others
142+
- you want a stronger permission boundary between capabilities
143+
- you plan to expose cross-Namespace contracts through Nexus
93144

94145
For systems without Nexus, services can communicate via [Signals](/sending-messages#sending-signals) or [Child Workflows](/child-workflows) within the same Namespace.
95146

@@ -98,6 +149,33 @@ When multiple teams share a Namespace, prefix each Workflow ID with a service-sp
98149
Task Queue names must also be unique within the Namespace.
99150
:::
100151

152+
### Pattern 4: Namespace per tenant
153+
154+
Use a separate [Namespace](/namespaces) per tenant only when each tenant needs a true isolation boundary.
155+
156+
This is usually appropriate only for a small number of high-value tenants that require:
157+
158+
- dedicated credentials and access control
159+
- tenant-specific rate limits or capacity decisions
160+
- strict compliance or data-isolation boundaries
161+
- independent debugging, alerting, and operational ownership
162+
163+
For most SaaS use cases, a shared Namespace with per-tenant [Task Queues](/task-queue) is simpler and more scalable.
164+
See [Multi-tenant application patterns](/production-deployment/multi-tenant-patterns) for those designs.
165+
166+
### What should cause you to split a Namespace later?
167+
168+
Revisit your topology when one or more of the following becomes true:
169+
170+
- one workload is consuming enough APS that it regularly threatens others in the same Namespace
171+
- one team needs tighter access controls or dedicated credentials
172+
- production troubleshooting requires clearer dashboards, alerts, or ownership boundaries
173+
- one application or domain is business-critical enough that its blast radius must be reduced
174+
- a tenant or regulated workload needs stronger separation than Task Queue isolation can provide
175+
176+
Splitting a Namespace increases safety, but it also adds overhead for provisioning, tagging, credentials, and cross-Namespace coordination.
177+
Use [Nexus](/nexus) where possible instead of sharing Temporal primitives across team or domain boundaries.
178+
101179
## Production Safeguards
102180

103181
### Use an Authorizer (open source only) {#authorizer}

docs/cloud/get-started/namespaces.mdx

Lines changed: 4 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -236,77 +236,11 @@ See the [`tcld` namespace create](/cloud/tcld/namespace/#create) command referen
236236

237237
## What are some Namespace best practices? {#best-practices}
238238

239-
This section provides general guidance for organizing [Namespaces](/namespaces) across use cases, services,
240-
applications, or domains. Temporal Cloud provides Namespace–as-a-service, so the Namespace is the endpoint. Customers
241-
should consider not only a Namespace naming convention but also how to group or isolate workloads using the Namespace as
242-
a boundary.
239+
For guidance on how many Namespaces to create, how to split workloads across services or domains, and when to isolate
240+
tenants or teams, see [Namespace best practices](/best-practices/managing-namespace).
243241

244-
Each team can have their own Namespace for improved modularity, security, debugging, and fault isolation. Namespaces
245-
contain the blast radius of misbehaving Workers that may exhaust rate limits. Sensitive Workflow state (PCI data) can be
246-
secured with per-Namespace permissions and encrypted with a separate encryption key.
247-
248-
Temporal Applications in different Namespaces may be connected with [Nexus](/cloud/nexus) by exposing a clean service
249-
contract for others to use with built-in [Nexus access controls](/cloud/nexus/security). Nexus supports cross-team,
250-
cross-domain, multi-region, and multi-cloud use cases.
251-
252-
### Constraints and limitations
253-
254-
Before considering an appropriate Namespace configuration, you should be aware of the constraints
255-
listed on the [Temporal Cloud Limits](/cloud/limits) page.
256-
257-
For advice on managing Namespaces within limits, see the [Namespace Best Practices](/best-practices/managing-namespace) page.
258-
259-
### General guidance
260-
261-
Namespace configuration requires some consideration. Following are some general guidelines to consider.
262-
263-
- Namespaces are usually defined per use case. A use case can encompass a broad range of Workflow types and a nearly
264-
unlimited scale of concurrent [Workflow Executions](/workflow-execution).
265-
- Namespaces can be split along additional boundaries such as service, application, domain or even sub-domain.
266-
- Namespaces should be used to reduce the "blast radius" for mission-critical applications.
267-
- Environments such as production and development usually have requirements for isolation. We recommend that each
268-
environment has its own Namespace.
269-
- Namespaces should be used to reduce the "blast radius" for mission-critical applications.
270-
- Use [Nexus](/nexus) to communicate across team, domain, and Namespace boundaries with a clean service contract instead of sharing Temporal primitives directly.
271-
Nexus enables each team to have their own Namespace for improved security, troubleshooting, and fault isolation while sharing capabilities through Nexus Endpoints.
272-
273-
### Examples
274-
275-
Following are some ideas about how to organize Namespaces.
276-
277-
#### Example 1: Namespace per use case and environment
278-
279-
We recommend using one Namespace for each use case and environment combination for simple configurations in which
280-
multiple services and team or domain boundaries don't exist.
281-
282-
Sample naming convention:
283-
284-
<pre>&lt;use-case>_&lt;environment></pre>
285-
286-
#### Example 2: Namespace per use case, service, and environment
287-
288-
We recommend using one Namespace for each use case, service, and environment combination when multiple services that are
289-
part of same use case communicate externally to Temporal via API (HTTP/gRPC).
290-
291-
Sample naming convention:
292-
293-
<pre>&lt;use-case>_&lt;service>_&lt;environment></pre>
294-
295-
#### Example 3: Namespace per use case, domain, and environment
296-
297-
We recommend using one namespace per use case, domain, and environment combination when multiple services that are part
298-
of the same use case need to communicate with each another via [Signals](/sending-messages#sending-signals) or by
299-
starting [Child Workflows](/child-workflows). In this case, though, you must be mindful about Workflow Id uniqueness by
300-
prefixing each Workflow Id with a service-specific string. The name of each Task Queue must also be unique. If multiple
301-
teams are involved, the domain could also represent a team boundary.
302-
303-
Sample naming convention:
304-
305-
<pre>&lt;use-case>_&lt;domain>_&lt;environment></pre>
306-
307-
Sample workflowId convention:
308-
309-
<pre>&lt;service-string>_&lt;workflow-id></pre>
242+
This page focuses on Temporal Cloud namespace mechanics such as naming rules, provisioning, authentication, tagging, and
243+
accessing Namespace endpoints.
310244

311245
## How to access a Namespace in Temporal Cloud {#access-namespaces}
312246

docs/production-deployment/multi-tenant-patterns.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Many SaaS providers and large enterprise platform teams use a single Temporal [N
2323

2424
This guide covers architectural patterns, design considerations, and practical examples for building multi-tenant applications with Temporal.
2525

26+
For related guidance on where to draw Namespace boundaries and how to scope credentials and permissions, see
27+
[Namespace best practices](/best-practices/managing-namespace) and
28+
[Managing Temporal Cloud access control](/best-practices/cloud-access-control).
29+
2630
## Architectural principles
2731

2832
When designing a multi-tenant Temporal application, follow these principles:
@@ -120,6 +124,11 @@ Only practical for a smaller number of high-value tenants due to operational ove
120124
- Requires a new [Worker](/workers) pool deployment for each customer (minimum 2 per Namespace for high availability)
121125
- Not cost-effective at scale
122126

127+
This pattern is usually chosen when tenant boundaries also need to be credential boundaries. For example, each tenant may
128+
need its own service accounts, API keys, dashboards, or rate limits. If that is your primary driver, review
129+
[Managing Temporal Cloud access control](/best-practices/cloud-access-control) together with
130+
[Namespace best practices](/best-practices/managing-namespace) before committing to Namespace-per-tenant isolation.
131+
123132
<RelatedReadContainer>
124133
<RelatedReadItem path="/evaluate/development-production-features/multi-tenancy#namespace-isolation" text="Namespace Isolation in Temporal Cloud" archetype="cloud-guide" />
125134
</RelatedReadContainer>
@@ -272,6 +281,20 @@ While testing, also pay attention to your [metrics capacity and cardinality](/cl
272281

273282
## Best practices
274283

284+
### How tenant isolation affects Namespace and access design
285+
286+
Your multi-tenant architecture also determines how much isolation you get from Namespaces and access controls:
287+
288+
- **Shared Namespace with per-tenant Task Queues**: Best for scale and operational simplicity, but tenant isolation is
289+
mostly enforced by your application and worker routing logic rather than by Temporal credentials.
290+
- **Separate Namespaces for domains or services**: Useful when teams need separate credentials, dashboards, APS
291+
envelopes, or on-call boundaries.
292+
- **Namespace per tenant**: Strongest isolation, but highest provisioning and credential-management overhead.
293+
294+
If tenants, teams, or regulated workloads need different credentials or RBAC boundaries, decide that together with your
295+
Namespace topology. See [Namespace best practices](/best-practices/managing-namespace) and
296+
[Managing Temporal Cloud access control](/best-practices/cloud-access-control).
297+
275298
### Monitoring
276299

277300
Track these [metrics](/references/sdk-metrics) per tenant:

0 commit comments

Comments
 (0)