Files
new-api/middleware
霍雨佳 eb75ff232f Refactor: Optimize the request rate limiting for ModelRequestRateLimitCount.
Reason: The original steps 1 and 3 in the redisRateLimitHandler method were not atomic, leading to poor precision under high concurrent requests. For example, with a rate limit set to 60, sending 200 concurrent requests would result in none being blocked, whereas theoretically around 140 should be intercepted.
Solution: I chose not to merge steps 1 and 3 into a single Lua script because a single atomic operation involving read, write, and delete operations could suffer from performance issues under high concurrency. Instead, I implemented a token bucket algorithm to optimize this, reducing the atomic operation to just read and write steps while significantly decreasing the memory footprint.
2025-04-16 10:33:43 +08:00
..
2025-03-12 21:31:46 +08:00
2023-05-22 00:54:53 +08:00
2023-06-20 22:04:01 +08:00
2025-03-29 14:39:39 +08:00
2024-12-04 23:53:02 +08:00
2024-01-07 22:25:03 +08:00
2023-04-22 21:14:09 +08:00
2024-07-27 17:55:36 +08:00