【问题标题】:Azure HTTP request timeout workaroundAzure HTTP 请求超时解决方法
【发布时间】:2013-09-11 17:34:33
【问题描述】:

我们目前在 Azure VM 实例上托管了一个应用程序。

此应用程序有时会处理长时间运行和空闲的 HTTP 请求。这会导致问题,因为 Azure 将关闭所有空闲时间超过几分钟的连接

我看到了一些关于设置较低 TCP 保持连接率的建议。我已经尝试过setting the this rate to around 45 seconds,但我的 HTTP 请求仍然被关闭。

有什么建议吗?我们的虚拟机正在运行 Server 2008 R2。

【问题讨论】:

标签: azure tcp virtual-machine windows-server-2008-r2


【解决方案1】:

作为一种简单的解决方法,我让我的脚本每 5 秒左右发送一个换行符以保持连接有效。

例子:

set_time_limit(60 * 30);
ini_set("zlib.output_compression", 0);
ini_set("implicit_flush", 1);

function flushBuffers()
{
    @ob_end_flush();
    @ob_flush();
    @flush();
    @ob_start();
}

function azureWorkaround($char = "\n")
{
    echo $char;
    flushBuffers();
}

$html = '';
$employees = getEmployees();
foreach($employee in $employees) {
    html .= getReportHtmlForEmployee($employee);
    azureWorkaround();
}

echo $html;

【讨论】:

  • 你能提供一些代码来展示你是如何做到的吗?
  • 已更新示例。
【解决方案2】:

Azure 负载均衡器现在支持为您的云服务和虚拟机配置 TCP 空闲超时。可以使用服务管理 API、PowerShell 或服务模型来配置此功能。

欲了解更多信息,请查看http://azure.microsoft.com/blog/2014/08/14/new-configurable-idle-timeout-for-azure-load-balancer/的公告

【讨论】:

  • 如何找到我的 wcf 在 azure 中托管的位置? (云服务或虚拟机)
  • 我可以为应用服务配置 tcp 空闲超时吗(我在使用 appservices 的 webapp 中托管了 wcf)?
猜你喜欢
  • 1970-01-01
  • 2019-04-01
  • 2013-10-02
  • 1970-01-01
  • 2021-10-07
  • 2013-06-28
  • 2019-11-23
  • 2011-11-05
相关资源
最近更新 更多