Multiple Rate Limiters = Multiple Memcached Stores? #9
-
I have multiple rate limiters. Should I pass the same Memcached store object to them or create one Memcached store for each? From the code, it looks like I should create only one and pass that store object to all the rate limiters but I just wanted to ensure I've not missed anything. Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Use multiple memcached stores, with a unique Sharing a single memcached instance across multiple rate limiter instances can lead to double-counting of requests. |
Beta Was this translation helpful? Give feedback.
-
Yes, I will use a unique prefix for each rate limiter.
Will rate-limit-memcached (RLM) use a single "memcached" backend instance on the backend? I have about 10 rate limiters and if RLM creates 10 different memcached stores on the backed, and each memcached backend instance create 10 connections in its pool, it will start 10x10 = 100 connections to the memcached server, right?
… On 25-Oct-2023, at 4:07 PM, Nathan Friedly ***@***.***> wrote:
Use multiple memcached stores, with a unique prefix configured for each one.
Sharing a single memcached instance across multiple rate limiter instances can lead to double-counting of requests.
—
Reply to this email directly, view it on GitHub <#9 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/ADGMHCODLTT7ENG7Y6U3ACLYBDTWJAVCNFSM6AAAAAA6OY7Z4GVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TGNZZHA3DQ>.
You are receiving this because you authored the thread.
|
Beta Was this translation helpful? Give feedback.
-
Thanks. That resolves it. |
Beta Was this translation helpful? Give feedback.
Yeah, that sounds about correct. I don't think it immediately jumps to 10 connections per store instance, but I believe it would get there eventually.
You could share the same
client
(instance of https://github.com/3rd-Eden/memcached) between all RLM instances - that would reduce the number of connections from 100 to just 10.