5

Our front-end MVC3 web application is using AsyncController, because each of our instances is servicing many hundreds of long-running, IO bound processes.

Since Azure will terminate "inactive" http sessions after some pre-determined interval (which seems to vary depending up on what website you read), how can we keep the connections alive?

Our clients MUST stay connected, and our processes will run from 30 seconds to 5 minutes or more. How can we keep the client connected/alive? I initially thought of having a timeout on the Async method, and just hitting the Response object with a few bytes of output, sort of like chunking the response, and then going back and waiting some more. However, I don't think this will work, since MVC3 is handling the hookup of an IIS thread back to the asynchronous response, which will have already rendered a view at that time.

How can we run a really long process on an AsyncController, but have the client not be disconnected by the Azure Load Balancer? Sending an immediate response to the caller, and asking that caller to poll or check another resource URL is not acceptable.

Pittsburgh DBA
  • 6,672
  • 2
  • 39
  • 68

1 Answers1

5

Azure load balancer idle time-out is 4 minutes. Can you try to configure TCP keep-alive on the client side for less than 4 minutes, that should keep the connection alive?

On the other hand, it's pretty expensive to keep a connection open per client for a long time. This will limit the number of clients you can handle per server. Also, I think IIS may still decide to close a connection regardless of keep-alives if it thinks it need the connection to serve other requests.

Sami
  • 570
  • 1
  • 4
  • 11
  • This is for server-to-server API transactions. Most of the clients have older software that just performs an HTTP GET/PUT/POST/DELETE and waits on the response. If I can't get more than 4 minutes, that is an issue. – Pittsburgh DBA Sep 22 '12 at 21:37
  • 1
    I thought the load balancer terminated idle connections after 60 seconds. Did it changed recently? – user94559 Sep 23 '12 at 01:19
  • I made an experiment where my server sleeps specified number of seconds and then returns a reply. With less than 4 minutes of sleep, the client gets a reply. With more than 4 minutes, the client never gets the reply. That said, the 4 minutes is probably subject to change... – Sami Sep 23 '12 at 07:20
  • @smarx, the LB idle timeout has changed, I think with the June release (or ever earlier). Check the update on that post: http://blogs.msdn.com/b/avkashchauhan/archive/2011/11/12/windows-azure-load-balancer-timeout-details.aspx – astaykov Sep 27 '12 at 11:22
  • I've found this to be an issue as well for a legacy webforms application. Any solution for easily keeping a webforms postback active past the load balancer timeout? – Timothy Lee Russell Apr 15 '14 at 03:58