Jake
Jake

Reputation: 11

How we calculate maximum number of requests per/hour?

How is the amazon mws making this calculation for setting api-throttling values? I know its every silly question to ask but this is new to me. For example, I have a maximum request quota of 20 and refreshing at a rate of one request every five seconds. That works out to a maximum of 720 requests per hour if the 20 request quota is not exceeded during the hour.

Upvotes: 1

Views: 736

Answers (1)

Nathan Griffiths
Nathan Griffiths

Reputation: 12756

MWS uses a "leaky bucket" algorithm to calculate call rates and throttling.

See http://docs.developer.amazonservices.com/en_US/dev_guide/DG_Throttling.html for a comprehensive explanation.

For your example, if the maximum request quota is 20 and restore rate is one every 5 seconds then if you make one request every 5 seconds the quota will remain at 20. If you increase the request rate to every 3 seconds you will deplete the quota until it reaches zero, after which point you will again only be able to make a successful request every 5 seconds (some requests will fail). Changing the frequency of requests to greater than 5 seconds will allow the quota to build back up again, until it reaches a total of 20 available.

A key point from the above document:

You should consider automating your requests and have a fallback process where, if throttling occurs because you reached the maximum request quota or the web service experienced high traffic volumes, you could slow down the number of requests you make and resubmit requests that initially failed.

Upvotes: 0

Related Questions