I developed a microservice using Spring Boot. I was performance testing the service by stubbing the backend calls. When I looked at the thread count , I see that the maximu
Increase maxConcurrentStreamExecution
(set 200) for HTTP/2 in Spring Boot 2:
@Bean
public WebServerFactoryCustomizer containerCustomizer() {
return new WebServerFactoryCustomizer() {
@Override
public void customize(TomcatServletWebServerFactory factory) {
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
@Override
public void customize(Connector connector) {
Arrays.stream(connector.getProtocolHandler().findUpgradeProtocols())
.filter(upgradeProtocol -> upgradeProtocol instanceof Http2Protocol)
.map(upgradeProtocol -> (Http2Protocol) upgradeProtocol)
.forEach(http2Protocol -> http2Protocol.setMaxConcurrentStreamExecution(200));
}
});
}
};
}