batch execution and Request limit Exceeded (155)

December 28, 2015 at 5:48 pm

Basic free Parse plan offers up to 1800 requests/min (Parse averages it to an informative number of 30req/sec which is not a per second limit) always calculated as a number of requests started (no matter how long they’ll take) in a window of last 60 seconds.

Every new request exceeding the limit in the window of last 60 seconds will receive an error (155: Request Limit Exceeded) until the last 60 seconds average drops back below the limit. A simple error handling can take care of an appropriate error message being shown to the user (“Please try again later…“).

Things get more complicated when you start poking around batch requests (saveAll:, deleteAll:, …); every operation in the batch runs one after the other (otherwise saveAll: method of 30+ Parse objects would fail) and is counted as a single request against the 60 seconds limit (you’ll burn n + 1 number of requests for every batch, n stands for number of requests in the batch, 1 for invoking the batch API).

Because Parse, as of now, doesn’t treat a batch request as an atomic transaction you may face issues when you hit the 60 seconds limit in the middle of the batch execution. From my tests it appears that the batch is executed partially – some requests go through and some fail with error code 155. If you receive an error with the code 155 there will be some requests that weren’t fulfilled; looping through the objects allows you to verify which went through and which still need your attention (e.g. existence of objectId in new objects, updatedAt for existing objects, etc.).

Hope it helps with choosing the right Parse implementation strategy :).