3

I receive a lot of "socket hung up" and 503 Service Unavailable on the /questions/{ids} endpoint. I make requests in batches: 10 parallel requests with 15 question ids, interval between each 10-size batch is at least 2 seconds. The amount of such batches is usually about 40 or 50. When it's less (25 or 30), I never get these 503s, only when it's about 45-50. I read the throttling policy in the docs and found that I have two things to keep in mind:

  1. not more than 30 req/s (I'm not hitting that for sure);
  2. service quota consumption (I have an API key and my daily usage is not more than 1000 requests);

I used to receive 400 responses before with descriptions of why I was being throttled. Now I receive just 503s and socket hung ups. Is it also a throttling policy or just some internal error? How to mitigate such behavior? Any help appreciated!

1

1 Answer 1

4

So, you are making up to 150 requests in a 30 second period (10 "parallel requests", with a 2 second pause in between). And failing at 80 to 100+ seconds of operation and 400 to 500 total requests?

  1. This other failure mode (NOT a 503) trips after about 32-ish seconds and 180 (sequential) requests.
  2. It was previously reported that making about 2 calls per second trips a 503 in about 80 calls (41-ish seconds). That same comment also said that a 503 still occurred with intervals as long as 920ms (which I'm not sure is still true).

So, try:

  1. Increasing the interval between batches to 30 seconds (SWAG'd number).

    OR

  2. Making your requests in "batches" of 1, with an interval of 1 second in between. If that fails, increase to a 2 second interval.


Obviously these are just workarounds, but the documented history of response to this family of bugs is not promising. (See the linked Q&A's to start.)

1
  • thanks, I'll try these and let you know if that helps Sep 17, 2019 at 6:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .