distributed-locking-concurrency
Installation
SKILL.md
Distributed Locking & Concurrency
This skill prevents data corruption and race conditions when multiple server instances try to modify the same resource simultaneously.
Instructions
- Use distributed lock managers like Redis (Redlock) or ZooKeeper.
- Implement 'Leasing' to ensure locks are released if a process crashes.
- Use Optimistic Concurrency Control (OCC) with version numbers or timestamps.
- Design 'Idempotent' operations to safely retry failed requests.
- Audit code for shared-state bottlenecks that limit horizontal scaling.
Examples
- "Prevent two users from booking the same seat using a Redis distributed lock."
- "Make this 'Increment Balance' function idempotent for safe retries."