Joke Collection Website - Public benefit messages - (9) 9) How does 9)9)Redis restrict the sending of short messages?
(9) 9) How does 9)9)Redis restrict the sending of short messages?
Summary: 1, window, 2 token bucket, redis+lua 3 funnel.
1. Fixed window: string is saved, IP is the key, and the value is self-increasing, which is limited to > 100. Set the timeout 1 minute, and the key will disappear after 1 minute.
Good performance, simple implementation and low memory consumption.
Inaccurate: the first request arrived in 0s, the remaining 99 in 60s, 6 100 requests came 199 from 60-6 100.
2. Sliding window: IP is key, and value =list (time stamp of each visit). Every time you visit the query list, compare the first 100 with the current time stamp.
Incorrect time control, poor performance, relatively complex implementation and large memory consumption.
Token bucket: In addition to limiting the average transmission rate, it also allows burst traffic.
Funnel: Forcibly limiting the transmission rate
RateLimit current limit? 、redis+Lua:blogs.com/orangesea/articles/ 1 1299557.html
Funnel? /s/3d_USEzLf-eLSBj_qS9jng
- Previous article:Paying New Year greetings to leaders is suitable for leaders.
- Next article:How to check the express number of SF Express?
- Related articles
- The official version of ios 14.5 is finally here. What are the practical new features?
- Can mobile banking open SMS service by itself?
- How to get rid of the process of bail pending trial
- Huawei's new mobile phone can't receive SMS, but it can send it. Just make a phone call and all the text messages are received?
- There is no available channel for sending text messages in Friends Space
- How to turn off the traffic of the primary and secondary cards?
- There are flashes and black bars on the screen of iphone6.
- I received a remittance for no reason.
- Please be kind to my words in November: May everything be perfect
- Wechat blessing, why hasn't the other party replied?