Skip to main content
1 of 3
hippietrail
  • 882
  • 4
  • 14

Best strategies for calling the API with full throttling support?

I know this would be subjective on a normal SE site but as the relevant chat rooms are mostly dormant, we have no meta site, and nobody noticed when I asked if this kind of question is OK here, I'm just gonna ask m'kay? (-:

I want to make a little tool which needs to read all the tags, all the synonyms, and a bunch of the tag wikis. I'm just hacking for now and I'm happy with doing small requests with no app key. I also find it an interesting exercise. I'd like to know how some of the library and wrapper developers here did it and bounce some ideas around.

I'll be using JavaScript and probably jQuery but I'm more interested in abstract algorithms.

  • How many requests are OK to send simultaneously?
  • How to wait between requests, or how to know when to wait?
  • Send all requests through a "manager"? Or do them manually with some guidelines and watching response feedback fields such as "back off"?
  • How much of the per-IP limits to use? You never know when other stuff is running on the same IP.
  • Handle the different limits for with vs without key.
  • For long lists requiring multiple requests, one request first to find the total? Or first iteration of the loop reads the total?
  • Retry lost portions? I can't be the only one with an often flaky connection.
hippietrail
  • 882
  • 4
  • 14