Open asarkar opened 7 years ago
Can you expand what connection properties you are referring to? I suppose you are aware of management.port
?
@snicoll I'm aware of management.port
; it changes the default actuator port, not the behavior I opened this ticker for.
The properties I'm referring to are the server.tomcat
thread pool properties. I've not checked for other server properties, but I see the following getting picked up by management endpoint.
server:
tomcat:
max-threads: 10
min-spare-threads: 10
accept-count: 10
The numbers above are defaults for development, and overridden for performance testing.
I can't really see an obvious way to configure the main Tomcat connector but not the management connector. Currently these settings are setup using a TomcatConnectorCustomizer
and will be applied to all connectors.
@philwebb But if I create a container myself, the settings are not applied.
@Bean
public EmbeddedServletContainerFactory servletContainer() {
TomcatEmbeddedServletContainerFactory tomcat = new TomcatEmbeddedServletContainerFactory();
tomcat.addAdditionalTomcatConnectors(createTrustedConnectors());
return tomcat;
}
private Connector[] createTrustedConnectors() {
return trustedPorts.stream()
.map(port -> {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
Http11NioProtocol protocol = (Http11NioProtocol) connector.getProtocolHandler();
connector.setScheme("http");
connector.setSecure(false);
connector.setPort(port);
protocol.setSSLEnabled(false);
return connector;
})
.toArray(size -> new Connector[size]);
}
Just following up on this ticket. There are 2 separate issues in our hands, perhaps contradictory.
TomcatConnectorCustomizer
is customizing all connectors, why doesn't it customize mine?Two reasons:
It appears that the management port connector is using the same settings as the regular one (usually 8080). We found this during performance test. It makes sense to tweak the settings for port 8080, or whatever port the application is running on, without impacting the management port. It doesn't make sense to assume that at peak usage, there is going to be as many people using the management port as the number of concurrent users.
This ticket is to introduce new thread and connection properties for the management port. To begin with, don't use the ones for regular 8080 port.