rest – How to determine the safe retry exponential and jitter values in microservices?

We have a webpage that queries a list of items from an API gateway which in turn calls an API that calls another API. The operation is independent.

Webpage -> API Gateway -> API 1 -> API 2 -> DB

How should we implement retries?

We could add the retry mechanism somewhere in the back-end (API Gateway, API 1, or API 2) and I’m aware that it should implement exponential back-off and jittering but:

  • how do I determine the correct exponential and jittering values? (500ms, 1s, etc)?

  • If the retry mechanism takes too long, the user will get bored and refresh the webpage which could have a negative impact. How should we handle this? Should we not implement retries in the back-end at all? Or should we just make sure that the retry mechanism doesn’t take too long? In your experience, how long is too long for the user?