Skip to main content

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

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
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:
1

Registered (Active)

Normal operational state. Workflows can be started, workers can poll, all operations permitted.
2

Deprecated

Soft-deleted state. New workflows cannot be started, but existing workflows continue and can complete. Used for graceful wind-down.
3

Deleted

Hard-deleted state. Namespace cannot be used. Data retained per retention policy, then cleaned up.

Namespace Configuration

Each namespace has extensive configuration options:

Retention Policy

After retention period expires, workflow history is deleted. Choose retention based on compliance, debugging needs, and storage costs.

Archival Configuration

Namespaces can archive workflow histories to long-term storage:
Supported Backends:
  • Amazon S3 (s3://bucket/prefix)
  • Google Cloud Storage (gs://bucket/prefix)
  • Local filesystem (file:///path)
Use Cases: Compliance, audit trails, long-term debugging
Separate from history archival, archives visibility records (workflow metadata).

Custom Search Attributes

Namespaces can define custom search attributes for workflow search:
Use search attributes to make workflows searchable by business-relevant fields like customer ID, order number, or status.

Namespace Replication

For multi-cluster deployments, namespaces can be replicated:

Global Namespaces

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

1

Load from database

On startup, all namespace metadata loaded from persistence
2

Cache in memory

Namespace objects cached by ID and name for fast lookup
3

Watch for changes

Background process polls for namespace updates
4

Refresh cache

When namespace created/updated, cache entry refreshed
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

Don’t create namespaces per workflow type: Namespaces are heavyweight. Use task queues for routing different workflow types.
Don’t over-provision namespaces: Each namespace adds overhead. Prefer fewer namespaces with task queue routing.

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 a default namespace:
  • Created automatically on cluster bootstrap
  • Used if no namespace specified in SDK clients (for development)
  • Not special otherwise - same capabilities as any namespace
Don’t use default namespace for production. Create dedicated namespaces with appropriate configuration.