Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Box java sdk - too many requests

Answered
New post

Comments

4 comments

  • carycheng77

    Hey  ,

     

    The Java SDK does retry for cases of 5XX and 429. How we attempt retry is with exponential backoff with randomized jitter to negate too many requests firing off again at once with the retry.

     

    You can see the logic for this backoff here.

     

    The reason for using this type of backoff strategy is to make sure that the multitude of requests that could potentially be sent gets smoothed over a period of time on the retry and not too many of the requests  are being sent over concurrently again.

     

    The retry time is usually denoted in milliseconds.

     

    Let us know if this is helpful and if you have any other questions please reach out. And for SDK specific issues please feel free to file a request here.

    0
    Comment actions Permalink
  • Bharath_N_V

    Can you please inform us how many times it'll we be retried before giving up?

    0
    Comment actions Permalink
  • carycheng77

    Hey ,

     

    The request will be retried 3 times before stopping.

    0
    Comment actions Permalink
  • smartduck

    Hi Bharath N V,

     

    You can set the setMaxRequestAttempts and setConnectTimeout on the BoxAPIConnection to get better results.

     

    Example:

    BoxAPIConnection api;

    api = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig);
    api.setMaxRequestAttempts(20); // number of attempts
    api.setConnectTimeout(10000); // time out in milliseconds

     

    I have the same issue.

     

    Regards,

     

    Marcel

    0
    Comment actions Permalink

Please sign in to leave a comment.