steve0511 / resty-redis-cluster

Openresty lua client for redis cluster.
Apache License 2.0
376 stars 134 forks source link

Add refresh_slots method with lock to fetch slots to avoid cluster sl… #81

Closed WingsGuo8581 closed 3 years ago

WingsGuo8581 commented 3 years ago

In our project, the redis cluster consists of 32 masters and 32 slaves. resty-redis-cluster runs well most of the time. However, when there is failover and with high QPS, the fetch_slots method without lock will make the redis cluster crashed because of the high CPU cost of "cluster slots". Therefore, we add the refresh_slots method with lock to fix it and test in our production environment. We hope it will help other engineers if they encounter our situation. Thanks for your time!

toredash commented 3 years ago

could you also update the documentation to include that you need a new lua_shared_dict ? In this part: https://github.com/steve0511/resty-redis-cluster/blob/master/README.md#installation

Code looks good, thanks

WingsGuo8581 commented 3 years ago

could you also update the documentation to include that you need a new lua_shared_dict ? In this part: https://github.com/steve0511/resty-redis-cluster/blob/master/README.md#installation

Code looks good, thanks

Hi Tore! Thanks for your suggestion. Already updated the md. Pls check when u r available.

steve0511 commented 3 years ago

thanks for contributing.

leonelquinteros commented 3 years ago

Hi @steve0511

I'm trying to update this rock in my code so I can test this patch/fix. It seems it fix an issue we have under heavy load that matches the behaviour described here.

Would it be possible to create a release tag to include this (and other latest changes) after 1.02-4 release?

Thanks in advance.

steve0511 commented 3 years ago

Hi @steve0511

I'm trying to update this rock in my code so I can test this patch/fix. It seems it fix an issue we have under heavy load that matches the behaviour described here.

Would it be possible to create a release tag to include this (and other latest changes) after 1.02-4 release?

Thanks in advance.

ok, create 1.03 based on latest.