Slashdot Mirror


Amazon Introduces Web Services Interface

skunkeh writes: "Amazon have launched a brand new web service interface to their huge database of products. The interface can be used through SOAP or by requesting XML pages via URL, and their development kit comes with example code in Java and Perl. A Python wrapper is also available, and I have released some sample code in PHP."

2 of 15 comments (clear)

  1. Re:from the terms and conditions by skunkeh · · Score: 3, Informative

    Good question. The only way I can think of is to grab the output of microtime() every time an API call is made and record that time in a database (or on the filesystem, but a database would be preferable for performance reasons). Then you can check this "last queried" time before making a request, and if one has been made in the last second you can use usleep() to temporarily delay your next request. You would probably have to code in some kind of method of spotting when you are getting really high traffic (continuously getting several hits a second) and have some clients die with an error message, rather than wait for potentially quite a long time before their turn to send an API request comes.

    Caching the results of requests could help greatly of course...

  2. Re:from the terms and conditions by tangi · · Score: 2, Informative

    just a top of mind: you could run you php within a dedicated instance of your web server, limit the number of process/threads to 1, and sleep the difference between 1 seconde and Amazon response time with your script.