Skip to content
This repository was archived by the owner on Dec 19, 2017. It is now read-only.

Retry functionality fix - #180

Open
renat-sabitov wants to merge 1 commit into
mitchellh:masterfrom
renat-sabitov:fix_retry
Open

renat-sabitov wants to merge 1 commit into
mitchellh:masterfrom
renat-sabitov:fix_retry

Conversation

@renat-sabitov

Copy link
Copy Markdown

related to #24 and hashicorp/packer#1539

This patch fixes a number of issues with regards to retry functionality:

  1. last retry wiping out response body, which resulted in no error reported
  2. retry interval was too small (100 ms), increased to 500 ms avg
  3. not enough retries
  4. No randomness in exp backoff

We had a long history of problems while baking 10 AMIs in a time, this fix
along with some fixes in packer resolves the issues

related to mitchellh#24

This patch fixes a number of issues with regards to retry functionality:

1. last retry wiping out responce body, which resulted in no error reported
2. retry interval was too small (100 ms), increased to 500 ms avg
3. not enough retries
4. No randomness in exp backoff

We had a long history of problems while baking 10 AMIs in a time, this fix
along with some fix in packer resolves the issues
Comment thread aws/client.go

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does this really work better than just changing the 100 in ExpBackoff to 500? (Along with upping MaxTries to 10.)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The idea is that If you have multiple clients trying to call AWS API, they tend to experience throttling at the same time. Then they wait for exactly the same amount of time and retry, which lead to another round of throttling. Repeat for next retries.
Randomness doesn't allow retries to line up.

@joshuadfranklin

Copy link
Copy Markdown

FYI the official AWS Architecture Blog recently published some tips on backoff algorithms that do the fewest calls with concurrent clients, and jittered wins:
http://www.awsarchitectureblog.com/2015/03/backoff.html

The simulation code for 100 clients and a DynamoDB-like Optimistic concurrency control (OCC) server in python is here:
https://github.com/awslabs/aws-arch-backoff-simulator/blob/master/src/backoff_simulator.py

The context is DynamoDB but the algorithm is generic. So yes based on the simulation data, adding randomness works better than just increasing the interval.

@ghost

ghost commented Nov 9, 2016

Copy link
Copy Markdown

Is there a status on this PR? We are running into this problem also, and this solution will help us

Thx

@nburglin

Copy link
Copy Markdown

Same issue here and this seems like a solid solution.

@mitchellh Anything else that needs to be done here to get this merged?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants