Solution to the long running query problem in a web application (asynchronous request)

后端 未结 4 1420
忘了有多久
忘了有多久 2020-12-28 22:51

Here is the problem

A user of an enterprise web application is performing a task that results in a long (very long) database query (or other long processing intensiv

4条回答
  •  星月不相逢
    2020-12-28 23:52

    How long running are these queries?

    If you're talking about sessions expiring, perhaps it's best for the user not to be waiting around for it. It will always be annoying for the user to wait 20 minutes peaking every so often in that query's tab.

    So, if really long queries are the case, perhaps it's best to change the UI approach and have the user "order" a query that he (she) later comes back to view, or is even notified by mail when it's ready.

    In such a case I'd have the query prepared in the DB and cached, in a separate table, there. Meaning, I'd have the web server work once to register the request, have a DB task or a separate process/server prepare queries upon requests and notify the user, and then have the web server display them when the user comes back for the results.

提交回复
热议问题