Skip to content

Performance Issue with Redisson Lock Watchdog Mechanism When Handling a Large Number of Locks #6303

Closed

Description

@wenbochang888

Hello,

I have encountered a performance issue while using Redisson. According to the documentation, Redisson uses a single background thread to periodically scan and renew all held locks. By default, this scan interval is internalLockLeaseTime / 3. However, when the number of locks in the EXPIRATION_RENEWAL_MAP is very large, scanning and renewing all locks with a single thread can become very time-consuming.

The specific issues are as follows:

  1. When the number of locks in the EXPIRATION_RENEWAL_MAP is very large, scanning and renewing all locks with a single thread can lead to performance bottlenecks.
  2. If the scanning and renewal operations take too long, some locks may expire before they can be renewed, leading to unintended lock releases.

I would like to know if Redisson has any built-in mechanisms to address this situation? If not, are there any plans to introduce sharding or parallel processing mechanisms in future versions to improve the efficiency of lock renewal operations?

Thank you!

Activity

  1. mrniko commented on Jan 8, 2025

    @mrniko
    Member

    Expiration tasks are executed in parallel already. Expiration process is executed by a single thread in non blocking way, which might not cause any issue. I found that multiple locks can be renewed at once in a batch, which can improve performance.

  2. modified the milestones: 3.42.1, 3.42.0, 3.44.0 on Jan 14, 2025
  3. mrniko commented on Jan 15, 2025

    @mrniko
    Member

    It's done. You can use the lockWatchdogBatchSize setting to control amount of locks renewed per watchdog task execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions