java - getWebServiceTemplate with HttpComponentsMessageSender not maintaining connections -
i have been searching 2 days answer problem cannot find it.
i have client consuming soap service. use springs getwebservicetemplate().marshalsendandreceive(request, new securityheader(..))
i need able send 100 requests/sec , given service replies @ 460ms on average figured should create threadpool 50 threads make concurrent requests. furthermore, setting client
@bean public httpcomponentsmessagesender messagesender() { final poolinghttpclientconnectionmanager connmanager = new poolinghttpclientconnectionmanager(); connmanager.setmaxtotal(100); connmanager.setdefaultmaxperroute(55); final requestconfig reqconf = requestconfig.custom() .setconnectionrequesttimeout(5000) .setconnecttimeout(5000) .setsockettimeout(5000) .build(); final closeablehttpclient httpclient = httpclients.custom().setconnectionmanager(connmanager) .setdefaultrequestconfig(reqconf) .addinterceptorfirst(new httpcomponentsmessagesender.removesoapheadersinterceptor()).build(); final httpcomponentsmessagesender messagesender = new httpcomponentsmessagesender(httpclient); return messagesender; }
and in client extending webservicegatewaysupport
class:
@autowired public transactionclientimpl(jaxb2marshaller transactionmarshaller, httpcomponentsmessagesender messagesender) { this.setmarshaller(transactionmarshaller); this.setunmarshaller(transactionmarshaller); this.setmessagesender(messagesender); }
i have used many times in past working well. now, in case see when start process using client make requests service netstat
shows correct 55 connections established target host. after 30-40 seconds connections fall 20-27 , stay there. if pause , resume service again come 55 , after while again drop 20-27.
the treads not seem die see in logs thead names being 50, 49, 1 etc. have tried more 55 200 (increasing threads well) still same thing happens.
i @ loss here. suspecting connection leak first suppose spring correctly handling , secondly drop sudden , stays days.
Comments
Post a Comment