I use the spray function to create a simple HTTP server. This server accesses several services that require a response time (in seconds). We would like to decline requests when the number of simultaneous requests becomes large. Otherwise, a large number of simultaneous requests does not bring any benefit to the system.
There are several levels where this can be allowed. I am not sure how to do any of them for sure, or which is the best.
I could provide an execution context for spray routing that has a limited queue and rejection policy.
I could limit the mailbox size of my http-spray server, as it is also an actor.
I could configure the parameter in application.conf, which refers to it directly for the spray.
What is a simple, effective way to implement such a policy?
source
share