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.
Comment From: snicoll
Can you expand what connection properties you are referring to? I suppose you are aware of management.port?
Comment From: asarkar
@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.
Comment From: philwebb
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.
Comment From: asarkar
@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]);
}
Comment From: asarkar
Just following up on this ticket. There are 2 separate issues in our hands, perhaps contradictory.
- Management port picks up the settings for default Tomcat port. @philwebb said it's difficult to change that, which brings me to number 2 below.
- If I create a Tomcat connector myself, it doesn't pick up the settings for default Tomcat port. If the
TomcatConnectorCustomizeris customizing all connectors, why doesn't it customize mine?
Comment From: wilkinsona
Two reasons:
- A connector's port isn't set by the connector customiser
- Connector customisers are applied to the default connector of all Tomcat containers and not to any custom connectors that you may have added