Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Replace individual DEL commands with batched deletions - Use SCAN with COUNT parameter for better performance - Reduce network round-trips between application and Redis - Improve memory efficiency by processing keys in batches This change enhances the performance of the delete_locks method, especially when dealing with a large number of keys. The new implementation uses the SCAN command with a COUNT parameter to retrieve keys in batches, reducing memory usage. It then deletes these keys in batches, significantly reducing the number of network round-trips to the Redis server. While Lua scripting could potentially offer even greater performance benefits, we opted not to use it in this iteration. This decision maintains better readability and easier maintenance of the Ruby code, avoids potential issues with script caching across multiple Redis servers, and keeps the implementation consistent with other parts of the codebase. The current optimization strikes a balance between performance improvement and code simplicity.
- Loading branch information