Spreading out your Amazon MWS requests
Many of us work by the clock, and when the big hand is pointing skyward, that's when we do things. Meetings often start "on the hour" as do many forms of entertainment, programs, and services. But "on the hour" is not a good time to submit lots of requests to Amazon MWS. Because many of your neighbors are doing the exact same thing, when everyone submits requests at the same time, the service can be overwhelmed, affecting its availability.
Almost all web services have request rate limits, limits that prevent the service from being overwhelmed by requests. Amazon MWS enforces these limits through a technique called throttling, only allowing a certain rate of requests per operation from all users. Requests that exceed this limit are throttled, resulting in the operation failing with a response code of 503 (Service temporarily unavailable). So one thing you need to consider as a developer using Amazon MWS is when is the best time to submit your requests.
The few best practices for timing requests are these:
- Pick a random time to call Amazon MWS, not a predictable one such as at the top of the hour or even on the minute.
- For periodic requests, add a jitter (small random variance) to your wait time. So, for example, if you are calling a particular Amazon MWS operation at 10-minute intervals, with a jitter you would still call Amazon MWS six times an hour, but at random intervals varying from, say, 9 to 11 minutes. An initial request could be made at a random time, such as three minutes and 19 seconds after the hour, and then every 10 minutes with a 10% jitter.
Suppose you are submitting a request to list orders every 10 minutes for a large number of clients. You should stagger these requests so that all the requests are not submitted at once. This keeps the Amazon MWS web service from possibly being overwhelmed and allows other sellers to submit feeds or retrieve reports. Amazon Services periodically reviews the Amazon MWS web service availability and will loosen restrictions when appropriate. Sellers who spread out their requests over the day, reducing peak usage, can increase the service's availability and reduce the amount of throttling required to keep the service available.
Amazon MWS receives a big bursts of requests on the hour. If you spread these requests out over the hour and randomize when you submit your initial requests, everyone wins.