Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

priorities in Servlet 2.3

 
Sundar Gopal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a servlet which will take atleast 5 mins to complete the service() method(imagine) due to some complex EIS query. i need to know one thing that if i set my session timeout period to say 1 minute and i enter the servlet what priority i will be getting. that is since i am yet to get the response from the server, my session will be active or since the time taken to cater my request takes more than the session time out interval, so my session will be getting invalidated.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to know one thing that if i set my session timeout period to say 1 minute and i enter the servlet what priority i will be getting.

Session timeout has nothing whatsoever to do with Thread priority. Why would you want such a short timeout?
There have been a LARGE number of discussions here about how to handle time consuming queries gracefully in servlets - browse around in the last few weeks of posts.
Bill
 
Siyaa Hoffman
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there some way that the results of your long query can be cached locally ?

In that case, you can load the servlet on start-up and the data from the long query can be cached locally so that the subsequent requests read it from the cache and do not take that long.

Also, see the following URL -
http://www.javaranch.com/newsletter/200403/AsynchronousProcessingFromServlets.html
[ June 04, 2004: Message edited by: Siyaa Hoffman ]
 
Sundar Gopal
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your response. actually the query takes nearly 45 mins to complete and its differs according to the user. will it be possible to cache that all!!! thats why i need to know about the session timeout priorities. kindly help me if u have any suggestion to increase the query performance.
:roll:
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
45 minutes is WAAYYYYY too long for a single request/response cycle and if the result is huge, storing it in the session is not appropriate. You will need to conduct the query in a separate Thread - maybe even a separate process, and provide some key in the session, or maybe in a longer-lived cookie for the user to retrieve the result later.
What format is the result in?
Bill
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yah. Don't mistake the user's browser for a client/server client program. Web browsers are "hit-and-run". The user has no real idea what is happening when they hit Submit and nothing comes back for minutes at a time. For all they know, the server crashed.

I have a project where the backend can take literally hours. Among other things, this was holding the entire Tomcat server for ransom when I ran it in the Tomcat JVM. If some other process went south, we couldn't restart Tomcat without killing the backend engine as a side-effect.

Finally ended up making the engine a separate application altogether and used RMI from Tomcat to invoke it and query for run status.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic