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

Question regarding the Amazon Request Quota/Rate ? #164

Open
iosoft opened this issue Aug 8, 2018 · 3 comments
Open

Question regarding the Amazon Request Quota/Rate ? #164

iosoft opened this issue Aug 8, 2018 · 3 comments
Labels

Comments

@iosoft
Copy link

iosoft commented Aug 8, 2018

Hello,

This is not a issue, rather a question.
I am using your Library for my PHP project.

Amazon has Request Quota/Rate for almost each and every kind the requests.
Is your Library handling the quota/rate internally? or I have to manage it from my side of coding?

Please let me know.
Thanks and regards.

@Peardian
Copy link
Collaborator

Peardian commented Aug 8, 2018

Hi, good question. The direct answer to your question is "yes and no", as throttling within the Amazon library is a bit tricky.

In the beginning, this library was designed to manage all of the aspects of the request rate, which is why there is an environment.php file filled with variables representing the different rate limits and restore rates. However, this proved to be very difficult to design for, so we opted for a much simpler system. If the library receives a 503 error (request rate exceeded), the library will sleep for an amount of time corresponding to the restore rate of the request and try again. There is a setting method, setThrottleStop(), that can be used to suppress the sleep/retry.

Then, Amazon went and added an extra hourly request limit. This complicates things further, because it means that sleeping for the usual amount of time will not allow the request to continue like normal, and the library won't be able to tell why the request is being throttled.

There is a third type of throttling that applies to product requests. These requests behave differently in that Amazon will limit the amount of data returned, rather than outright rejecting the request. The library currently cannot detect or stop this kind of throttling.

So, to summarize, the library will be able to handle any typical throttling that occurs, but it is still a good idea to be aware of the API's limitations when designing your code. If you design your script to send many more requests than what Amazon allows, your code will take much longer to finish than if the requests were spaced out.

I hope that answers your question.

@iosoft
Copy link
Author

iosoft commented Aug 8, 2018

This is a great explanation.
You should make a wiki on this point.

Actually, I am not so expert like you, but when I was going through your library, I saw some throttling code. Now its clear.

And also, thanks for quick and detailed reply.

@Peardian
Copy link
Collaborator

Peardian commented Aug 9, 2018

Thanks, glad I could help.

Also, you bring up a good idea. When I find the time, I will add a section to the readme file about throttling.

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

2 participants