-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
in mem storage: got rid of the namespace indirection #344
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Some further testing, with no `variables`, i.e actually hitting the change! Not that much difference... With the newly added bench scenario: #346
But if I grow the namespaces to a Now, that's all still on MacOS, I'll test these more rigorously on Linux next... |
Also... if a "tree" ( 1000 namespaces with 50 limits each:10 namespaces with 50 limits eachWell much... better. Anyways, Imma stop here and run all these on Linux and flamegraph some of these, but some of this would absolutely apply to our distributed storage /cc @chirino |
da254ce
to
7cc0ab9
Compare
7cc0ab9
to
2676d01
Compare
limitador/src/storage/in_memory.rs
Outdated
pub struct InMemoryStorage { | ||
limits_for_namespace: RwLock<NamespacedLimitCounters<AtomicExpiringValue>>, | ||
simple_limits: RwLock<HashMap<Limit, AtomicExpiringValue>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
use std::ops::Deref; | ||
use std::sync::{Arc, RwLock}; | ||
use std::time::{Duration, SystemTime}; | ||
|
||
pub struct InMemoryStorage { | ||
simple_limits: RwLock<HashMap<Limit, AtomicExpiringValue>>, | ||
simple_limits: RwLock<BTreeMap<Limit, AtomicExpiringValue>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
88fc6f8
to
d35a266
Compare
I'll break the format anyways with more PRs coming… which is why we are releasing Limitador |
Signed-off-by: Alex Snaps <[email protected]>
Signed-off-by: Alex Snaps <[email protected]>
d35a266
to
0c08ce4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🪜
Looks better in this screenshot, but I will flamegraph and test this a little further on linux