A query is taking more than a minute to retrieve the data (Due to larger volume of data) from the database.
I need to stop its execution.
I know that, we can set "timeout" attribute in the select tag (For a single query alone) or "defaultStatementTimeout" attribute in settings tag (SqlMapConfig.xml - For all the query) to forcibly terminate the query in execution.
By doing the above configuration, IBatis will throw "User cancelled request" error and terminates the execution.
Do we have any other way to terminate the execution?
When user requests for 3 years data, it takes more than a minute to fetch data from the database.
In the meantime, when the user requests for 1 day's data or sends a "cancel" request, I have to forcibly terminate the previous execution (3 years data retrieval) because it is affecting performance even with limited number of users.
NOTE I didn't used any of the setting above.
Please provide me solution for this.
Thanks in advance .
You should probably limit the number of concurrent requests for large amounts of data somehow (maybe down to one at a time?). Cancelling a request that has already processed substantial amount of data just because another request has arrived is a big waste of resources. The "small" requests should then be allowed alongside the "big" one(s), it will perhaps take longer, but so what - if someone needs to process such requests, the system must be sized up properly.
If you have a single application server, you could probably implement it easily there. If you have a more distributed application, you might use some database concurrency/locking mechanism for that.