Skip to content

Improve the performance of obtaining write connections through double-check locks. #3229

@Chenrujie-85

Description

@Chenrujie-85

Feature Request

Is your feature request related to a problem? Please describe

In the production environment, when the number of access requests sent by Lettuce as the Redis client reaches tens of thousands of qps, the latency of many access requests is long.

Describe the solution you'd like

When the getWriteConnection command is used to obtain a write connection in the PooledClusterConnectionProvider class, the system locks the connection and then checks whether the value of weiters[slot] is empty. When most elements in writers are assigned values, the performance is affected.

Describe alternatives you've considered

The code in getWriteConnection is changed to double-check lock. The system checks whether weiters[slot] is empty. If yes, the system locks it. Then, the system checks whether weiters[slot] is empty. If yes, the system checks whether weiters[slot] is empty. initializes weiters[slot]. Otherwise, returns weiters[slot].

Teachability, Documentation, Adoption, Migration Strategy

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions