spring boot app only accepts 6 requests why?

by user1107753   Last Updated October 17, 2019 13:26 PM - source

This is really annoying me and hoping someone can help.

I have a spring boot application which I am firing requests to from postman and i need to fire about 20 separate requests at the same time. However my application only accepts 6 and then when these have finished starts the others.

I numbed the example down so as to post it here

Simple controller method

@RequestMapping(value = "/testPost", method = RequestMethod.POST)
    public @ResponseBody String handleFileUpload() throws InterruptedException {
        System.out.println("Recieved request for Thread sleeping" + Thread.currentThread().getName());
        Thread.sleep(40000);
        System.out.println("Recieved request for Thread waking" + Thread.currentThread().getName());
        return "returning from post";
    }

application.properties: I changed the max thread count to 200 rather than default but made no difference

server.contextPath=/qas
server.port=8081

server.tomcat.max-threads=200

Logs for requests fired from postman. As you can see after 6 requests the 7th request is only serviced after the 1st request becomes free. I am running on my local desktop with no load balancer is this the reason? Not really sure why it stops at 6?

Logs:

2016-04-08 09:02:35.408  INFO 17700 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/qas]    : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-04-08 09:02:35.408  INFO 17700 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2016-04-08 09:02:35.421  INFO 17700 --- [nio-8081-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 13 ms
Recieved request for Thread sleepinghttp-nio-8081-exec-1
Recieved request for Thread sleepinghttp-nio-8081-exec-2
Recieved request for Thread sleepinghttp-nio-8081-exec-3
Recieved request for Thread sleepinghttp-nio-8081-exec-4
Recieved request for Thread sleepinghttp-nio-8081-exec-5
Recieved request for Thread sleepinghttp-nio-8081-exec-6
Recieved request for Thread wakinghttp-nio-8081-exec-1
Recieved request for Thread sleepinghttp-nio-8081-exec-7
Recieved request for Thread wakinghttp-nio-8081-exec-2
Recieved request for Thread sleepinghttp-nio-8081-exec-8
Recieved request for Thread wakinghttp-nio-8081-exec-3
Recieved request for Thread wakinghttp-nio-8081-exec-4
Recieved request for Thread wakinghttp-nio-8081-exec-5
Recieved request for Thread wakinghttp-nio-8081-exec-6
Recieved request for Thread wakinghttp-nio-8081-exec-7
Recieved request for Thread wakinghttp-nio-8081-exec-8

Thanks in advance



Answers 1


What a lot of people don't know (or forget) is that most browsers have a maximum number of parallel requests that can be fired per hosts. How many depends on the browser and browser version. (Apparently you use Postman, which uses chrome which allows 6 concurrent requests).

List of parallel connections per browser

See http://sgdev-blog.blogspot.nl/2014/01/maximum-concurrent-connection-to-same.html for a more detailed description.

See also https://stackoverflow.com/a/985704/2696260

M. Deinum
M. Deinum
April 08, 2016 10:03 AM

Related Questions


I can't login to spring restful api with Postman

Updated April 26, 2018 22:26 PM

Send a list using Postman

Updated January 16, 2018 10:26 AM

Spring Rest Service - Post request forbidden error

Updated February 15, 2019 11:26 AM

"Could not find acceptable representation" 406

Updated June 27, 2019 10:26 AM

Insert in child and parent JSON Spring Boot

Updated October 03, 2019 10:26 AM