title: spring-boot-starter-integration 1.4.3 performance degradation
body: <p>I noticed a significant performance degradation when upgrading Spring-Boot from 1.4.2 to 1.4.3 while using spring-integration.</p>
  
  <p>I could reproduce the problem with the following program:</p>
  
  <p>pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &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/maven-v4_0_0.xsd"&gt;
     &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
     &lt;parent&gt;
         &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
         &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
         &lt;!--&lt;version&gt;1.4.2.RELEASE&lt;/version&gt;--&gt;
         &lt;version&gt;1.4.3.RELEASE&lt;/version&gt;
     &lt;/parent&gt;
  
     &lt;artifactId&gt;performance-test&lt;/artifactId&gt;
     &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
     &lt;dependencies&gt;
         &lt;dependency&gt;
             &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
             &lt;artifactId&gt;spring-boot-starter-integration&lt;/artifactId&gt;
         &lt;/dependency&gt;
         &lt;dependency&gt;
             &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
             &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
             &lt;scope&gt;test&lt;/scope&gt;
         &lt;/dependency&gt;
     &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Application.java:</p>
  
  <pre><code>package performance.test;
  
  import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  
  @SpringBootApplication
  public class Application {
  
      public static void main(final String[] args) {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  
  <p>UsersManager.java:</p>
  
  <pre><code>package performance.test;
  
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.integration.annotation.MessageEndpoint;
  import org.springframework.integration.annotation.ServiceActivator;
  import org.springframework.messaging.handler.annotation.Payload;
  
  @MessageEndpoint
  public class UsersManager {
  
      private static final Logger LOGGER = LoggerFactory.getLogger(UsersManager.class);
  
      @ServiceActivator(inputChannel = "testChannel")
      public void process(@Payload String payload) {
          LOGGER.debug("payload: {}", payload);
      }
  }
  </code></pre>
  
  <p>IntegrationTest.java:</p>
  
  <pre><code>package performance.test;
  
  import org.junit.Test;
  import org.junit.runner.RunWith;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.test.SpringApplicationConfiguration;
  import org.springframework.messaging.MessageChannel;
  import org.springframework.messaging.support.MessageBuilder;
  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  
  @RunWith(SpringJUnit4ClassRunner.class)
  @SpringApplicationConfiguration(classes = Application.class)
  public class IntegrationTest {
  
      private static final Logger LOGGER = LoggerFactory.getLogger(IntegrationTest.class);
  
      @Autowired
      private MessageChannel testChannel;
  
      @Test
      public void basic_test() {
          for (int i = 1; i &lt;= 10; i++) {
              final long start = System.currentTimeMillis();
              test(1000);
              final long end = System.currentTimeMillis();
              LOGGER.info("test run: {} took: {} msec", i, end - start);
          }
      }
  
      private void test(int count) {
          for (int i = 0; i &lt; count; i++) {
              testChannel.send(MessageBuilder.withPayload("foo").setHeader("monkey", "do").build());
          }
      }
  }
  </code></pre>
  
  <p>When I use Spring-Boot 1.4.2, I get the following results:</p>
  
  <pre><code>2016-12-27 14:55:39.331  INFO 4939 --- [           main] performance.test.IntegrationTest         : Started IntegrationTest in 0.975 seconds (JVM running for 1.52)
  2016-12-27 14:55:39.468  INFO 4939 --- [           main] performance.test.IntegrationTest         : test run: 1 took: 123 msec
  2016-12-27 14:55:39.552  INFO 4939 --- [           main] performance.test.IntegrationTest         : test run: 2 took: 83 msec
  2016-12-27 14:55:39.632  INFO 4939 --- [           main] performance.test.IntegrationTest         : test run: 3 took: 80 msec
  2016-12-27 14:55:39.696  INFO 4939 --- [           main] performance.test.IntegrationTest         : test run: 4 took: 63 msec
  2016-12-27 14:55:39.763  INFO 4939 --- [           main] performance.test.IntegrationTest         : test run: 5 took: 67 msec
  2016-12-27 14:55:39.842  INFO 4939 --- [           main] performance.test.IntegrationTest         : test run: 6 took: 78 msec
  2016-12-27 14:55:39.895  INFO 4939 --- [           main] performance.test.IntegrationTest         : test run: 7 took: 53 msec
  2016-12-27 14:55:39.950  INFO 4939 --- [           main] performance.test.IntegrationTest         : test run: 8 took: 55 msec
  2016-12-27 14:55:40.004  INFO 4939 --- [           main] performance.test.IntegrationTest         : test run: 9 took: 54 msec
  2016-12-27 14:55:40.057  INFO 4939 --- [           main] performance.test.IntegrationTest         : test run: 10 took: 53 msec
  Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.776 sec - in performance.test.IntegrationTest
  </code></pre>
  
  <p>However, when I use Spring-Boot 1.4.3, there is significant performance degradation:</p>
  
  <pre><code>2016-12-27 14:57:41.705  INFO 5122 --- [           main] performance.test.IntegrationTest         : Started IntegrationTest in 1.002 seconds (JVM running for 1.539)
  2016-12-27 14:57:41.876  INFO 5122 --- [           main] performance.test.IntegrationTest         : test run: 1 took: 156 msec
  2016-12-27 14:57:42.031  INFO 5122 --- [           main] performance.test.IntegrationTest         : test run: 2 took: 153 msec
  2016-12-27 14:57:42.251  INFO 5122 --- [           main] performance.test.IntegrationTest         : test run: 3 took: 220 msec
  2016-12-27 14:57:42.544  INFO 5122 --- [           main] performance.test.IntegrationTest         : test run: 4 took: 293 msec
  2016-12-27 14:57:42.798  INFO 5122 --- [           main] performance.test.IntegrationTest         : test run: 5 took: 254 msec
  2016-12-27 14:57:43.111  INFO 5122 --- [           main] performance.test.IntegrationTest         : test run: 6 took: 312 msec
  2016-12-27 14:57:43.544  INFO 5122 --- [           main] performance.test.IntegrationTest         : test run: 7 took: 432 msec
  2016-12-27 14:57:44.112  INFO 5122 --- [           main] performance.test.IntegrationTest         : test run: 8 took: 567 msec
  2016-12-27 14:57:44.807  INFO 5122 --- [           main] performance.test.IntegrationTest         : test run: 9 took: 695 msec
  2016-12-27 14:57:45.620  INFO 5122 --- [           main] performance.test.IntegrationTest         : test run: 10 took: 813 msec
  Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.989 sec - in performance.test.IntegrationTest
  </code></pre>
  
  <p>I have no idea what could be the cause for this.
  Are the other persons having the same issue? </p>