RRateLimit may lead to the redis cpu may increase #5935
Unanswered
peanut0713
asked this question in
Q&A
Replies: 1 comment
-
3.16.8 script version has fixes of multiple bugs related to RRateLimiter object. So these changes are mandatory. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We upgraded redisson from 3.12.5 to 3.16.8 the night before last,redis' cpu began to rise at 10 p.m., indirectly causing the system to crash,Unable to find the root cause, we found the commands in redis monitoring and found that all of them were rateLimit commands, so the code blocks that used RRateLimit were urgently removed and the system recovered slowly,Since you don't know much about redis' rateLimit script, try consulting for possible reasons
Use posture:
![cb75dfa9-944e-4ebb-aadb-cd21f8421b52](https://private-user-images.githubusercontent.com/38377645/337099430-fadc1543-3cca-4aa3-917d-6b668d2ea020.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMDk1MTIsIm5iZiI6MTcxOTEwOTIxMiwicGF0aCI6Ii8zODM3NzY0NS8zMzcwOTk0MzAtZmFkYzE1NDMtM2NjYS00YWEzLTkxN2QtNmI2NjhkMmVhMDIwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDAyMjAxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUwOTBmZjQ0MjhmZGFmNjdjOTljYzZmYjU4NGE4NTRiYzQ4YTk3MTBkMDM1ZDlkMzkyNDI4MzdkZWU3ZDVjNmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.U78ImQb1ILTI7q6CZgMStiK3GP-zLRnIwV7FDF0TYIA)
![8be7ef3e-5977-45eb-8ea0-c5510fa6240c](https://private-user-images.githubusercontent.com/38377645/337101612-3556f366-4526-4f51-bf17-995388ee96ce.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMDk1MTIsIm5iZiI6MTcxOTEwOTIxMiwicGF0aCI6Ii8zODM3NzY0NS8zMzcxMDE2MTItMzU1NmYzNjYtNDUyNi00ZjUxLWJmMTctOTk1Mzg4ZWU5NmNlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDAyMjAxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk4YTFjMTczZDJjNDg5MTJiNzM0MmI1YmZkMmQ4YTBjNDk4NzNmNmQ2MGIzZTg4YmIzMDBlOTdiODM2Nzk3ZTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.sThIjXAhZZwihJw4rtqu6ZVyUhRaykje7CoL8dNlask)
We can know that the script of RRateLimit in version 3.16.8 controls the frequency of request passing more carefully, but we can't understand the logic of the script, and wonder whether it will cause some unknown compatibility problems. Please help to discuss the root causes that may lead to the problems
3.12.5
"local rate = redis.call('hget', KEYS[1], 'rate');"
+ "local interval = redis.call('hget', KEYS[1], 'interval');"
+ "local type = redis.call('hget', KEYS[1], 'type');"
+ "assert(rate ~= false and interval ~= false and type ~= false, 'RateLimiter is not initialized')"
3.16.8
"local rate = redis.call('hget', KEYS[1], 'rate');"
+ "local interval = redis.call('hget', KEYS[1], 'interval');"
+ "local type = redis.call('hget', KEYS[1], 'type');"
+ "assert(rate ~= false and interval ~= false and type ~= false, 'RateLimiter is not initialized')"
Beta Was this translation helpful? Give feedback.
All reactions