Distributed locking environment variables
This reference documents environment variables that configure distributed locking behavior in the Application SDK. Distributed locking uses Redis to coordinate resource access across multiple workflow instances running on different nodes.
Locking control
These variables control whether the distributed locking system is active and how it retries lock acquisition when slots are occupied.
IS_LOCKING_DISABLEDbooleanRequired
IS_LOCKING_DISABLEDbooleanControls whether the distributed locking system is active. When true, activities with @needs_lock execute without coordination. When false, the system acquires locks before activity execution.
export IS_LOCKING_DISABLED=falseexport IS_LOCKING_DISABLED=true
LOCK_RETRY_INTERVALintegerOptional
LOCK_RETRY_INTERVALintegerSeconds to wait between lock acquisition retry attempts. When all slots are occupied, the system waits this duration before randomly selecting another slot and retrying.
export LOCK_RETRY_INTERVAL=5Redis connection
The Application SDK uses Redis to store and manage distributed locks. Configure your Redis connection using either standalone mode (single Redis instance) or Sentinel mode (high-availability cluster with automatic failover).
- Standalone mode
- Sentinel mode
Connect directly to a single Redis instance. Use this mode for development, testing, and small-scale deployments.
REDIS_HOSTstringRequired
REDIS_HOSTstringRedis server hostname or IP address.
export REDIS_HOST=localhostexport REDIS_HOST=redis.example.com
REDIS_PORTintegerOptional
REDIS_PORTintegerRedis server port number.
export REDIS_PORT=6379REDIS_PASSWORDstringOptional
REDIS_PASSWORDstringAuthentication password for Redis connection. The SDK sends this password during the Redis AUTH command.
export REDIS_PASSWORD='your_password'REDIS_DBintegerOptional
REDIS_DBintegerRedis database number for storing distributed lock keys. Redis supports databases 0-15 by default, providing logical keyspace separation.
export REDIS_DB=0Connect to a Redis Sentinel cluster for automatic failover and high availability. Sentinel monitors Redis instances and promotes a replica to master if the current master fails.
REDIS_SENTINEL_HOSTSstringRequired
REDIS_SENTINEL_HOSTSstringComma-separated list of Sentinel host:port pairs. The system queries these Sentinel instances to discover the current Redis master node.
export REDIS_SENTINEL_HOSTS=sentinel1:26379,sentinel2:26379,sentinel3:26379REDIS_SENTINEL_SERVICEstringRequired
REDIS_SENTINEL_SERVICEstringSentinel service name that identifies the Redis master instance. This matches the master name in your Sentinel configuration's monitor directive.
export REDIS_SENTINEL_SERVICE=mymasterREDIS_PASSWORDstringOptional
REDIS_PASSWORDstringAuthentication password for Redis connection. The SDK sends this password during the Redis AUTH command.
export REDIS_PASSWORD='your_password'REDIS_DBintegerOptional
REDIS_DBintegerRedis database number for storing distributed lock keys. Redis supports databases 0-15 by default, providing logical keyspace separation.
export REDIS_DB=0See also
- Configure distributed locking: Step-by-step configuration guide
- Distributed locking: Understand how distributed locking works
- @needs_lock decorator: Decorator parameters and usage patterns
- Troubleshoot distributed locking: Common configuration issues