Thanks A lot Andrew and Mike for providing useful information. But Just for my knowledge I would like to know, What IIS or Apache doing specially so the connection closes with them and not with Tomcat. Any special protocols they are following or what?
I have to compulsory use only tomcat and not apache. And mine is a networking application so these sockets are concerend for client. IS there any solution for it, when using only with tomcat or I have to accept this as a fact and work with it. Thanks Again. Taral Shah Experience is what you get when you were expecting something else. ----- Original Message ----- From: "Andrew Conrad" <[EMAIL PROTECTED]> To: "'Tomcat Users List'" <[EMAIL PROTECTED]>; "'Taral Shah'" <[EMAIL PROTECTED]> Sent: Saturday, August 17, 2002 11:42 PM Subject: RE: Persistent Connection It's a operating system issue. <quote> NOTE: It is normal to have a socket in the TIME_WAIT state for a long period of time. The time is specified in RFC793 as twice the Maximum Segment Lifetime (MSL). MSL is specified to be 2 minutes. So, a socket could be in a TIME_WAIT state for as long as 4 minutes. Some systems implement different values (less than 2 minutes) for the MSL. </quote> http://support.microsoft.com/default.aspx?scid=kb;en-us;Q137984 But if you really want to change the TIME_WAIT, look here http://support.microsoft.com/default.aspx?scid=kb;en-us;q314053 To test your MSL (maximum segment lifetime), you can use this tool http://polygraph.ircache.net/doc/msl_test.html - Andrew > -----Original Message----- > From: Taral Shah [mailto:[EMAIL PROTECTED]] > Sent: Saturday, August 17, 2002 2:16 AM > To: Tomcat Users List > Subject: Re: Persistent Connection > > > Hi, > Thanks for reply, > > But I am only using tomcat. I dont want to use apache just > for this reason.Can any one guide me what should i do to > close this connection in tomcat or to ask tcp/ip stack to > close connection. Its not at all affecting the performance of > application but when i see at netstat statstics it sometimes > shows me thousands of connections open. > > Any idea? > Thanks > Taral Shah > > Experience is what you get when you were expecting something else. > > ----- Original Message ----- > From: "Mike Jackson" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <[EMAIL PROTECTED]>; > "Taral Shah" <[EMAIL PROTECTED]> > Sent: Friday, August 16, 2002 10:53 PM > Subject: RE: Persistent Connection > > > "TIME_WAIT" is something the tcp/ip stack does; it doesn't > have anything to do with Tomcat per say. What happens (as I > understand it) is that once your app has closed the > connection (page is done or whatever), the stack will hold > the connection in a "TIME_WAIT" state to prevent the other > end, the client, from reconnecting to the same port. > > So the problem isn't really tomcat, its the TCP/IP stack. > However I've also found that under unix if you're using > apache+tomcat you don't have a ton of TIME_WAIT sockets on > the webserver. Apache apparently sets a parameter to > eliminate the TIME_WAIT sockets, either on close or on open > of the socket (I don't know which). So what you might want > to do is run IIS or Apache in front of tomcat. I don't know > that IIS does the same thing as Apache in regards to the > sockets, but if it does then it'll work nearly as well in > front of tomcat. But there is a slight problem here as well, > you need to be sure that you're using APJ13 not APJ12 as > APJ12 will open a new connection for each web access that > tomcat handles. And in that casey you'd get more TIME_WAIT > sockets. APJ13 multiplexes the requests over one persistent > socket, so you don't have the extra overhead of opening the > socket on each request, or the TIME_WAIT socket lingering > there for some time period. > > Also, just as a FYI, under unix you can change the TIME_WAIT > time period but it's not recommended that you do so. The > default time period is about 4 minutes as I recall. You can > probably also change it under windows, but I wouldn't have a > clue how to do that. > > --mikej > -=----- > mike jackson > [EMAIL PROTECTED] > > > -----Original Message----- > > From: Taral Shah [mailto:[EMAIL PROTECTED]] > > Sent: Friday, August 16, 2002 2:40 AM > > To: Tomcat Users List > > Subject: Persistent Connection > > > > > > I am using tomcat 3.3 > > > > Now I am calling one jsp which loads an applet, internally > that applet > > uses url connection to fetch data. > > Now problem is that when i check with netstat application(its > > inbuilt in win > > nt, run through netstat -n) > > I came to know tomcat opens no of connections and keep them > in TIME_WAIT > > mode. > > > > This is happening with simple jsps as well as with servlet. > For each > > request it opens around 2/3(depending on the no of jsps included) > > connection with <host-ip>:8080 port. These all are of tcp type > > connections. I read in some of materials that in Http 1.1, as > > persistent connection is used so it keeps the connection > open unless I > > specify them to close. > > > > I wrote in my code as response.setHeader("Connection", > "close"); but > > still the no of open connection increases. In my > application if hits > > are many then it reaches to thousands. > > > > Has any one seen this before(I think this is for all tomcat-You can > > check with netstat). Has any one explicitly closed the connection > > through header or is there any > > way to specify in tocat configuration so it does not keep > the connection > > open. > > > > Thanks > > > > Taral Shah > > Experience is what you get when you were expecting something else. > > > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
