Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to set "EndpointTimeoutInSeconds" for an APP separately? #100

Closed
Liuyanglong opened this issue Oct 22, 2015 · 8 comments
Closed

Comments

@Liuyanglong
Copy link

In the gorouter config, there is a param "EndpointTimeoutInSeconds", the default is 60s, it means when a request over 60 secends the connection will close.

Is there a way to set this parameter for an APP separately?
I have 2 app, "a.com" & "b.com" , I want to set EndpointTimeoutInSeconds=120s for app "a.com" and set "EndpointTimeoutInSeconds=60s" for app "b.com". But “EndpointTimeoutInSeconds” is global for all apps.

I need some help. Thank you

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/106275206.

@Liuyanglong Liuyanglong changed the title Can we set 'EndpointTimeoutInSeconds' by app? Is there a way to set "EndpointTimeoutInSeconds" for an APP separately? Oct 22, 2015
@shalako
Copy link
Contributor

shalako commented Oct 24, 2015

Hello @Liuyanglong, as you observed it is not currently possible to configure the request timeout per app. It's worth considering that in order to keep the routing tier generic, Gorouter doesn't know anything about apps in Cloud Foundry. It only knows about routes - the mapping of a url to a backend ip and port.

Could you please explain why setting the global property request_timeout_in_seconds: 120 doesn't work for you? Couldn't app "b.com" simply close the connection itself after 60s?

We could consider enhancing Gorouter to support clients registering these routes (via NATS now, via Routing API in the future) to provide a timeout for each route, but exposing this to Cloud Foundry end users would require significant updates: CLI, Cloud Controller, CC-bridge, Route Emitter, and Gorouter.

I recommend:

  1. configure request_timeout_in_seconds to accomodate all apps
  2. improve apps to respond more quickly

I've made a note of your request and will listen for the same request from others in the future.

Thank you!

@Liuyanglong
Copy link
Author

I have two apps,“a.com” and "b.com", a.com is normal http request, the endpoint will return in few seconds.but b.com is upload big file request, the endpoint will take more than 100s to finish processing a request.

Now I want only set EndpointTimeoutInSeconds=300s to b.com.

And when I set EndpointTimeoutInSeconds=300s, after several hours , I receive a error "502 Bad Gateway: Registered endpoint failed to handle the request." when I request a.com and b.com. Is this a bug? Or how should I solve this error.

Thank you.

@shalako
Copy link
Contributor

shalako commented Oct 26, 2015

Changes to EndpointTimeoutInSeconds are ephemeral. To have your changes persist, use the BOSH manifest property called request_timeout_in_seconds: https://github.com/cloudfoundry/cf-release/blob/master/jobs/gorouter/spec#L105

The default for request_timeout_in_seconds is 15 minutes. This is what we use in production, and accommodates larger uploads. You can raise this timeout even higher, or consider having your apps support multi-part uploads.

Could you provide more information about the environment in which you observed the 502? This response is returned when the backend failed to respond. However, this error should be returned immediately after the timeout, not hours later.

Possibilities:

  • your app failed to respond because it is down or failing, or there is high latency in the network
  • your app moved to another container and routing table has not been updated (is NATS down?)
  • the router closed the connection after the timeout but your client didn't report the error promptly

Could you provide us with steps to reliably reproduce the issue?

@Liuyanglong
Copy link
Author

I only use gorouter as my router tool. Behind gorouter is docker container and manual update the rules。If I do not any operation to "EndpointTimeoutInSeconds", after 60s, the connection will be closed by Gorouter.

About the 502 error, the information I get is only these "502 Bad Gateway: Registered endpoint failed to handle the request" when I request the app and there is no any log in app containers, but after I restart Gorouter , the requests went OK. so I am sure its Gorouter report the 502error.

Thank you

@shalako
Copy link
Contributor

shalako commented Oct 27, 2015

If I do not any operation to "EndpointTimeoutInSeconds", after 60s, the connection will be closed by Gorouter.

This is expected behavior, as 60s is the default value.

"502 Bad Gateway: Registered endpoint failed to handle the request" when I request the app

Gorouter returns this error when a backend (your docker container) fails to respond within the timeout. The timeout can be manually configured using endpoint_timeout in config.yml (restart required), however if the vm is recreated, this change will be lost. We do not recommend operating gorouter this way.

For more information, you can enable debug level logging for gorouter in the config.yml. A restart is required.

after I restart Gorouter , the requests went OK. so I am sure its Gorouter report the 502error.

When gorouter starts the first time, are requests routed to your app successfully? Are you saying that after some period of time of healthy operation, requests to the app begin returning this 502 error? And then restarting gorouter results in requests being routed successfully?

Is the ip or port of your docker container changing, and gorouter isn't being updated?

@markstgodard
Copy link
Contributor

Hi @Liuyanglong

As per @shalako above, can you clarify the last few questions?

  • On gorouter startup, are requests routed to the app successfully?
  • Is there a period of time that goes by and then requests to app are getting 502 error?
  • Does restarting gorouter fix the issue?
  • Is the IP or port of the docker container changing and gorouter not being updated?

How are routes being registered with gorouter ?

Can you check the gorouter routing table and seeing if the route is expiring (and being removed)?

For example, when running gorouter locally using bosh-lite, you can hit the status endpoint to dump the routes.
i.e. curl http://router:router@10.244.0.22:8080/routes

Thanks

@shalako
Copy link
Contributor

shalako commented Mar 21, 2016

Hello @Liuyanglong
As we haven't heard back from you, we'll close this issue. Feel free to re-open if you have a chance to reply.
Thank you!

@shalako shalako closed this as completed Mar 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants