Overview
Archival supports two types of data:- History Archival: Stores complete workflow event histories
- Visibility Archival: Stores workflow metadata for querying
Supported Storage Backends
File Storage
Local or network filesystem storage. Use Cases: Development, testing, NFS-backed storage Configuration:Amazon S3
Scalable cloud object storage. Use Cases: Production, large-scale deployments, cloud environments Configuration:- Environment variables (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY) - IAM instance profile
- AWS credentials file
- ECS task role
Google Cloud Storage
Google Cloud object storage. Use Cases: GCP deployments, multi-cloud setups Configuration:credentialsPathin configGOOGLE_APPLICATION_CREDENTIALSenvironment variable- Google default credentials
Setup and Configuration
Global Configuration
Enable archival at the cluster level (config.yaml):
Domain Configuration
Enable archival per domain:Worker Configuration
Archival workers automatically start with the history service. Configure worker pool size:Storage Structure
S3 Storage Layout
File Storage Layout
Querying Archived Data
Viewing Archived Workflow History
Searching Archived Visibility
S3 Visibility Query Syntax
Supported columns:WorkflowID(String) - Required or WorkflowTypeNameWorkflowTypeName(String) - Required or WorkflowIDStartTime(Date)CloseTime(Date)SearchPrecision(String: Day, Hour, Minute, Second)
- Only
=operator supported - Date searches require
SearchPrecision - UTC timezone for all timestamps
Google Cloud Storage Query Syntax
Same as S3, with additional considerations:- StartTime and CloseTime are mutually exclusive
- Result order not guaranteed with pagination
Archival Process
History Archival Flow
- Workflow completes
- Retention period expires
- History scavenger identifies candidate
- Archival worker archives to storage
- History deleted from primary database
- Archive marker persisted
Visibility Archival Flow
- Workflow closes
- Visibility archival triggered immediately
- Visibility record written to archive storage
- After retention expires, deleted from primary database
Archival Retry
Failed archival operations are retried:- Non-retriable errors: Permanent failure, workflow not archived
- Retriable errors: Exponential backoff, max attempts
- Progress tracking: Resume from last successful point
Local Development with LocalStack
Test S3 archival locally:Implementing Custom Archivers
History Archiver Interface
Visibility Archiver Interface
Implementation Steps
- Create package under
common/archiver/ - Implement
HistoryArchiverand/orVisibilityArchiver - Update
provider/provider.goto register archiver - Add configuration struct to
common/config.go - Write unit tests
- Document URI format and query syntax
filestore, s3store, or gcloud for examples.
Best Practices
Storage Management
- Bucket Organization: Use separate buckets or prefixes per environment
- Lifecycle Policies: Configure object expiration for cost management
- Access Control: Restrict bucket access with IAM policies
- Encryption: Enable server-side encryption (SSE-S3 or SSE-KMS)
Performance
- Concurrency: Tune archival worker concurrency for throughput
- Retention Period: Balance storage costs vs. archival load
- Query Optimization: Use specific filters to reduce scan scope
- Batch Retrieval: Retrieve multiple workflows in parallel
Monitoring
- Archival Rate: Monitor workflows archived per second
- Archival Latency: Track time from workflow completion to archive
- Failure Rate: Alert on archival failures
- Storage Growth: Monitor bucket size and object count
Disaster Recovery
- Replication: Enable cross-region replication for archives
- Backup: Regularly backup archival storage
- Retention: Align archival retention with compliance requirements
- Testing: Periodically test archival retrieval
Troubleshooting
Archival Not Working
Problem: Workflows not being archived Solution:Cannot Read Archived Workflows
Problem: Archived workflow retrieval fails Solution:- Verify
enableRead: truein config - Check storage permissions (GetObject)
- Validate URI format
- Ensure workflow was actually archived
- Check for storage backend errors
High Archival Latency
Problem: Slow archival processing Solution:- Increase
numArchiverConcurrency - Scale history service horizontally
- Optimize storage backend (e.g., S3 request rate limits)
- Review workflow history size (large histories are slower)
Next Steps
- Configure Dynamic Config for archival tuning
- Set up Canary Testing for archival validation
- Monitor with Web UI
- Learn about Isolation Groups for multi-tenancy