EWS Best Practices: Understand Throttling Policies
Understanding throttling policies, their default values, and how they are applied is a key in Exchange Online where they are used to protect connectivity to the online mailboxes. These policies can be applied per user – so a service account can be granted a unique policy apart from other mailbox users in your organization. The Exchange team had a series of posts on throttling.
Note policy settings can be configured separately for the following common development protocols (amongst others): MAPI (policies abbreviated with “RCA” for RPC Client Access as noted by Steve), Exchange Web Services, Exchange ActiveSync. There are four basic kinds of settings for each protocol governed by the these policies: MaxConcurrency, PercentTimeInCAS, PercentTimeInAD, and PercentTimeInMailboxRPC. Exchange Web Services also has a couple unique settings for EWSFastSearchTimeoutInSeconds, EWSFindCountLimit, and EWSMaxSubscriptions. You can read more about these settings in the documentation for Set-ThrottlingPolicy, here’s a list of the EWS policies from that documentation:
EWSFastSearchTimeoutInSeconds |
The EWSFastSearchTimeoutInSeconds parameter specifies the amount of time that searches made using Exchange Web Services continue before they time out. If the search takes more than the time indicated by the policy value, the search stops and an error is returned. The default value of this setting is 60 seconds. |
EWSFindCountLimit |
The EWSFindCountLimit parameter specifies the maximum result size of FindItem or FindFolder calls that can exist in memory on the Client Access server at the same time for this user in this current process. If an attempt is made to find more items or folders than your policy limit allows, an error is returned. However, the limit isn't strictly enforced if the call is made within the context of an indexed page view. Specifically, in this scenario, the search results are truncated to include the number of items and folders that fit within the policy limit. You can then continue paging into your results set via further FindItem or FindFolder calls. |
EWSMaxConcurrency |
The EWSMaxConcurrency parameter specifies how many concurrent connections an Exchange Web Services user can have against an Exchange server at one time. A connection is held from the moment a request is received until a response is sent in its entirety to the requestor. If users attempt to make more concurrent requests than their policy allows, the new connection attempt fails. However, the existing connections remain valid. The EWSMaxConcurrency parameter has a valid range from 0 through 100 inclusive. To indicate that the number of concurrent connections should be unthrottled (no limit), this value should be set to $null. |
EWSMaxSubscriptions |
The EWSMaxSubscriptions parameter specifies the maximum number of active push and pull subscriptions that a user can have on a specific Client Access server at the same time. If a user tries to create more subscriptions than the configured maximum, the subscription fails, and an event is logged in Event Viewer. |
EWSPercentTimeInAD |
The EWSPercentTimeInAD parameter specifies the percentage of a minute that an Exchange Web Services user can spend executing LDAP requests (PercentTimeInAD). A value of 100 indicates that for every one-minute window, the user can spend 60 seconds of that time consuming the resource in question. |
EWSPercentTimeInCAS |
The EWSPercentTimeInCAS parameter specifies the percentage of a minute that an Exchange Web Services user can spend executing Client Access server code (PercentTimeInCAS). A value of 100 indicates that for every one-minute window, the user can spend 60 seconds of that time consuming the resource in question. |
EWSPercentTimeInMailboxRPC |
The EWSPercentTimeInMailboxRPC parameter specifies the percentage of a minute that an Exchange Web Services user can spend executing mailbox RPC requests (PercentTimeInMailboxRPC). A value of 100 indicates that for every one-minute window, the user can spend 60 seconds of that time consuming the resource in question. |
If your application gets throttled you may see one of the following response codes come back from Exchange (documented here on MSDN). If you think your application is getting throttled by Exchange you can look at the IIS logs on your client access server to confirm and get detailed throttling information related to each request.
ErrorExceededConnectionCount |
This error -iIndicates that there are more concurrent requests against the server than are allowed by a user's policy. |
ErrorExceededSubscriptionCount |
This error indicates that a user's throttling policy maximum subscription count has been exceeded. |
ErrorExceededFindCountLimit |
This error indicates that a search operation call has exceeded the total number of items that can be returned. |
ErrorServerBusy |
This error occurs when the server is busy. |