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

Fix Resty logging, timeout and retry configuration #28

Merged
merged 1 commit into from
Jun 17, 2019

Conversation

anandswaminathan
Copy link
Contributor

@anandswaminathan anandswaminathan commented Jun 14, 2019

  • Fixes the incorrect logging from Resty library.
  • Removes retry from Patch and Post requests, as Flink POST request is not idempotent.
  • Separate timeout for Get vs Post request.

Sample logs in json format:

{"json":{"app_name":"taskfailurejob","ns":"default","phase":"SubmittingJob","src":"api.go:147"},"level":"info","msg":"RESTY 2019/06/14 13:48:18 ERROR Get http://localhost:8001/api/v1/namespaces/default/services/taskfailurejob-949b65b0:8081/proxy/overview: dial tcp [::1]:8001: connect: connection refused, Attempt 3","ts":"2019-06-14T13:48:18-07:00"}
{"json":{"app_name":"taskfailurejob","ns":"default","phase":"SubmittingJob","src":"api.go:147"},"level":"info","msg":"RESTY 2019/06/14 13:48:18 ERROR Get http://localhost:8001/api/v1/namespaces/flink-operator/services/wordcount-operator-example-c931dcc2:8081/proxy/overview: dial tcp [::1]:8001: connect: connection refused, Attempt 3","ts":"2019-06-14T13:48:18-07:00"}

var resp *resty.Response
var err error
if method == httpGet {
resp, err = c.client.R().Get(url)
client.SetTimeout(httpGetTimeOut).SetRetryCount(retryCount)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiosity, why two separate timeouts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More discussion here: #9

Main reason is this is a blocking call, and Get calls generally finishes in milliseconds. It's only the POST request in Flink which causes issues under low CPU, and POST is not idempotent.

Problem with using the same timeout for Get calls (like 1 minute timeout) is when the cluster is starting, and pods are not ready, all the requests are going timeout as there is no job manager to serve the requests. This will just keep all the workers blocked. It is better to give up, and poll in the next resync period.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks for the context :) The difference in timeouts makes sense. Given that this would depend on some cluster specific resources, should we make this configurable (with some sensible defaults as you have here) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glaksh100 Its actually the other way. You will have all kinds of behavior based in application configuration/resources. Intention is to get to a value which would not affect the cycles of the operator. Also if there is a better number for timeout it’s better to find and set that value.

@mwylde
Copy link
Contributor

mwylde commented Jun 17, 2019

👍

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

Successfully merging this pull request may close these issues.

3 participants