How to test rate limiting algorithm?

I am building an app that I hope (and believe) will rarely if ever hit up against the Smartsheet rate limits. But of course in building a resilient app, I have to consider that it might. So I have built out a framework for handling rate limiting, and of course can test that in a mocked environment, but I would like to do some final end to end tests to ensure that it actually works.

That said, I also want to be a good Smartsheet citizen and not slam the Smartsheet servers on purpose merely for my testing of rate limiting, unless that is the preferred best practice.

Anyone care to answer and/or maybe Smartsheet would weigh in with a preference?

Many thanks!

Best Answer


  • Genevieve P.
    Genevieve P. Employee Admin

    Hi @sgolux

    Smartsheet has an exponential backoff logic built into all the SDKs already. I would suggest that this might be a good starting point to see how that code works!



  • sgolux
    sgolux ✭✭

    Hi @Genevieve P. - so grateful for your pointer. But I think my question may have been unclear.

    I was not asking about HOW to implement the logic. I have already done so.

    My question is that now I would like to TEST my code in a non-mocked context where I actually get Smartsheet to issue the rate limit pattern in response to my requests. I want a testing framework to test my code.

    I could of course do this by simply slamming hundreds of requests at Smartsheet in order to trigger rate limiting. But it seems not very neighborly to do that intentionally. If there is a way that I can either issue a test request that will "rate limit" or temporarily set a test context where I am limited to (say) ten requests a minute rather than 300, then I would be able to test my code.

    Is there anything like that?

    Many thanks.

  • Genevieve P.
    Genevieve P. Employee Admin
    Answer ✓

    Hi @sgolux

    Thank you for clarifying! No, there currently isn't a way to temporarily set a test context like this. I suppose you'll need to just go ahead and slam away.