A web application calls a stored procedure to perform an intensive database update. The relevant portion of web.xml
was updated to four hours:
<session-config>
<session-timeout>240</session-timeout>
</session-config>
The technologies available for the solution include Java 1.4.2, Struts 2, Tomcat 5.5, and Apache commons. Most other technologies (such as jQuery) are not permitted.
The update takes about an hour to run, however a configuration value of four hours is against corporate standards (for good reason). A four hour timeout configuration is not permitted in production.
What will ensure that the request does not time out while the database update executes?
My concern in the first two cases is that the spawned process will eventually be killed by Servlet container.
Similar to Preventing session timeout during long processing time in JSF, but without jQuery.
Write a simple server that listens for requests:
Since the server runs independently of Tomcat, the session timeout cannot occur. The database update will run to completion without being killed. This has numerous issues (error handling not the least of my concern) and is likely the option of last resort.
Optimizing the query to finish in under 30 minutes (the maximum permitted timeout) is possible, but it is likely the query cannot be optimized sufficiently.
Upgrading the database hardware is not an option, unfortunately.
Many thanks!
In my opinion, no user would want to sit in front of screen monitoring a background job for 4 hours. Few years ago, I had to implement report generation which took hours. the implemented solution was the following: