【问题标题】:Increase buffer timeout size on nginx增加 nginx 上的缓冲区超时大小
【发布时间】:2014-03-26 12:41:14
【问题描述】:

我有一个连接到 cloudstack api 的 nodejs 程序。在 cloudstack 上创建虚拟机大约需要 20 秒。

该程序在我的本地 nodejs 安装以及 apigee 云上运行良好。但是,当我在客户的 OPDK 上部署相同的内容时,Nginx 返回 502 - Bad gateway。 此链接http://www.nginxtips.com/502-bad-gateway-using-nginx/ 建议增加 nginx.conf 中的缓冲区和超时大小

http {
...
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
...
}

推荐的理想值是多少? Apigee 云上有什么?

问候,吉里什

【问题讨论】:

  • Node 不是 CGI 程序——也许您希望将 nginx 配置为 nodejs 后端的反向代理?

标签: node.js nginx apigee


【解决方案1】:

如果使用 nginx 作为代理,您可能需要查看 nginx 中的代理超时配置:

http://www.nginxtips.com/504-gateway-time-out-using-nginx/
http://wiki.nginx.org/HttpProxyModule

 proxy_connect_timeout       60;
 proxy_read_timeout          120;

Apigee 超时默认值:

连接超时 - 60s - connect.timeout.millis
读取超时 - 120s - io.timeout.millis

仅供参考 Apigee 超时也可在 TargetEndpoint 连接中配置(以毫秒为单位):

<HTTPTargetConnection>
    <Properties>
        <Property name="connect.timeout.millis">5000</Property>
        <Property name="io.timeout.millis">5000</Property>
    </Properties>
    <URL>http://www.google.com</URL>
</HTTPTargetConnection>

根据服务器响应所需的时间可以确定您理想的超时配置。在这种情况下,45-60 秒的读取超时可能是理想的,以提供一些缓冲区,以防 cloudstack 更慢。

【讨论】:

    猜你喜欢
    • 2019-08-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-15
    • 1970-01-01
    相关资源
    最近更新 更多