Clint Davis
Clint Davis

Reputation: 451

ASP.NET Long Task Hangs Other Pages?

I'm generating reports on the fly using the great SpreadSheetGear tool. At first things were great because the reports were simple and done in under 1 second. Now I'm at more complex reports and they are taking about 30 seconds up to 1 minute. This isn't a problem, we just throw up an activity image and let the user wait, fine by us.

The problem I've found is when two users come to the site.

  1. User 1 comes to the site
  2. User 1 runs a report that takes 30 seconds.
  3. User 2 comes to the site
  4. User 2 waits until user 1 report is done then the page loads.

The report running for User 1 hangs up the site until it's done. What is going on and how can I fix this?

Upvotes: 2

Views: 265

Answers (2)

DaveB
DaveB

Reputation: 9530

How often does the report data change? If for example you were using SQL Server, you could have a stored procedure to create the report data to a table and have the stored procedure run as a SQL Server Agent job. Set the job to run a frequently as you want the data updated. This should speed up your pages considerably.

Sounds like you may have both requests on the same thread?

Upvotes: 0

Fredrik Mörk
Fredrik Mörk

Reputation: 158309

You don't share any details on what the code looks like, but it sounds like you should look into making asynchronous pages. In short the trick is to move heavy work off the threads from the thread pool, which is used to serve page requests. By moving the heavy work to other threads, the thread pool thread can be returned to the pool quickly in order to serve other incoming requests.

Then it's more a matter of how much work the machine producing the reports can take.

Upvotes: 2

Related Questions