SEBSERV-445 adapt Tomcat connector settings
This commit is contained in:
parent
527c575eeb
commit
48d3e5101c
4 changed files with 32 additions and 1 deletions
|
@ -10,10 +10,13 @@ package ch.ethz.seb.sebserver;
|
||||||
|
|
||||||
import org.apache.catalina.connector.Connector;
|
import org.apache.catalina.connector.Connector;
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
|
import org.apache.coyote.http11.AbstractHttp11Protocol;
|
||||||
|
import org.apache.coyote.http11.Http11NioProtocol;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
|
||||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||||
|
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
||||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
@ -84,6 +87,29 @@ public class SEBServer {
|
||||||
return firewall;
|
return firewall;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public WebServerFactoryCustomizer<TomcatServletWebServerFactory> tomcatCustomizer() {
|
||||||
|
return (tomcat) -> tomcat.addConnectorCustomizers((connector) -> {
|
||||||
|
if (connector.getProtocolHandler() instanceof AbstractHttp11Protocol) {
|
||||||
|
System.out.println("*************** tomcatCustomizer");
|
||||||
|
final AbstractHttp11Protocol<?> protocolHandler = (AbstractHttp11Protocol<?>) connector
|
||||||
|
.getProtocolHandler();
|
||||||
|
protocolHandler.setKeepAliveTimeout(60000);
|
||||||
|
protocolHandler.setMaxKeepAliveRequests(3000);
|
||||||
|
protocolHandler.setUseKeepAliveResponseHeader(true);
|
||||||
|
protocolHandler.setMinSpareThreads(200);
|
||||||
|
protocolHandler.setProcessorCache(-1);
|
||||||
|
protocolHandler.setTcpNoDelay(true);
|
||||||
|
protocolHandler.setThreadPriority(Thread.NORM_PRIORITY + 1);
|
||||||
|
if (protocolHandler instanceof Http11NioProtocol) {
|
||||||
|
System.out.println("*************** Http11NioProtocol");
|
||||||
|
((Http11NioProtocol) protocolHandler).setPollerThreadPriority(Thread.MAX_PRIORITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private Connector redirectConnector(final Environment env) {
|
private Connector redirectConnector(final Environment env) {
|
||||||
final String sslPort = env.getRequiredProperty("server.port");
|
final String sslPort = env.getRequiredProperty("server.port");
|
||||||
final String httpPort = env.getProperty("sebserver.ssl.redirect.html.port", "80");
|
final String httpPort = env.getProperty("sebserver.ssl.redirect.html.port", "80");
|
||||||
|
|
|
@ -34,6 +34,7 @@ public class AsyncServiceSpringConfig implements AsyncConfigurer {
|
||||||
executor.setMaxPoolSize(42);
|
executor.setMaxPoolSize(42);
|
||||||
executor.setQueueCapacity(11);
|
executor.setQueueCapacity(11);
|
||||||
executor.setThreadNamePrefix("asyncService-");
|
executor.setThreadNamePrefix("asyncService-");
|
||||||
|
executor.setThreadPriority(Thread.NORM_PRIORITY);
|
||||||
executor.initialize();
|
executor.initialize();
|
||||||
executor.setWaitForTasksToCompleteOnShutdown(true);
|
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||||
return executor;
|
return executor;
|
||||||
|
|
|
@ -25,7 +25,7 @@ sebserver.webservice.clean-db-on-startup=false
|
||||||
|
|
||||||
# webservice configuration
|
# webservice configuration
|
||||||
sebserver.init.adminaccount.gen-on-init=false
|
sebserver.init.adminaccount.gen-on-init=false
|
||||||
sebserver.webservice.distributed=false
|
sebserver.webservice.distributed=true
|
||||||
#sebserver.webservice.master.delay.threshold=10000
|
#sebserver.webservice.master.delay.threshold=10000
|
||||||
sebserver.webservice.http.external.scheme=http
|
sebserver.webservice.http.external.scheme=http
|
||||||
sebserver.webservice.http.external.servername=localhost
|
sebserver.webservice.http.external.servername=localhost
|
||||||
|
|
|
@ -15,6 +15,10 @@ server.servlet.context-path=/
|
||||||
# Tomcat
|
# Tomcat
|
||||||
server.tomcat.max-threads=2000
|
server.tomcat.max-threads=2000
|
||||||
server.tomcat.accept-count=300
|
server.tomcat.accept-count=300
|
||||||
|
socket.soKeepAlive=true
|
||||||
|
socket.performanceConnectionTime=1
|
||||||
|
socket.performanceLatency=2
|
||||||
|
socket.performanceBandwidth=0
|
||||||
server.tomcat.uri-encoding=UTF-8
|
server.tomcat.uri-encoding=UTF-8
|
||||||
|
|
||||||
### encoding
|
### encoding
|
||||||
|
|
Loading…
Reference in a new issue