MailboxConcurrency Limit/ Throttling Exception

Tarun Gupta 6 Reputation points
2022-02-14T09:30:50.83+00:00

Hi,

I am getting this error -> "Application is over its MailboxConcurrency limit."

While getting message content in 20 parallel requests using thread pool executors for a particular outlook email id.
Later I have to fetch attachment content for each message-attachment id, that too in parallel using executors only.

How can I do that?

Is there a way to increase the concurrency limit? What are the alternate solutions?

Thanks.

Microsoft Security Microsoft Graph
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Glen Scales 4,446 Reputation points
    2022-02-14T23:07:56.51+00:00

    While getting message content in 20 parallel requests

    To start with the MailboxConcurrency for the Graph is 4 requests (which is way too low but not something you can really change AFAIK)

    The first place to start would be if your 20 requests are single requests look to use batching https://learn.microsoft.com/en-us/graph/json-batching, inside the batch you can "Sequencing requests with the dependsOn property" which means your batch request can contain 20 single requests but will only use one mailbox connection, otherwise you need to limit the batch size to 4 because requests in the batch will be executed in parallel so for example if you tried to execute a batch request with 5 requests the last request would be throttled in the batch because of the Concurrency Limit. If your using dependsOn and batching up 20 request then you need to make sure your thread pool doesn't make any more the 4 concurrent requests (eg fix its size if you can).

    0 comments No comments

  2. Tarun Gupta 6 Reputation points
    2022-02-15T04:08:52.44+00:00

    Hi,

    This limit of 4 concurrent request is specific to a single API or group of APIs?

    Thanks.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.