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