Exponential Back off

82 views
Skip to first unread message

Code Smith

unread,
Nov 8, 2010, 10:17:59 PM11/8/10
to Costin Manolache, androi...@googlegroups.com
Costin
 
We have multiple threads trying to Push messages. Lets say for example our Batch Size is 100 which runs every minute (X). According to this e.g. we have 5 connections each trying to send 20 messages via c2dm. 
 
While sending notifications if we start getting Response code 503 with no Retry - Header -  we will start introducing delay only after the current Batch cycle is completed. The next Batch will be tried after X^2 minutes (2 minutes).
 
Once the Batch is started - we will not be able to terminate the in-process jobs which is trying to send push notifications via c2dm.
 
Is that OK - are we exposed to getting  blacklisted.
 
Please let me know.
 
Thanks,

 

Costin Manolache

unread,
Nov 9, 2010, 12:25:38 AM11/9/10
to Code Smith, androi...@googlegroups.com
On Mon, Nov 8, 2010 at 7:17 PM, Code Smith <codesmit...@gmail.com> wrote:
Costin
 
We have multiple threads trying to Push messages. Lets say for example our Batch Size is 100 which runs every minute (X). According to this e.g. we have 5 connections each trying to send 20 messages via c2dm. 
 
While sending notifications if we start getting Response code 503 with no Retry - Header -  we will start introducing delay only after the current Batch cycle is completed. The next Batch will be tried after X^2 minutes (2 minutes).

50x will happen when something is wrong, either on our side or on the network,  and it's  very unlikely to affect 1-2 requests and then work again. The most common case you'll get 50x for few minutes - until the traffic gets redirected to a better location, or any bad servers are restarted. 

It is very likely 50x response will  be very fast - and if you retry 3 times you'll send 300 requests instead of 100.

 
 
Once the Batch is started - we will not be able to terminate the in-process jobs which is trying to send push notifications via c2dm.
 
Can you just slow it down and not start another one until you start getting 200s ? 
 
 
Is that OK - are we exposed to getting  blacklisted.

Not for 100 requests. If you get to 100 requests / second, and keep it up for long enough - maybe.
If it start affecting other users and looks similar with a DOS attack - yes. 

But the point is that you gain nothing by retrying without a small delay, just waste network and are
more likely to lose that notification if you have a retry limit. 

Costin
Reply all
Reply to author
Forward
0 new messages