title: Spring Boot Rest Hello World poor performance
body: <p>My motivation for this question are slow response times of our application's REST endpoints, ca 500ms.</p>
  
  <p>To narrow down the cause,  I followed this <a href="https://spring.io/guides/gs/spring-boot/" rel="nofollow noreferrer">Spring Boot getting started</a> tutorial and created very basic single endpoint app. And the repsponse times are the same, ca 500ms.</p>
  
  <p>Code: </p>
  
  <pre><code>@RestController
  public class Rest {
  
      @GetMapping("/rest")
      public String index() {
          return "Greetings from Spring Boot!";
      }
  }
  
  @SpringBootApplication
  public class App extends SpringBootServletInitializer {
  
      @Override
      protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
          return application.sources(App.class);
      }
  
      public static void main(String[] args) {
          SpringApplication.run(App.class, args);
      }
  }
  </code></pre>
  
  <p>pom.xml:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.kousalik&lt;/groupId&gt;
      &lt;artifactId&gt;boot&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  &lt;properties&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
  &lt;/properties&gt;
  
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.5.6.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p></p>
  
  <p>The response times with embedded Tomcat are the same, ca 500ms.</p>
  
  <p><a href="https://i.stack.imgur.com/T3G2D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T3G2D.png" alt="JMeter"></a></p>
  
  <p>Why is Spring Boot so slow by default? All I found about performance usualy mentions only startup speed, memory fottprints etc. What is wrong with this simple example?</p>
  
  <p>I'm running it on Win 10, JDK 1.8.144, Tomcat 8.5.20.</p>