问题
Note: This question is about something that I do not understand in the documentation here: https://developers.google.com/gmail/api/v1/reference/quota#concurrent_requests
Concurrent Requests
The Gmail API enforces a per-user concurrent request limit (in addition to the per-user rate limit). This limit is shared by all Gmail API clients accessing a given user and ensures that no API client is overloading a Gmail user mailbox or their backend server.
enforces a per-user concurrent request limit (in addition to the per-user rate limit).
I do not find what is the 'per-user concurrent request' anywhere in their documentation. Whereas the per-user rate limit is found at the top in the same page. https://developers.google.com/gmail/api/v1/reference/quota#top_of_page
回答1:
The Gmail API enforces a per-user concurrent request limit (in addition to the per-user rate limit). This limit is shared by all Gmail API clients accessing a given user and ensures that no API client is overloading a Gmail user mailbox or their backend server.
The confusion here is the difference between per-user concurrent request limit
and per-user rate limit
Lets say I make an app that lets users read from their Gmail account. I am going to be limited by the number of request each user can make though MY app the limit is per-user rate limit
Now lets say the user installs your app which also allows them to access their Gmail account. You are also limited to how fast the user can access the api via the per-user rate limit
.
However both of our APPs and the gmail and inbox apps are are all running with the same per-user concurrent request limit
concurrent meaning across all of the apps the user is using.
the per-user concurrent request limit
is probably there to ensure that a developer doesn't create a number of different projects and rip data using all of them.
To my knowledge per-user concurrent request limit
is not documented its a stealth limit and i have never seen anyone who has been able to nail down exactly what the numbers are for the concurrent limits in Google APIs. With the exception of the Google Analytics API which is 10000 not including the google analytics website and the official mobile apps
Example:
per-user rate limit
- User number one logs in and lists all of his emails he has 10 user gets no error.
- User number two logs in, he has 1000 emails and your application tries to select them all out in 1 second. You are going to get a rate limit error for this user. You are flooding google. However apps by other developers will be able to access the user inbox via the API
per-user concurrent
- user number one is only running your application. logs in and lists all of his emails he has 10 user gets no error.
- User number two is running your application and 20 other applications by other developers. Tries lists all of his emails assuming he has done this on all the applications at the same time he may end up getting an error.
These errors are user based due to the name Per-user in the name of the limit.
Example 2:
Lets look at the Google analytics API because i know the hard numbers for this api.
- A user using your app can max make 100 requests over 90 seconds. (User-app based)
- An application can make max 50000 requests a day. (App Based)
- An all Applications can max make 10000 requests a day against a view (concurrent app based)
来源:https://stackoverflow.com/questions/49383624/gmail-api-request-quota-at-a-user-level