"PATIBANDA, SRIKANTH" wrote:
> hi,
>
> I have question regarding same thing that u guys are discussing.
> I know servlets are multithreaded by default.
>
> Scenario 1:(the request is trying to retrieve 5 rows out of some 500,000
> rows in the database.)
>
> lets say a user sends dopost request to servlet.. a thread is created..
> and user is waiting for a response.... Meanwhile user clicked the stop
> button
> on the browser...(I mention here its the browser button) it means from
> the user side the request has been cancelled..
>
> But if you check the JavaWebServer, the thread is still hanging out
> there...
>
That is because the server has no idea that the user pressed STOP. That's the
way that HTTP works, I'm afraid.
>
> (you can know whether this thread is still going on or not at
> admin applet-->manage-->monitor-->resourceusage-->start view
> you can see under handler threads total---> avaialble...)
>
> my question comes here.. when does this thread die... or it will be there
> till it completes
> the request...
> or
> is there any other way to kill this thread...
>
If there were, it would be in the admin screens you are looking at, or
documented in the manual. I would be surprised to find such a thing, however,
because it's hard for a general purpose application like a servlet engine to
know what resources might get left locked if you just killed the thread.
>
> Reason for this to be killed or stopped is: it slowing the javawebserver
> drastically. I can not make another request
> till this thread dies or stops.
>
This sounds like one or more of the following things is going on:
* If performance slows down a bunch but doesn't stop, you
are probably searching your database on a column that is
not indexed, so the database is forced to read all 500,000
rows to get the answer you are looking for. The solution is
to build indexes on the columns you need, or adjust your
query criteria to use columns that are already indexed.
* If performance stops, one possible cause is that you're
waiting on database locks triggered by the transactions
being performed by other users (whether or not it is through
your servlet app). Check the transaction isolation setting
you are using on your JDBC connection, and check your
databases's docs for the circumstances under which it might
lock rows or tables (usually triggered by modifications being
performed by some other user).
* If database locks is not doing it, another common problem is
if you are using "synchronized" locks somewhere in your servlet,
or in the code that it calls (such as the JDBC driver). If two
requests need to execute the same synchronized method
(or code fragments synchronized on the same object), the
second one will wait for the first one to finish. Check your
application logic for cases where this might be happening.
>
> please help me out with this...
>
> -srikanth patibanda
>
Craig McClanahan
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html