From 8ab6d474c500cacc882212b63cfc28fd2574f191 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Thu, 20 Feb 2014 10:49:07 +0100 Subject: [PATCH 1/3] Upgrade dependencies and fix benchmark setup This commit: * upgrades Spring Boot and Tomcat dependencies * removes memory JVM args from setup.py * fixes Tomcat and app configuration for the benchmark --- spring/README.md | 8 ++++---- spring/pom.xml | 11 ++++++++--- spring/setup.py | 2 +- .../com/techempower/spring/SampleApplication.java | 2 +- .../java/com/techempower/spring/TomcatCustomizer.java | 5 +---- spring/src/main/resources/application.yml | 9 ++++----- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/spring/README.md b/spring/README.md index 3321ea2cc24..173234feb5b 100644 --- a/spring/README.md +++ b/spring/README.md @@ -61,8 +61,8 @@ Check out [SampleApplication, the main Application file](src/main/java/com/teche ## Infrastructure Software Versions The tests were run with: -* [Spring 4.0.0.RC1](http://projects.spring.io/spring-framework/) -* [Spring Boot 0.5.0M6](http://projects.spring.io/spring-boot/) -* [Spring Data JPA 1.4.2.RELEASE](http://projects.spring.io/spring-data-jpa/) +* [Spring 4.0.1.RELEASE](http://projects.spring.io/spring-framework/) +* [Spring Boot 1.0.0.RC3](http://projects.spring.io/spring-boot/) +* [Spring Data JPA 1.5.0.RC1](http://projects.spring.io/spring-data-jpa/) * [Java OpenJDK 1.7.0_09](http://openjdk.java.net/) -* [Tomcat 8.0.0-RC5](https://tomcat.apache.org/) \ No newline at end of file +* [Tomcat 8.0.3](https://tomcat.apache.org/) \ No newline at end of file diff --git a/spring/pom.xml b/spring/pom.xml index ae6cc627d5c..333400962ba 100644 --- a/spring/pom.xml +++ b/spring/pom.xml @@ -8,7 +8,7 @@ org.springframework.boot spring-boot-starter-parent - 0.5.0.M7 + 1.0.0.RC3 com.techempower @@ -19,7 +19,7 @@ 1.7 - 8.0.0-RC10 + 8.0.3 @@ -47,7 +47,7 @@ org.thymeleaf - thymeleaf-spring3 + thymeleaf-spring4 org.yaml @@ -70,6 +70,11 @@ spring-milestones http://repo.spring.io/milestone + + bintray + bintray + http://jcenter.bintray.com + diff --git a/spring/setup.py b/spring/setup.py index 55094b4dbc3..f256e621e01 100644 --- a/spring/setup.py +++ b/spring/setup.py @@ -6,7 +6,7 @@ def start(args, logfile, errfile): try: subprocess.check_call("mvn clean package", shell=True, cwd="spring", stderr=errfile, stdout=logfile) - subprocess.Popen(("java -Xmx2048m -Xms2048m -XX:MaxPermSize=256m -Ddatabase.host=" + args.database_host + " -jar spring.war").rsplit(" "), cwd="spring/target", stderr=errfile, stdout=logfile) + subprocess.Popen(("java -Ddatabase.host=" + args.database_host + " -jar spring.war").rsplit(" "), cwd="spring/target", stderr=errfile, stdout=logfile) return 0 except subprocess.CalledProcessError: return 1 diff --git a/spring/src/main/java/com/techempower/spring/SampleApplication.java b/spring/src/main/java/com/techempower/spring/SampleApplication.java index 56584a8f2ca..d6b68bb9994 100644 --- a/spring/src/main/java/com/techempower/spring/SampleApplication.java +++ b/spring/src/main/java/com/techempower/spring/SampleApplication.java @@ -3,7 +3,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.SpringBootServletInitializer; +import org.springframework.boot.context.web.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; import org.springframework.web.servlet.config.annotation.EnableWebMvc; diff --git a/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java b/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java index 0237cbc74bd..428447d6a9e 100644 --- a/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java +++ b/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java @@ -25,9 +25,6 @@ public class TomcatCustomizer implements EmbeddedServletContainerCustomizer { @Value("${tomcat.connector.maxKeepAliveRequests}") private int maxKeepAliveRequests; - @Value("${tomcat.connector.minSpareThreads}") - private int minSpareThreads; - @Override public void customize(ConfigurableEmbeddedServletContainerFactory factory) { @@ -45,10 +42,10 @@ public void customize(Connector connector) { if (handler instanceof AbstractProtocol) { AbstractProtocol protocol = (AbstractProtocol) handler; protocol.setMaxThreads(maxThreads); - protocol.setMinSpareThreads(minSpareThreads); protocol.setConnectionTimeout(connectionTimeout); protocol.setMaxConnections(maxConnections); } + connector.setProperty("acceptCount", maxConnections+""); connector.setProperty("maxKeepAliveRequests", maxKeepAliveRequests+""); } } diff --git a/spring/src/main/resources/application.yml b/spring/src/main/resources/application.yml index 2ce92fbb3c5..0e8f10c1afd 100644 --- a/spring/src/main/resources/application.yml +++ b/spring/src/main/resources/application.yml @@ -13,15 +13,14 @@ spring: hibernate: naming-strategy: org.hibernate.cfg.EJB3NamingStrategy ddl-auto: validate - open_in_view: true + open_in_view: false tomcat: connector: - maxThreads: 200 - minSpareThreads: 100 + maxThreads: 12 connectionTimeout: 20000 - maxConnections: 200 - maxKeepAliveRequests: 2000 + maxConnections: 20000 + maxKeepAliveRequests: -1 --- spring: From c2589fe4cfb6b7fc4ea03cc7e9dc1af6ea5b1359 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 4 Mar 2014 09:35:21 +0100 Subject: [PATCH 2/3] Upgrade to Spring Boot 1.0.0.RC4 --- spring/README.md | 6 +++--- spring/pom.xml | 2 +- .../main/java/com/techempower/spring/TomcatCustomizer.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spring/README.md b/spring/README.md index 173234feb5b..19a6cf59828 100644 --- a/spring/README.md +++ b/spring/README.md @@ -61,8 +61,8 @@ Check out [SampleApplication, the main Application file](src/main/java/com/teche ## Infrastructure Software Versions The tests were run with: -* [Spring 4.0.1.RELEASE](http://projects.spring.io/spring-framework/) -* [Spring Boot 1.0.0.RC3](http://projects.spring.io/spring-boot/) -* [Spring Data JPA 1.5.0.RC1](http://projects.spring.io/spring-data-jpa/) +* [Spring 4.0.2.RELEASE](http://projects.spring.io/spring-framework/) +* [Spring Boot 1.0.0.RC4](http://projects.spring.io/spring-boot/) +* [Spring Data JPA 1.5.0.RELEASE](http://projects.spring.io/spring-data-jpa/) * [Java OpenJDK 1.7.0_09](http://openjdk.java.net/) * [Tomcat 8.0.3](https://tomcat.apache.org/) \ No newline at end of file diff --git a/spring/pom.xml b/spring/pom.xml index 333400962ba..f2e006a551e 100644 --- a/spring/pom.xml +++ b/spring/pom.xml @@ -8,7 +8,7 @@ org.springframework.boot spring-boot-starter-parent - 1.0.0.RC3 + 1.0.0.RC4 com.techempower diff --git a/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java b/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java index 428447d6a9e..dc7cb8fe016 100644 --- a/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java +++ b/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java @@ -4,7 +4,7 @@ import org.apache.coyote.AbstractProtocol; import org.apache.coyote.ProtocolHandler; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainerFactory; +import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.boot.context.embedded.tomcat.TomcatConnectorCustomizer; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; @@ -26,7 +26,7 @@ public class TomcatCustomizer implements EmbeddedServletContainerCustomizer { private int maxKeepAliveRequests; @Override - public void customize(ConfigurableEmbeddedServletContainerFactory factory) { + public void customize(ConfigurableEmbeddedServletContainer factory) { customizeTomcatConnector((TomcatEmbeddedServletContainerFactory) factory); } From 1c054c56d01eeefe6ad8584a188ab6f3a58da5c5 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 4 Mar 2014 19:26:13 +0100 Subject: [PATCH 3/3] Fix and comment Tomcat configuration * comment choices in Tomcat configuration * disable access logs; performance boost... --- .../java/com/techempower/spring/TomcatCustomizer.java | 5 ++++- spring/src/main/resources/application.yml | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java b/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java index dc7cb8fe016..b03bd11e2c3 100644 --- a/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java +++ b/spring/src/main/java/com/techempower/spring/TomcatCustomizer.java @@ -22,6 +22,9 @@ public class TomcatCustomizer implements EmbeddedServletContainerCustomizer { @Value("${tomcat.connector.maxConnections}") private int maxConnections; + @Value("${tomcat.connector.acceptCount}") + private int acceptCount; + @Value("${tomcat.connector.maxKeepAliveRequests}") private int maxKeepAliveRequests; @@ -45,7 +48,7 @@ public void customize(Connector connector) { protocol.setConnectionTimeout(connectionTimeout); protocol.setMaxConnections(maxConnections); } - connector.setProperty("acceptCount", maxConnections+""); + connector.setProperty("acceptCount", acceptCount+""); connector.setProperty("maxKeepAliveRequests", maxKeepAliveRequests+""); } } diff --git a/spring/src/main/resources/application.yml b/spring/src/main/resources/application.yml index 0e8f10c1afd..6fbd39c5ec6 100644 --- a/spring/src/main/resources/application.yml +++ b/spring/src/main/resources/application.yml @@ -17,11 +17,20 @@ spring: tomcat: connector: + # reduce context switching; Intel Xeons have 12 threads maxThreads: 12 connectionTimeout: 20000 + # maximum: 16K connections test maxConnections: 20000 + # handle initial connection spike + acceptCount: 20000 + # avoid running out of ports due to connections stuck in TIME_WAIT state maxKeepAliveRequests: -1 +server: + tomcat: + access_log_enabled: false + --- spring: profiles: local