user2531191
user2531191

Reputation: 579

Limiting Spring Controller To Concurrently Handle only few request

In spring controller, there is a huge I/O operation for each request, example loading huge data on memory. For such operations, if server handles all requests at a time, server will finally throw out of memory. Is there any way in Spring MVC to limit number of concurrent requests (say 5) and block further requests until current 5 requests are processed.

Upvotes: 1

Views: 1121

Answers (1)

Stephen C
Stephen C

Reputation: 718826

This is normally handled at the web-container level; i.e. in Tomcat or Netty or Glassfish or ... whatever you are using to host your servlets. You can typically configure the number of request threads that the container runs.


I don't think that Spring MVC has built-in support for limiting the number of simultaneous requests. However, you could possibly implement this with a Filter.

(Ugly. Better to do it at the container level ... IMO.)

Upvotes: 4

Related Questions