title: Spring-Boot: Handle multiple requests concurrently
body: <p>I am using <a href="https://spring.io/guides/gs/rest-service/" rel="noreferrer">Spring Boot to build a RESTful web service</a>. My IDE is Eclipse Oxygen.</p>
  
  <p>I send <strong>multiple</strong> HTTP get requests in <strong>every 2 seconds</strong> through <strong>Chrome</strong>, but they are triggered <strong>one by one</strong>. Each request will wait for the previous request to finish.</p>
  
  <p>Here is my controller code:</p>
  
  <pre><code>@RestController
  @RequestMapping("/dummy")
  public class DummyController {
      @RequestMapping(method = RequestMethod.GET)
      public ResponseEntity&lt;Map&lt;String, String&gt;&gt; dummytsp(@RequestParam(value="msg", defaultValue="Hello") String msg) {
          System.out.println("" + new Date() + ": ThreadId " + Thread.currentThread().getId());
  
          try {
              Thread.sleep(5000);
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
  
          Map&lt;String, String&gt; response = new HashMap&lt;&gt;();
          response.put("message", msg);
          return new ResponseEntity&lt;&gt;(response, HttpStatus.OK);
      }
  }
  </code></pre>
  
  <p>My console out put is:</p>
  
  <pre><code>Thu Sep 14 11:31:15 EDT 2017: ThreadId 25
  Thu Sep 14 11:31:20 EDT 2017: ThreadId 26
  Thu Sep 14 11:31:25 EDT 2017: ThreadId 28
  Thu Sep 14 11:31:30 EDT 2017: ThreadId 30
  </code></pre>
  
  <p>The console output shows that the controller is called <strong>every 5 seconds</strong>. But I'm sending the requests <strong>every 2 seconds</strong>.</p>
  
  <p>How could I handle multiple incoming requests concurrently? (I should see the console output every 2 seconds)</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>If I send requests in different browsers, it works perfectly.
  If I test it in the same browser/application which shares the session, the problem will come out.</p>
  
  <p>Is it possible to accept concurrent multiple requests from <strong>same session</strong>?</p>
  
  <p>Thanks!</p>