user627283
user627283

Reputation: 553

IIS Long operation request and performance issue

just wondering if I have a webpage that generates a pdf, but could take a while to generate due to long sql request and number of data to insert and tread before generating pdf. If the request hasn't finished yet and the user seeing that nothing happened clicks again on button and again and again. What will happen in my web application and in the database? Is it going to wait for previous request to be finished before throwing another one? Does it accept multiple requests per session? Is my web application going to freeze? Is my database going to performe multiple sql request at the same time from same user? Is my sql server going to freeze?

I know I should not leave it like that and make the button unclickable and put a little message "Please wait" but I'm just interested in what would happen in that situation.

Sorry for bad english! Thanks!

Upvotes: 1

Views: 901

Answers (1)

Joe Enzminger
Joe Enzminger

Reputation: 11190

Check out this answer: Problem with IHttpAsyncHandler and ASP.NET "Requests Executing" counter for an technical viewpoint.

You had a number of questions:

If the request hasn't finished yet and the user seeing that nothing happened clicks again on button and again and again?

In this case, multiple requests will be queued on your web server, and they will all be processed. This will affect performance. As you mentioned, your UI should prevent this by disabling the button and giving the user some feedback that the request is being processed.

What will happen in my web application and in the database? Is it going to wait for previous request to be finished before throwing another one?

No. Unless you are locking on a single resource in your database, each request will be handled by a separate worker in IIS. There are limits to the number of concurrent requests, but generally, things will happen in parallel. If the work you are doing is CPU intensive, there could be some contention for CPU resources and overall performance will suffer. You should definitely look in to the AsyncHandler model.

Does it accept multiple requests per session?

Yes

Is my web application going to freeze?

Freeze might be the wrong word. It is possible that the queue for requests will grow large if requests are coming in at a rate faster than the web server can fulfill them. If this happens, it will appear to users that your web server is unresponsive or slow.

Is my database going to performe multiple sql request at the same time from same user?

It might.

Is my sql server going to freeze?

Same as above. If your SQL Server cannot process requests faster than they are coming in, it may appear to your users that your application is unresponsive.

Upvotes: 2

Related Questions