tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magyar, Bence" <>
Subject web client running out of ports! (timeout exception)
Date Tue, 29 Nov 2005 18:57:08 GMT
  I noticed some strange behavior the other day while load testing my simple web service.
 First, my environment:  I am running Apache Tomcat 5.5.12 with Axis 1.3 on an XP box.  I've
used Java2WSDL and WSDL2Java to generate the necessary bindings.  I used the generated .wsdd
file to deploy my service with an "Application" deployment scope and my Java client can call
methods on the service the ease.  
So far, so good.
  By looking at the Axis SOAP monitor, all my messages seem to be getting through fine.  The
trouble starts when I begin rapidly calling web service methods within a loop.  The first
3000 calls or so go through fine.  Then I get an Axis Fault: timeout exception.  See the attached
is the stack trace.
Why is this happening?  I used the -netstat utility on the machine hosting the web service
and noticed that -each- method call is coming in on a different port!  Every time I call a
method, my java client opens a new port!  On XP, the default port range goes from 1024-5000.
 Worse yet, each port is in the TIME_WAIT state, meaning that it can't be re-used untill some
specified timeout period.  After waiting for 10-20 seconds, Windows frees up all the ports
and I can begin happily calling methods again.  
  I'm not sure why this is happening!  I thought the entire point of HTTP/1.1 was to persist
connections.  If I make two calls to the same web service within X seconds of each other,
shouldn't TCP/IP use the already established connection?  Especially a connection that is
not in use and in the TIME_WAIT state?
  I am fairly sure that I need to set the well-known TCP/IP parameter SO_REUSEADDR to true.
 I know I can configure Tomcat with the server.xml file, but I could not find anything related
to this phenomena.  Instead, I see parameters relating to the keepalivetime, etc...My method
calls will not be data intensive, but will be making many (thousands) method invocations at
once.  Ideally I'd like to have one or two connections to the webservice and re-use them.
 Does anyone have any idea how I could configure Tomcat/Axis to perform in this manner?
  P.S.. In looking at some Apache source, I noticed that Apache sets the SO_REUSE_ADDR variable,
but only in NON-win32 environments!  Is this feature not available in the Windows world? 
Thanks for any leads!!!

 Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
View raw message