title: Handling multiple requests efficiently in a REST api
body: <p>I've built a REST api using Spring Boot that basically accepts two images via POST and performs image comparison on them. The api is invoked synchronously. I'm not using an external application server to host the service, rather I package it as a jar and run it.</p>
  
  <pre><code>@RequestMapping(method = RequestMethod.POST, value = "/arraytest")
  
      public String compareTest(@RequestParam("query") MultipartFile queryFile,@RequestParam("test") MultipartFile testFile,RedirectAttributes redirectAttributes,Model model) throws IOException{
          CoreDriver driver=new CoreDriver();
          boolean imageResult=driver.initProcess(queryFile,testFile);
          model.addAttribute("result",imageResult);
          return "resultpage";
  
      }
  </code></pre>
  
  <p>The service could be invoked in parallel across multiple machines and I would need my service to perform efficiently. I'm trying to understand how are parallel calls to a REST service handled? 
  When the request is sent to the service , does a single object of the service get created and same object get used in multiple threads to handle multiple requests?</p>
  
  <p>A follow-up question would be whether if it is possible to improve the performance of a service on the perspective of handling requests rather than improving the performance of the service functionality.</p>