question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Epic] Request Throttling and Queuing Middleware

See original GitHub issue

Optimistically putting this in 3.1, but no committments as to when exactly this ships. It won’t be part of 3.0.

This is tracking work to add a Request Throttling and Queuing middleware (or possibly middlewares) to ASP.NET Core. The purpose of this is to enable app developers to restrict the number of concurrently-running requests in their application in order to better manage resources.

Currently, the only queuing that occurs in ASP.NET Core applications is through use of the thread-pool queue, which queues completions of async operations (i.e. async/await) and other thread-pool work items. This can be difficult to manage and measure. For some applications, the introduction of a concurrent request limit can mitigate issues caused by problematic async patterns (like “sync-over-async” where blocking calls are done in async code paths). The “Right Thing” to do in most of these cases is to unravel these “sync-over-async” calls into a true async/await pattern, but sometimes that’s infeasible or too costly. Limiting concurrent requests conserves these resources.

When there is a concurrent request limit, it is also desirable to “queue” requests that come in over this limit rather than turning them away immediately. This also provides a clear metric to use to measure the impact of load on your system (the number of requests waiting in the queue).

Our goal is to build a middleware that limits the number of concurrently executing requests in the remainder of the pipeline. The middleware will also queue requests beyond that limit until there is space. Finally, if the limit and the queue are exhausted, it will reject the request immediately (usually by emitting a 503 HTTP status code).

We do believe that components of this middleware may be useful for “throttling” as well. Throttling includes scenarios like API Rate Limits, where requests are tracked against certain per-user limits and rejected when they exceed that limit. This is beyond the current scope of the middleware but may serve as a stretch goal.

NOTE: This is our summer intern project, so bear with us as we work through it. We’ve shipped many of our intern projects as production code in future releases and intend to do so with this one as well!

Child Items:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
analogrelaycommented, Jun 3, 2019

Our plans (for now) are limited to what you see above 😃. Simple front-door queueing is what we’re starting with, we do have some ideas around integrating throttling moving forward but that may also end up as a separate middleware.

1reaction
halter73commented, Jun 3, 2019

So for example, authenticated user traffic could be prioritized?

If we reach our stretch goal and get multi-queue support, that should be possible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Epic] Request Throttling and Queuing Middleware #10702
This is tracking work to add a Request Throttling and Queuing middleware (or possibly middlewares) to ASP.NET Core. The purpose of this is...
Read more >
Rate limiting middleware in ASP.NET Core
Learn how limit requests in ASP.NET Core apps. ... RateLimiting middleware provides rate limiting middleware. Apps configure rate limiting ...
Read more >
Middleware 101
Processing of multiple synchronous/asynchronous transactions, serving as a cluster of associated requests from distributed systems such as bank ...
Read more >
Easy way to limit rate of API requests using Rate ... - YouTube
Rate limiter out-of-the-box middleware is a game changer for managing microservice rate limits. In this video, I will cover the first part ...
Read more >
Throttle and queue up API requests due to per second cap
A simple Node.js server, add express-rate-limit middleware to API so that the API has rate-limit feature. Let's say this is the Shopify API...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found