Prevent session timeout during database update

后端 未结 2 1394
囚心锁ツ
囚心锁ツ 2021-02-20 16:06

Background

A web application calls a stored procedure to perform an intensive database update. The relevant portion of web.xml was updated to four hours:<

相关标签:
2条回答
  • 2021-02-20 16:37

    By reading the abvoe , i can ensure you have two options even though second one is difficult, its the best proces

    1) Page Refresh

    1. Spawn the database update process as a background task.
    2. Have a Servlet continually refresh the page to check for completion.

    2) Optimization

    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.

    0 讨论(0)
  • 2021-02-20 16:46

    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:

    • Generate the report in a background thread. The thread was monitored and available via application context List. The thread contained information about the owner and their progress.
    • Users can list their own threads and see progress.
    • Upon completion the report thread would store the report for offline access, send an email notification to owner with a link to download the generated report.
    0 讨论(0)
提交回复
热议问题