4

I have a nodejs program that connects to cloudstack apis. Creating a Virtual Machine on cloudstack takes almost 20 secs.

The program works fine on my local nodejs installation and also on apigee cloud. However when I deploy the same on customer's OPDK, Nginx returns a 502 - Bad gateway. This link http://www.nginxtips.com/502-bad-gateway-using-nginx/ recommends increasing the buffer and timeout sizes in nginx.conf

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

What is the recommended ideal value? What is it on Apigee cloud?

Regards, Girish

1
  • Node is not a CGI program — perhaps you are looking to configure nginx as a reverse proxy to a nodejs backend? Commented Feb 24, 2014 at 19:07

1 Answer 1

11

You may need to look at the proxy timeout configs in nginx if using nginx as a proxy:

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

 proxy_connect_timeout       60;
 proxy_read_timeout          120;

Apigee timeout defaults:

Connect timeout - 60s - connect.timeout.millis
Read timeout - 120s - io.timeout.millis

FYI Apigee timeouts are also configurable (in milliseconds) within the TargetEndpoint connection:

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

Depending on how long the server takes to respond can determine your ideal timeout configurations. In this case, a read timeout of 45-60s might be ideal to provide some buffer in case cloudstack slows down more.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.