java - Prevent session timeout during database update -
background
a web application calls stored procedure perform intensive database update. relevant portion of web.xml
updated 4 hours:
<session-config> <session-timeout>240</session-timeout> </session-config>
the technologies available solution include java 1.4.2, struts 2, tomcat 5.5, , apache commons. other technologies (such jquery) not permitted.
problem
the update takes hour run, configuration value of 4 hours against corporate standards (for reason). 4 hour timeout configuration not permitted in production.
question
what ensure request not time out while database update executes?
ideas
my concern in first 2 cases spawned process killed servlet container.
page refresh
- spawn database update process background task.
- have servlet continually refresh page check completion.
javascript ping
- spawn database update process background task.
- have javascript code ping server while.
similar preventing session timeout during long processing time in jsf, without jquery.
update server
write simple server listens requests:
- the servlet sends request listener.
- the listener runs update.
since server runs independently of tomcat, session timeout cannot occur. database update run completion without being killed. has numerous issues (error handling not least of concern) , option of last resort.
optimization
optimizing query finish in under 30 minutes (the maximum permitted timeout) possible, query cannot optimized sufficiently.
hardware
upgrading database hardware not option, unfortunately.
many thanks!
in opinion, no user want sit in front of screen monitoring background job 4 hours. few years ago, had implement report generation took hours. implemented solution following:
- generate report in background thread. thread monitored , available via application context list. thread contained information owner , progress.
- users can list own threads , see progress.
- upon completion report thread store report offline access, send email notification owner link download generated report.
Comments
Post a Comment