Available Storage Backends
Infinitic supports three storage implementations:- PostgreSQL - Production-ready relational database (recommended)
- Redis - High-performance key-value store
- InMemory - Local development and testing
PostgreSQL Storage
PostgreSQL is the recommended storage backend for production deployments.YAML Configuration
Basic Configuration
Complete Configuration
Builder Pattern
Configuration Options
Connection Settings
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
host | String | Yes | - | PostgreSQL host |
port | Integer | Yes | - | PostgreSQL port |
username | String | Yes | - | Database username |
password | String | No | null | Database password |
database | String | No | infinitic | Database name |
schema | String | No | public | Schema name |
keySetTable | String | No | key_set_storage | Table for key sets |
keyValueTable | String | No | key_value_storage | Table for key-value pairs |
Connection Pool Settings
| Option | Type | Default | Description |
|---|---|---|---|
maximumPoolSize | Integer | 10 | Maximum number of connections in pool |
minimumIdle | Integer | same as max | Minimum idle connections in pool |
idleTimeout | Long | 600000 | Idle timeout in milliseconds (10 minutes) |
connectionTimeout | Long | 30000 | Connection timeout in milliseconds (30 seconds) |
maxLifetime | Long | 1800000 | Maximum connection lifetime in milliseconds (30 minutes) |
Database Setup
Infinitic automatically creates required tables on first use. You can also create them manually:Performance Tuning
High Concurrency
Redis Storage
Redis provides high-performance key-value storage.YAML Configuration
Basic Configuration
Complete Configuration
Builder Pattern
Configuration Options
Connection Settings
| Option | Type | Required | Default | Description |
|---|---|---|---|---|
host | String | Yes | - | Redis host |
port | Integer | Yes | - | Redis port |
username | String | No | null | Redis username (Redis 6+) |
password | String | No | null | Redis password |
database | Integer | No | 0 | Redis database number |
timeout | Integer | No | 2000 | Connection timeout in milliseconds |
ssl | Boolean | No | false | Enable SSL/TLS |
Connection Pool Settings
| Option | Type | Default | Description |
|---|---|---|---|
maxTotal | Integer | 8 | Maximum total connections |
maxIdle | Integer | 8 | Maximum idle connections |
minIdle | Integer | 0 | Minimum idle connections |
maxWaitMillis | Long | -1 | Maximum wait time for connection |
testOnBorrow | Boolean | false | Test connection on borrow |
testOnReturn | Boolean | false | Test connection on return |
testWhileIdle | Boolean | false | Test idle connections |
Redis Cluster
For Redis Cluster deployments, configure multiple hosts:InMemory Storage
InMemory storage is ideal for local development, testing, and single-process applications.YAML Configuration
Programmatic Configuration
Use Cases
Unit Testing
Local Development
Compression
Compression reduces storage size and network bandwidth at the cost of CPU usage.Configuration
Modes
| Mode | Description | Use Case |
|---|---|---|
none | No compression | Small state, CPU-constrained |
gzip | GZIP compression | Large state, network-constrained |
Trade-offs
-
GZIP compression:
- Reduces storage by 60-90%
- Reduces network bandwidth
- Increases CPU usage by 10-20%
- Recommended for most use cases
-
No compression:
- No CPU overhead
- Higher storage costs
- Higher network usage
- Use for very small state objects
Caching
Caching reduces database load and improves performance.Configuration
Options
| Option | Type | Description |
|---|---|---|
maximumSize | Long | Maximum number of cached entries |
expireAfterAccess | Long | Expire entries after access (seconds) |
expireAfterWrite | Long | Expire entries after write (seconds) |
Best Practices
- Enable caching - Significantly reduces database load
- Size appropriately - Balance memory usage vs hit rate
- Tune expiration - Longer = better hit rate, more stale data
- Monitor hit rate - Adjust size if hit rate is low
Cache Sizing
Multiple Storage Backends
You can override the default storage for specific engines:Best Practices
Production Deployments
- Use PostgreSQL or Redis - InMemory is not durable
- Enable compression - Reduces storage and bandwidth
- Configure caching - Improves performance
- Set connection pools - Optimize for workload
- Use connection pooling - Reuse database connections
- Monitor storage size - Track growth and optimize
High Availability
PostgreSQL
Redis
Security
- Use SSL/TLS - Encrypt connections in production
- Rotate credentials - Regular password rotation
- Limit permissions - Use least-privilege access
- Environment variables - Never hardcode credentials
Troubleshooting
Connection Issues
Performance Issues
High Storage Usage
- Enable compression
- Implement workflow cleanup
- Archive old workflow data
- Monitor state size
See Also
- Worker Configuration - Configure workers
- Transport Configuration - Configure message transport