2

If a website is taking more than 10 seconds to process and load of a page, Internet Explorer will do a connection timeout. It is possible for the user to prevent this by setting the default value in the registry to a higher value.

But I really can't tell any of my clients to do this; so how do I prevent this to happen in the first place?

I have always learned not to use a buffer and flush it, cause this will make the calculation of the data slower. Another problem with this, is that all the calculation is being done first and put into a multidimensional array, which finally is posted with response.write. I dont think, that the buffer flush can do anything about this?

MicBehrens
  • 1,780
  • 8
  • 34
  • 57

1 Answers1

2

I dont think, that the buffer flush can do anything about this?

Yes it can:

Internet Explorer error "connection timed out" when server does not respond:

Internet Explorer imposes a time-out limit for the server to return data. By default, the time-out limit is as follows: Internet Explorer 5 to 8: 60 minutes

It seems the timeout you're referring to might be incorrectly set by a different application, as described in this question.

If a page does not return within a few minutes, many users perceive that a problem has occurred, and they stop the process. Therefore, you should design your server processes to return data within approximately five minutes so that users do not have to wait for a long time.

The KB article also states:

You can usually break down long processes into smaller pieces. Or, the server can return status data to update users about the process. In addition, you can create a long server process that has a messages-based or asynchronous approach so that it returns immediately to the user after the job is submitted, and then notifies the user after the long process is finished.

So you should flush data to the client, so it knows the server is still alive.

I have always learned not to use a buffer and flush it, cause this will make the calculation of the data slower.

Please show sources for claims like this. Of course it will make the calculation slower, but most probably not significantly.

I like the approach suggested in the KB article. Let your server return immediately, while you enqueue the long running operation. The client can then poll about the progress of the operation, so it won't timeout.

Community
  • 1
  • 1
CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • For the claim of flushing slowes the application, please see AnthonyWJones' answer in http://stackoverflow.com/questions/8939431/triple-inner-join-with-over-10-000-rows-and-asp-calculations-stalls-application – MicBehrens Nov 08 '12 at 14:05
  • And for the solution, you would suggest making a flush when the calculation is ex. 10, 20, 30, 40, 50, 60, 70, 80, 90 and 100% complete? – MicBehrens Nov 08 '12 at 14:31
  • @erizias while it may be true that `Response.Flush()` waits for the network packets to be acknowledged, this may take mere miliseconds when you're not sending massive amounts of data, which is irrelevant on a processing time that exceeds ten seconds. But I still stronly advise on the queuing, because clients don't like waiting that long for a web page to load. – CodeCaster Nov 08 '12 at 14:39