tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Baktiar <dbakt...@gmail.com>
Subject Re: please help me how i can test that whether tomcat is up and running on
Date Thu, 22 Sep 2011 17:03:00 GMT
Hi Vishveswara,

If you look at the behavior of ServerSocket, or any BSD-like listening
server socket in general, there is something called 'backlog'.
http://download.oracle.com/javase/1.4.2/docs/api/java/net/ServerSocket.html

In short, backlog is something like a queue, if all your worker thread
occupied, the listening server socket is allowed to hold and queue n number
of connecting socket. Only when the all threads occupied and backlog full
then you will get "connection refused". The connection socket in the backlog
is silently accepted but not served yet. If the connection socket was held
in the backlog for quite some time (e.g. due to existing worker threads
still busy), until it is time out for the connection client socket, then
that what you have said may occur: the Tomcat is up and running, yet the
connection client socket  java.net.ConnectException: Connection timeout:
connect.

So, what you can detect by a connection client socket is not "whether Tomcat
is up and running", instead "whether Tomcat is up and running and able to
accept and process one more client socket within the client time out
interval". There are cases where "Tomcat is up and running" but "is not able
to accept and process one more client socket within the client time out
interval" (which is the case when "java.net.ConnectException: Connection
timeout: connect" happens).

There is an "acceptCount" attribute in server.xml <Connector /> which
specifies the backlog. If you set this to 0, it may behave the way you want,
but you have to test yourself whether that will be good for the system
behaviour and performance from the user point of view.

---
daniel baktiar

On Thu, Sep 22, 2011 at 18:30, vishveswara chary varanasi <
vvchary.varanasi@gmail.com> wrote:

> Tomcat community has a wiki which providded the
>
> http://wiki.apache.org/tomcat/HowTo#How_do_I_check_whether_Tomcat_is_UP_or_DOWN.3F_There_is_no_status_command
>
> i have tried to connect to tomcat using sockect connection on the port
> where the tomcat running
>
>  Socket socket = new Socket("hostname", port);
>
> this works some time and some time even if the tomcat is up and
> runnning this is throwing the java.net.ConnectException: Connection
> timed out: connect.
>
> please help me how i can test that whether tomcat is up and running on
> a remote machine from a client machine.
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message