1

I have a set of APIs developed using Azure Functions (stateless), the backend for this API is Microsoft graph. The number of APIs called per day is ~2000, at peak we have observed 5 requests per second. The control flow is as below,

Gateway (On premises) -> Azure Function (Stateless) -> Graph API call via. SDK with retries

Once in a while the Graph APIs throttle the requests (Gateway timeout, too many retries); the use of Graph SDK with automatic retries does not seem to help from reliability perspective. To ensure reliability i have considered below possible solutions,

  1. Azure Durable functions: Durable function allows for storing state and supports retry. The incoming api payload will be passed as parameter to Orchestrator function, thus storing its state. The CallActivityWithRetryAsync can be used to retry perhaps with longer interval (exponential backoff).
  2. Use Azure storage queues: Change the implementation to Gateway (On premises) -> Azure Function -> Storage Queue -> Queue triggered Function -> Graph API.

I am preferring use of Durable function, as state management and retry comes out of the box. However, i have not seen from my readings Durable functions being used in the above defined context. All solutions that i have read is to use Queues, Queue triggered functions for integration use cases.

It would helpful if someone who has experience with this kind of integration to suggest on the recommended solution.

user527614
  • 465
  • 5
  • 19
  • Your core issue here is retries, right, and maybe a bit of throttling? I'd say keep it simple. You can define retry in azure function code now. It's super simple, see next comment. Next option would be queues. They are built for retries and throttling. Last would be Durable functions. They are feature rich, but will add complexity and new patterns, behaviors you'll need to understand but won't use. For just solving retries, using Durable would be like using a sledgehammer on a walnut. There are better tools for the job. Start simple, work up to more complex if simple doesn't satisfy. – Troy Witthoeft Dec 15 '20 at 02:48
  • New azure function retry policy is here = https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-error-pages?tabs=csharp#retry-policies-preview They come with exponential backoff... limited throttling, out of the box. – Troy Witthoeft Dec 15 '20 at 02:49

0 Answers0