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

aws throttling errors when running awsless list records #144

Closed
macon opened this issue Sep 20, 2017 · 16 comments
Closed

aws throttling errors when running awsless list records #144

macon opened this issue Sep 20, 2017 · 16 comments
Labels

Comments

@macon
Copy link

macon commented Sep 20, 2017

Get this when running the following

$ awless list records --filter name=elastic
[error]   Throttling: Rate exceeded
	status code: 400, request id: 320b85fe-9e1f-11e7-a8c6-8d88e406789f
@fxaguessy
Copy link
Contributor

fxaguessy commented Sep 21, 2017

Thanks for reporting this bug.
This must be due to the fact that awless is sending too many requests to AWS.

Does awless list zones works as expected ?
How many zones do you manage ? You can count them with awless list zones --no-headers --format csv | wc -l

Do you have an idea of the number of zones and records you have in your infrastructure ?

Note also that, for now, the filtering with --filter is applied after all results are fetch from Amazon. As a result, if you have many records/zones, they will be fetch all, before applying the filter.

@fxaguessy fxaguessy added the bug label Sep 21, 2017
@macon
Copy link
Author

macon commented Sep 21, 2017

awless list zones works fine. We have 85 zones.
We have over 1000 records.
It would be good to be able to at least provide a zone arg to the awless list records api.

@fxaguessy
Copy link
Contributor

OK, according to AWS documentation, we are limited to 5 requests/second for Route53 API, and we are currently making 1 request/zone when listing records.
Just to be sure that the retryers works as expected, how long does it take for the failing command (run time awless list records) ?

A solution is indeed to provide a way to limit to a zone, with an extra flag or with the existing --filter.

@macon
Copy link
Author

macon commented Sep 21, 2017

$  time awless list records
[error]   Throttling: Rate exceeded
	status code: 400, request id: e04b628c-9edc-11e7-8b44-67049770601c

real	0m7.336s
user	0m0.418s
sys	0m0.111s

@danielhoherd
Copy link

I am seeing this problem too and expected there to be a --filter option to work around it. Another idea is to have --api-rate-limit.

$ awless --version
awless version=v0.1.9, commit=8909030babf101749ab0014c35960cdbb8e4c5b0, build-date=2018-01-23T11:07:23-08:00, build-arch=amd64, build-os=darwin, build-for=brew
$ time awless list records
[error]   Throttling: Rate exceeded
	status code: 400, request id: a1c5a032-053c-11e8-9ba3-9390c08d31d2

real	0m6.118s
user	0m1.577s
sys	0m0.414s

@simcap
Copy link
Contributor

simcap commented Jan 30, 2018

Thanks @macon and @danielhoherd for your outputs.

Currently, the filtering on listing (through the --filter flag) is applied post fetching. That is why filtering has no effect on the throttling.

Our goal is to fix that by passing down the filtering values down to our AWS fetchers so that we do not fetch unrequested resource and the throttling should diminishes in a lot of cases. This improvement has long been overdue and we deferred it so far in favor of other features and fixes.

(Note that all AWS API do not allow filtering on criteria, so we have to approach each of our fetchers starting with those who waste bandwidth.)

This week (or next week) I will start to work on that and start with this use case.

simcap added a commit that referenced this issue Jan 30, 2018
@simcap
Copy link
Contributor

simcap commented Jan 30, 2018

@macon @danielhoherd Fix available on master (if you installed awless with Golang just do a go get -u github.com/wallix/awless).

Now the filtering on awless ls records --filter name=anything will apply during the fetching hence less throttling. Note that the --filter options is case insensitive and will match on string contains (see the awless wiki).

Also to help, in case of debug, we can use the -v verbose flag that should log in the console throttling errors. There is also a hidden flag for our own internal use --network-monitor that will show the details of the calls done to AWS.

So basically if any issues give us the output of awless ls records --filter name=anything -v --network-monitor.

Let me know how that is going for you so I can close the issue accordingly. Thanks!

(This is not the end of our work on throttling ... ;) )

@simcap
Copy link
Contributor

simcap commented Jan 30, 2018

@danielhoherd what fix did you have in mind when suggesting the --api-rate-limit flag?

@danielhoherd
Copy link

@simcap I was thinking of a global API call rate limiter. I'm not positive it's a good idea though, especially since it seems like AWS tolerates different limits for different services.

Something similar can be seen in other fetching tools like wget and youtube-dl where requests can be throttled.

@macon
Copy link
Author

macon commented Jan 31, 2018 via email

@simcap
Copy link
Contributor

simcap commented Jan 31, 2018

@danielhoherd I see. Indeed a flag to control the flow of requests (limiting) is on our list, although we do not want to come to that yet and have other ideas in mind.

Anyway @danielhoherd let me know how the records listing is working for you when you have time. Thanks.

@macon
Copy link
Author

macon commented Feb 2, 2018 via email

@simcap
Copy link
Contributor

simcap commented Feb 2, 2018

@macon This is due to the name value for filtering being passed down to the AWS API to filter on the Zone name (here prod.aws.justgiving) and not the full record name. This is to accommodate what the AWS APIs provides at the moment.

I think this is not good and worse ... not clear for the user, so thanks for reporting it.

Ideally, a Zone column should be added in the Records listing so that we could do more clearly awless ls records --filter zone=... and not get surprises. We would still be able to filter at the same time on the records full name with the default local filtering (i.e. once all the results are fetch). With this fix throttling would not degrade.

I will try to see if I can do that today.

@macon
Copy link
Author

macon commented Feb 2, 2018 via email

simcap added a commit that referenced this issue Feb 2, 2018
Improving on #144 by adding zone in listing records
@simcap
Copy link
Contributor

simcap commented Feb 2, 2018

@macon available on master now:

  • A new Zone column added when listing records
  • --filter zone=... therefore now therefore possible feasible when listing records

So it remove the confusion, and you can now basically do:

awless list records --filter zone=prod.aws.justgiving

... or more fuzzy matching (i.e. contains substring)

awless list records --filter zone=prod

(Note throttle has not been degraded (same as with the previous fix) and you can still fuzzy filter by records' name but this will be done locally from all results)

@macon
Copy link
Author

macon commented Feb 2, 2018 via email

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

No branches or pull requests

4 participants