limitador
limitador copied to clipboard
Batch update
This PR replaces the way Limitador, configured to use Redis Cached storage, updates (flushes the in memory cache) to Redis. Instead of updating counters one by one, Limitador sends the batch of counters to update to Redis.
TODO
- [x] Batch updating to redis
- [x] Fix rebase conficts
- [ ] ~~Limit batch update counters to redis (?)~~ for the near future
- [x] Get back the values from redis...
- [x] and update cache (?)
- [ ] Fix test, get rid of time.wait
- [ ] Test that the cached counters are updated
Notes
- In a setup where the Redis instance is (physically) far from the Limitador instance, it could happen that we encounter network partition error when the response timeout is exceeded:
EC Frankfurt – Limitador Sao Paulo
Executing limitador: $ limitador-server /bench/limits.yaml redis_cached redis://test-limitador-redis.jeigrh.ng.0001.euc1.cache.amazonaws.com:6379
Limitador Server v1.4.0-dev (b7e4d87c) [] release
Executing limitador-driver: $ limitador-driver rpc://127.0.0.1:8081 1m
Hitting Limitador at rpc://127.0.0.1:8081 for a total duration of 1 minutes
Current: hits: 12195, mean: 0.081ms, p50: 0.062ms, p90: 0.073ms, p99: 0.092ms, p999: 0.106ms, max: 201.727ms
Current: hits: 15461, mean: 0.064ms, p50: 0.062ms, p90: 0.074ms, p99: 0.091ms, p999: 0.112ms, max: 0.335ms
Current: hits: 15367, mean: 0.064ms, p50: 0.062ms, p90: 0.074ms, p99: 0.092ms, p999: 0.112ms, max: 0.399ms
2024-04-03T14:58:00.941325Z ERROR limitador::storage::redis::redis_cached: Partition to Redis detected!
Current: hits: 6912, mean: 0.144ms, p50: 0.062ms, p90: 0.074ms, p99: 0.092ms, p999: 0.137ms, max: 352.255ms
Current: hits: 15414, mean: 0.064ms, p50: 0.062ms, p90: 0.074ms, p99: 0.091ms, p999: 0.107ms, max: 0.363ms
2024-04-03T14:58:02.941271Z ERROR limitador::storage::redis::redis_cached: Partition to Redis detected!
you should rebase your branch to get some fixes in redis_cached