Alexander Turkin
Alexander Turkin

Reputation: 63

rate limit policy on queries to Azure Insights REST API for Events (Audit Logs)

I have some questions regarding Azure Insights REST Api for Events.

When I make HTTP request to Inisghts API for events, I receive the header " x-ms-ratelimit-remaining-subscription-reads", with value "14999". But next query in 1s returns me the same value of remaining reads.

I see there is some throttling policy there, but I would like to understand how it works and what is the correct way to deal with that.

In particular,

1) how many reads I am able to do per second?

2) if I exceed the whole remaining reads parameter, how much time should I wait before it will again be maximum?

3) is it decreased on every query attempt, despite of the $top parameter setted and how many results has been returned?

Thank you!

Upvotes: 1

Views: 1353

Answers (2)

SummerCode
SummerCode

Reputation: 1403

This article seems to have the responses you need.

To answer the questions based on it:

  1. There is no limit to the number of requests per second, but you have 15k requests/hour/subscription/region/instance of ARM region. Worst case scenario you will get throttled after 15k requests but you'd have to be extremely unlucky for that.
  2. If you exceed the limit, you are told how much you have to wait and you can integrate that logic by looking at the Retry-After header. Happily, it's a matter of seconds.
  3. I believe the $top parameter doesn't affect the query since no matter how many results are brought back, a paging request is still just one request.

As for the fact that you get 14999 requests remaining multiple times, as they say in their documentation it is expected since an ARM region has multiple instances and each instance has 15k requests limit/subscription/hour. If you hit simultaneously and you get the same number remaining, it just means that you were lucky enough to hit different instances within the same ARM region.

Upvotes: 1

Gaurav Mantri
Gaurav Mantri

Reputation: 136366

1) how many reads I am able to do per second?

Based on the rate limits published here - https://azure.microsoft.com/en-in/documentation/articles/azure-subscription-service-limits/#subscription-limits, you can perform 15000 reads / hour (not sure it would translate to 4 reads / second).

2) if I exceed the whole remaining reads parameter, how much time should I wait before it will again be maximum?

Given the rates are defined per hour, my guess would be to wait till next hour if you exhaust 15000 read request limit.

3) is it decreased on every query attempt, despite of the $top parameter setted and how many results has been returned?

This is based on the number of API calls and not the amount of data returned. So I would say defining $top parameter should not have any impact on this.

When I make HTTP request to Inisghts API for events, I receive the header " x-ms-ratelimit-remaining-subscription-reads", with value "14999". But next query in 1s returns me the same value of remaining reads.

I would assume there's some caching in play here. Is it the same request you're repeating or a different request all together?

Upvotes: 0

Related Questions