Jun 2nd, 2009, 11:12 AM
HTTP Remoting and persistent connections
We have what is essentially a client/server app using Spring HTTP remoting to maintain several polled data feeds. Using RMI, the client shares one socket connection to do all remote invocations, but with HTTP remoting every poll seems to establish a new connection. With several polls per user per minute, the server quickly runs out of http sockets. Due to the customer domain, spring is running in tomcat proxied through IIS, and IIS seems to keep the connections around in a wait-state for several minutes before reclaiming the socket.
Is there any way to establish an http connection (or pool) from the client, and use it for all http remoting requests to the same server (with several remoted APIs)?
Sep 22nd, 2009, 08:04 PM
By default Spring's HTTP remoting creates a new connection each time. But on the client side you can specify a httpInvokerRequestExecutor for the HttpInvokerProxyFactoryBean. Spring also includes the CommonsHttpInvokerRequestExecutor which uses the Apache HTTPClient to create a pool of connections. By default the HTTPClient will only open 2 connections per server but you can increase this.
Tags for this Thread