Namespaces
Namespaces provide isolated execution environments within a Temporal cluster. Each namespace has its own workflows, activities, task queues, and configuration, enabling secure multi-tenancy and organizational separation.Namespace Fundamentals
A namespace is the fundamental isolation boundary in Temporal:Isolation
Workflows in one namespace cannot directly interact with workflows in another namespace. Complete data isolation.
Configuration
Each namespace has independent retention, archival, replication, and search attribute settings.
Multi-Tenancy
Different teams, customers, or environments can share a cluster safely using separate namespaces.
Resource Limits
Rate limits, quotas, and visibility can be configured per-namespace.
Namespace Structure
Each namespace contains:Namespace ID vs Name
Namespace ID
Namespace ID
Type: UUID string (e.g.,
"a1b2c3d4-e5f6-7890-abcd-ef1234567890")Characteristics:- Permanent and immutable
- Used internally for all operations
- Workflows/history keyed by namespace ID
- Survives namespace renames
Namespace Name
Namespace Name
Type: String (e.g.,
"my-application", "production", "customer-acme")Characteristics:- User-visible, mutable (can be renamed)
- Used in APIs and SDKs
- Resolved to namespace ID by server
- Must be unique within cluster
Namespace States
Namespaces transition through several states:Registered (Active)
Normal operational state. Workflows can be started, workers can poll, all operations permitted.
Deprecated
Soft-deleted state. New workflows cannot be started, but existing workflows continue and can complete. Used for graceful wind-down.
Namespace Configuration
Each namespace has extensive configuration options:Retention Policy
Archival Configuration
Namespaces can archive workflow histories to long-term storage:History Archival
History Archival
- Amazon S3 (
s3://bucket/prefix) - Google Cloud Storage (
gs://bucket/prefix) - Local filesystem (
file:///path)
Visibility Archival
Visibility Archival
Separate from history archival, archives visibility records (workflow metadata).
Custom Search Attributes
Namespaces can define custom search attributes for workflow search:Namespace Replication
For multi-cluster deployments, namespaces can be replicated:Global Namespaces
Global Namespace Features
Global Namespace Features
Active-Passive Replication: One cluster is active (handles writes), others are passive (replicate).Failover: Can change which cluster is active, enabling disaster recovery.Cross-Cluster Visibility: View workflows from any cluster.Use Cases: Business continuity, disaster recovery, global presence.
Namespace Registry
The server maintains an in-memory cache of all namespaces:Namespace Cache
Cache refresh has eventual consistency. Namespace changes propagate to all server instances within seconds.
Namespace Sharding
While namespaces provide logical isolation, workflows are physically distributed:- Workflows hashed across shards by (Namespace ID, Workflow ID)
- Multiple namespaces per shard - shards not dedicated to namespaces
- Enables scale - even single namespace can use all shards
Namespace Operations
Creating Namespaces
Updating Namespaces
Describing Namespaces
Namespace Best Practices
One Namespace Per Environment
Use separate namespaces for dev, staging, production. Prevents accidental cross-environment issues.
Namespace Per Customer
For SaaS applications, use one namespace per customer for isolation and resource control.
Meaningful Names
Use descriptive names like
myapp-prod, customer-acme, not generic names like ns1.Document Ownership
Use description and metadata fields to track which team owns each namespace.
Anti-Patterns
Namespace Limits and Quotas
Namespaces can have rate limits:- RPS limits: Max requests per second for operations
- Worker limits: Max concurrent pollers per task queue
- Workflow limits: Max concurrent workflows
- Visibility limits: Max list/query rate
Limits configured via dynamic configuration or Temporal Cloud settings. Protects cluster from runaway workloads.
Namespace Security
Namespace-level security controls:Authorization
- API key per namespace (Temporal Cloud)
- mTLS certificates can be scoped to namespaces
- RBAC policies can restrict access to specific namespaces
Audit Logging
- Audit logs track all namespace operations
- Who created/modified namespace
- What changed in configuration
Namespace Observability
Key metrics per namespace:- Workflow Start Rate: Workflows started per second
- Workflow Completion Rate: Workflows completed per second
- Open Workflows: Currently executing workflows
- Task Queue Backlog: Pending tasks across all task queues
- Error Rates: Failed workflows, activities, tasks
Default Namespace
Each cluster has adefault namespace:
- Created automatically on cluster bootstrap
- Used if no namespace specified in SDK clients (for development)
- Not special otherwise - same capabilities as any namespace
Related Concepts
- Task Queues - Scoped within namespaces
- Workflows - Belong to a namespace
- Workers - Poll specific namespace’s task queues