AnsweredAssumed Answered

Dynamic Throttling Implementation using rate limit header

Question asked by Nadeeshani Senevirathna on Jul 2, 2019
Latest reply on Jul 11, 2019 by James Jones

Hi All,

We have a requirement to implement throttling when syncing grades to Canvas. As of now, we have a hard coded TPS threshold value in our side for throttling.

Since this has become a limitation for our grade sync performance requirements, we are planning to implement a dynamic throttling mechanism to match Canvas throttling.

We did some research on this, and according to the documentation here, we found that, for this purpose below headers could be used.

  • X-Request-Cost header - a floating point number of the amount that request deducted from the remaining quota. 
  • X-Rate-Limit-Remaining header - a number to represent the remaining quota.

Our plan is to keep a threshold from our end and start throttling when the X-Rate-Limit-Remaining value reaches that

 

In order to implement this, we need to know when would this value be reset (time interval), in order to retry the request. 

Could anyone please kindly let us know at what time interval below headers would be reset and requests would be permitted again? 

  • X-Request-Cost
  • X-Rate-Limit-Remaining

Is it a static interval or a dynamically determined time one comes in a header?

 

Also, any other useful information/guidance regarding this dynamic throttling implementation in a canvas client’s side (for grade/assignment sync) is highly appreciated.

Thanks in advance.

Outcomes