Azure HTTP timeouts

An avid reader of my blog pointed me towards this post, which suggests that Azure will time out your incoming requests after a minute.

I constructed a quick test in MVC, which would block the server for a number of miliseconds before returning:

public ActionResult Index(int duration)
{
    System.Threading.Thread.Sleep(duration);
    return Content(string.Format("Response after {0}ms wait", duration));
}

I passed in variety of durations, and found that anything under 4 minutes (240000 ms) worked, and over 4 minutes didn’t.

Trying the same test with IE on the VM (using the local ip address) and thus not going through the load balancer resulted in much higher times I didn’t have the patience to find out exactly how long.

We can conclude that something in the Azure infrastructure (like the firewall or load balancer) is terminating HTTP requests after 4 minutes (my reader confirms this too).

It’s not uncommon for network infrastructure (which could be anywhere between you and the cloud) to terminate HTTP connections after 1 minute or 2, so your code shouldn’t try and block for this long anyway.

About these ads