简体   繁体   English

Azure Web角色-长时间运行的请求(负载均衡器超时?)

[英]Azure Web Role - Long Running Request (Load Balancer Timeout?)

Our front-end MVC3 web application is using AsyncController, because each of our instances is servicing many hundreds of long-running, IO bound processes. 我们的前端MVC3 Web应用程序正在使用AsyncController,因为我们的每个实例都在为数百个长时间运行的IO绑定进程提供服务。

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? 由于Azure将在预定的时间间隔后终止“无效”的HTTP会话(该时间间隔似乎取决于您所阅读的网站),我们如何才能保持连接的活动状态?

Our clients MUST stay connected, and our processes will run from 30 seconds to 5 minutes or more. 我们的客户必须保持联系,我们的流程将耗时30秒到5分钟或更长时间。 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. 我最初想到的是在Async方法上超时,然后用几个字节的输出命中Response对象,有点像对响应进行分块,然后返回并等待更多。 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. 但是,我认为这行不通,因为MVC3正在将IIS线程的连接处理回到异步响应,该响应在那时已经呈现了一个视图。

How can we run a really long process on an AsyncController, but have the client not be disconnected by the Azure Load Balancer? 我们如何在AsyncController上运行一个很长的过程,但是客户端没有被Azure负载均衡器断开连接? Sending an immediate response to the caller, and asking that caller to poll or check another resource URL is not acceptable. 向呼叫者发送立即响应,并要求该呼叫者轮询或检查另一个资源URL是不可接受的。

Azure load balancer idle time-out is 4 minutes. Azure负载平衡器的空闲超时为4分钟。 Can you try to configure TCP keep-alive on the client side for less than 4 minutes, that should keep the connection alive? 您是否可以尝试在客户端上配置TCP保持活动状态少于4分钟,从而使连接保持活动状态?

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. 此外,我认为如果IIS认为需要连接来满足其他请求,则无论保持连接状态如何,它仍可能决定关闭连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM