Hi,
in our async/non-blocking app (part of a microservice architecture) we have the situation that sometimes we get several 1000 requests within a couple of seconds from another service that lead to OOME gc overhead limit exceeded.
I'd like not to fail those requests but limit the number of concurrent requests to e.g. 100 req/sec.
To achieve this I'm thinking about the following solution:
Use an Essential filter that counts the concurrent requests.
If active request count > threshold then add a promise + nextFilter function to a queue and return the promise.future.
When a request is finished it takes the first promise + nextFilter from the queue and completes the promise with the nextFilter result (perhaps run in a future, not sure).
(Because I'm on vacation I can't try this but can only work in theory)
What do you think about it?
Are there other / better solutions?
I'd like to solve it within the application to be able to restrict it based on the request (e.g. user agent or route), and I'd like to keep it as simple as possible (transparent to the app logic, no "big" tools like e.g. hystrix).
Cheers,
Martin
Hi James,
I'm especially interested in your thoughts about this problem / solution, so I'd be really happy if you'd find the time to answer.
TIA && cheers,
Martin
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi James,
thanks for your feedback! You're right, I don't expect the active request limit to be a hard limit, that's the cost of this very simple solution. But in fact my assumption is that there won't be many requests (e.g. > 200) hitting the active request count check before the first of them increases the counter. I hope that the cpu scheduler is on my side to prevent this - perhaps I should try harder to create such a situation in the test.
What do you think about synchronizing the counter check/modification vs the actor solution?
Cheers,
Martin
To unsubscribe from this group and stop receiving emails from it, send an email to play-framewor...@googlegroups.com.
Hi James,
thanks for your feedback! You're right, I don't expect the active request limit to be a hard limit, that's the cost of this very simple solution. But in fact my assumption is that there won't be many requests (e.g. > 200) hitting the active request count check before the first of them increases the counter. I hope that the cpu scheduler is on my side to prevent this - perhaps I should try harder to create such a situation in the test.
What do you think about synchronizing the counter check/modification vs the actor solution?
Ok, thanks. What would you say is high load and what would it mean to get killed? Do you know any benchmarks that can shed some light on this?
Cheers,
Martin