From 1c054c56d01eeefe6ad8584a188ab6f3a58da5c5 Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Tue, 4 Mar 2014 19:26:13 +0100 Subject: [PATCH] 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