1

I have the following WS configuration:

private WebServiceOperations createWs(final String uri) {
    WebServiceTemplate wst = new WebServiceTemplate();
    wst.setDefaultUri(uri);
    wst.setMarshaller(marshaller());
    wst.setUnmarshaller(marshaller());

    HttpComponentsMessageSender messageSender = new HttpComponentsMessageSender(createPooling());
    messageSender.setConnectionTimeout(timeout);
    messageSender.setReadTimeout(timeout);
    wst.setMessageSender(messageSender);
    return wst;
}

public DefaultHttpClient createPooling() {
    PoolingClientConnectionManager a = new PoolingClientConnectionManager();
    a.setDefaultMaxPerRoute(6);
    a.setMaxTotal(50);

    DefaultHttpClient defaultClient = new DefaultHttpClient(a);
    defaultClient.addRequestInterceptor(new HttpComponentsMessageSender.RemoveSoapHeadersInterceptor(), 0);
    return defaultClient;
}

In case of using the above config for WS, one pool of TCP connection is created, with maximum of 6 threads. If one finished the job, the response is returned, and another one is submitted to the pool. This indicates that there is only one pool alive. The service is able to handle much higher traffic but not within one pool. In case of multiple running java instances, it is clearly visible.

Question: How can I modify the behaviour of the pool, so that multiple TCP pools are created to the same service, and the requests are distributed across them?

Gábor DANI
  • 2,063
  • 2
  • 22
  • 40
  • I am in exact same situation and trying to figure that out. Reactor Netty is giving only 8 threads, maybe the HttpClient is blocking them... – Evgeni Atanasov Jan 22 '19 at 11:34

0 Answers0