Too many connections,

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Too many connections,

I have deployed a web service on glassfish v2.1 and i am invoking a method of the web service remotely.  I am using the proxy client automatically generated by glassfish.
The code i am using for method invocation is as follows:-

hellows.HelloServiceService service = new hellows.HelloServiceService();
hellows.HelloService port = service.getHelloServicePort();

java.lang.String name = "Client";
String result;

for(int i=0;i<100;i++){
result = port.msg(name);

I have checked glassfish uses Http 1.1 keep-alive feature and i have read that it uses persistent connections which can be reused by client and server closes connections if timeout expires or max connections reached. I am reaching the max connections limit which i have tried to increase by increasing the queue-size in connection pool settings but it is of no help. so i want to know if there is a way to reduce number of open connections?
I invoke the same function 100 times and for each invocation a new connection is established for the same client for each request and a new session is also created. I have checked this with wireshark and ip_conntrack table. Is there a way to open one connection and reuse the connection for requests from the same client. I have threaded consumers which invoke the same service from the same machine. Now for 10 clients sending 100 requests, i have 1000 connections and i instead want to have 10 connections for 10 clients. What should i do to resolve the problem?

Any help would be appreciated.