The Web server and/or servlet container against which you are testing probably
has a limit set for the number of connections it will queue.  In Tomcat 3.2.1,
for example, server.xml has the "backlog" parameter for a Connector:

        <!-- Normal HTTP -->
        <Connector className="org.apache.tomcat.service.PoolTcpConnector">
            <Parameter name="handler"
                value="org.apache.tomcat.service.http.HttpConnectionHandler"/>
            <Parameter name="port"
                value="8080"/>
            <Parameter name="backlog" value="100"/>
        </Connector>

In Tomcat 4.0.1, the Connector has an acceptCount attribute:

    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector className="org.apache.catalina.connector.http.HttpConnector"
               port="8080" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="60000"/>

Scott Nichol

----- Original Message -----
From: "Tiago Fernandes Thomaz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 22, 2002 5:58 AM
Subject: Heavy loads on SOAP RPC


> Hi,
>
> I'm facing some trouble concerning heavy loads on soap rpc.
> I coded a soap client that simulates several clients with a Thread
> implementation.
> My snippet code is:
>
> public class SOAPClient
> {
>   public static void main (String[] args) throws Exception
>   {
>     URL url = new URL(args[0]);
>     String sXML = null;
>
>     for (int i = 0; i < 50; i++)
>     {
>         sXML = "<?xml version=\"1.0\" encoding=\"US-ASCII\"?><request client
> = \"client"+i+"\" action = \"action"+i+"\"><parameter name =
> \"name"+i+"\">My Name"+i+"</parameter></request> ";
>
>       Call call = new Call();
>       call.setTargetObjectURI("urn:Connector");
>       call.setMethodName("sendRequest");
>       call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/";);
>       Vector params = new Vector();
>       params.addElement(new org.apache.soap.rpc.Parameter("sXML",
> String.class, sXML, null));
>
>       call.setParams(params);
>
>       (new TestThread(call, url)).start();
>     }
>   }
> }
>
>
> public class TestThread extends Thread
> {
>   Call testCall = null;
>   URL  url = null;
>
>   public TestThread(Call testCall, URL url)
>   {
>     this.testCall = testCall;
>     this.url = url;
>   }
>
>   public void run()
>   {
>     try {
>       org.apache.soap.rpc.Response resp = testCall.invoke(url, "");
>
>       if (resp.generatedFault())
>       {
>         Fault fault = resp.getFault();
>         System.out.println(this.getName() + "Fault Code   = " +
> fault.getFaultCode());
>         System.out.println(this.getName() + "Fault String = " +
> fault.getFaultString());
>       }
>       else
>       {
>         org.apache.soap.rpc.Parameter result = resp.getReturnValue();
>         String res = result.toString();
>         Object obj = result.getValue();
>         String resp2 = obj.toString();
>         System.out.println(this.getName()+" - Result: "+resp2);
>       }
>     }
>     catch (Exception e)
>     {
>       System.out.println(this.getName() + " :Error! - " + e.getMessage());
>     }
>   }
> }
>
> , and I'm getting the following exception for most of the Threads (30 out of
> 50):
>
> Thread-i Error opening socket: Connection refused: connect
>
> Does anyone explain me why am I getting this? Is it because SOAP can only
> handle about 20 http connections?
>
> Tiago Fernandes Thomaz
>

Reply via email to