Comments (4)
whoever has a gold subscription will have 100 requests per second, silver will have 10 requests per second, and bronze will have 1 request per second
Oh, that can be achieved with a CostExtractor.
Set the limit to 100 coins, and then a bronze chap should be charged 100 coins per request, a silver guy should pay 10 coins and a gold fellow pays just 1.
Sounds good? :)
from throttlingtroll.
Alternatively, is there an easier way to implement this that I am not seeing?
Hi @kayhantolga, if you want each of your 100K clients to be throttled individually, you just need to provide an IdentityIdExtractor.
As per documentation:
When IdentityIdExtractor is specified and IdentityId is not - different identityIds will automatically get their own rate counters, one counter per each unique identityId.
Let me know if I understood your usecase correctly.
from throttlingtroll.
Hi, thanks for the reply. I understand the sample and have already tried it. It works quite well with a small number of clients. But in practice, injecting 100k rules will be quite challenging in terms of performance. So, I was thinking of grouping these clients. As an example, whoever has a gold subscription will have 100 requests per second, silver will have 10 requests per second, and bronze will have 1 request per second. This way, I only need to inject 3 rules. Additionally, I need to decide the user's rule in the IdentityIdExtractor
.
from throttlingtroll.
Weirdly, I thought about that before but couldn't figure out how to implement it. But when I looked again, now it looks quite easy. Thanks a lot.
from throttlingtroll.
Related Issues (18)
- ArgumentOutOfRangeException "The absolute expiration value must be in the future." when using DistributedCacheCounterStore + Distributed Redis Cache HOT 1
- [DistributedCacheCounterStore + Distributed Redis Cache] TTL is rounded to the nearest second, therefore setting interval to 1s does not make sense
- [Optimization] Cache the fact that a particular limit is exceeded HOT 1
- Custom response builders HOT 1
- Port to Azure Functions (Isolated) HOT 1
- Make Rule's 'Method' property comma-separated HOT 1
- Allow specifying IdentityIdExtractor at ThrottlingTrollOptions level as well HOT 1
- Implement Azure Table/Cosmos DB counter store HOT 1
- Support Functions ASP.NET Core Integration HOT 1
- Bug When 2 rules assigned to same identity or Endpoint. HOT 1
- Microsoft.AspNetCore.Http is deprecated, need to get rid of it HOT 1
- Feature Request for Azure Functions: Retrieval of Rate Limiting Values HOT 5
- Default rule when using IdentityId HOT 4
- Issue with redis counter store HOT 2
- Implement declarative (attribute-based) configuration HOT 1
- Implement SQL counter store
- Add ReleaseAfterSeconds property to Semaphore algorithm
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from throttlingtroll.