Document Intelligence (Form Recognizer) maximum Transactions Per Second limit handle

Sourav 170 Reputation points
2023-09-05T11:44:02.1+00:00

I'm currently using the Document Intelligence SDK and it's hitting the maximum Concurrent limit in the production.

To mitigate this, some changes have been applied.
Previous method:

//waiting till the operation is completed
var result = await client.AnalyzeDocumentFromUriAsync(
                WaitUntil.Completed,
                PREBUILT_MODEL_REF,
                fileUri,
                null,
                cancellationToken) 


Current method:

var operation = await client.AnalyzeDocumentFromUriAsync(
                WaitUntil.Started,
                PREBUILT_MODEL_REF,
                fileUri,
                null,
                cancellationToken);
// Start the operation
// Then send the operation.Id to a service bus which will trigger a function app

//In the function app I'm looking for the long running operation's completion
var operation = new AnalyzeDocumentOperation(operationId, client);              
var value = await operation.WaitForCompletionAsync(cancellationToken);

My question is :

  1. When I'm hitting the TPS limit. i.e. My TPS limit is 15 and I'm requesting 20. How does Microsoft actually handle that?

It is supposed to send Response Code 429 (Too many requests).
What happens to that request? Do, they internally process the operation and I might be able to get a response later using the operationId or it does not at all start the operation and return null in operation Id.

2.If the form recognizer does not at all start the operation and returns null in operation Id

Should I try this approach according to the documentation:
As per https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/service-limits?view=doc-intel-3.1.0#example-of-a-workload-pattern-best-practice

Implementing an exponential backoff on the GET analyze response request. By using a progressively longer wait time between retries for consecutive error responses, for example a 2-5-13-34 pattern of delays between requests. In general, it's recommended to not call the get analyze response more than once every 2 seconds for a corresponding POST request

3.In my function App approach which tries to get the operation's status and result using operationId, should I need to use this delay approach mentioned in the Quote above when I'm checking my long-running operation's status?

Thanks in Advance

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,507 questions
{count} votes