limitador
limitador copied to clipboard
Multi thread check & update
This PR is yet another step closer to proper multi thread Limitador.
However, the changes introduced makes de check_and_update "racy", since different requests will check and update at the same time:
- It could/will happen that one thread will load a counter value at the "check" phase and at the same time, a different thread will store a value at the "update" phase to the same counter.
- Some counters will end up being updated while others won't if one ends up being limited in the update phase.
- Those competing threads might end limiting a bit late (overshooting).
Regarding the bench, there's a regression of 3% but it's kind of a lie, since we are not benching for multi-threading requests.
Codecov Report
Merging #203 (5d94409) into main (490826c) will increase coverage by
0.51%. Report is 6 commits behind head on main. The diff coverage is98.98%.
@@ Coverage Diff @@
## main #203 +/- ##
==========================================
+ Coverage 73.46% 73.98% +0.51%
==========================================
Files 30 30
Lines 5058 5124 +66
==========================================
+ Hits 3716 3791 +75
+ Misses 1342 1333 -9
| Files Changed | Coverage Δ | |
|---|---|---|
| limitador/src/storage/in_memory.rs | 89.60% <98.98%> (+7.29%) |
:arrow_up: |
... and 5 files with indirect coverage changes
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more