how to avoid Rate Limitations

131 views
Skip to first unread message

Marc Poch

unread,
Jan 14, 2016, 7:35:33 AM1/14/16
to Google Translate API Developer Forum
Hi!

We are trying to use Google Translate API but we are hitting Rate limits constantly. We tried to rise our quota but it didn't work.

Here I attach a log of our application where you can see the number of segments (strings) sent per request and the total number of characters of that same request.
Here I also attach our quota specification.
 - Why are we hitting the rate limit?
 - we have 20M characters per day so we are good here.
 - our requests have less than 128 segments
 - our requests have less than 5000 characters.
 - what is a request in the "Per-user limit" quota? 5000 characters or a single character sent for translation?
 - Is 100 characters per second the limit configured in our quota?

any help will be welcome. Thanks in advance

QUOTA:
Total quota
20,000,000 characters/day
Remaining
  • 19,286,050 characters/day
  • 96.43% of total
Per-user limit
100 requests/second/user


APP LOG:

16/01/14 13:19:26 INFO  translating [6] segments with [1614] characters from: french. Chars translated so far:[43679] with [11] API calls.
16/01/14 13:19:28 INFO  translating [18] segments with [4242] characters from: portuguese. Chars translated so far:[45293] with [12] API calls.
16/01/14 13:19:30 INFO  translating [6] segments with [4676] characters from: french. Chars translated so far:[49535] with [13] API calls.
16/01/14 13:19:31 INFO  translating [3] segments with [3877] characters from: italian. Chars translated so far:[54211] with [14] API calls.
16/01/14 13:19:32 INFO  translating [3] segments with [4650] characters from: italian. Chars translated so far:[58088] with [15] API calls.
16/01/14 13:19:34 INFO  translating [27] segments with [4542] characters from: french. Chars translated so far:[62738] with [16] API calls.
16/01/14 13:19:36 INFO  translating [69] segments with [4447] characters from: italian. Chars translated so far:[67280] with [17] API calls.
16/01/14 13:19:37 INFO  translating [27] segments with [4497] characters from: german. Chars translated so far:[71727] with [18] API calls.
16/01/14 13:19:39 INFO  translating [45] segments with [4115] characters from: italian. Chars translated so far:[76224] with [19] API calls.
16/01/14 13:19:41 INFO  translating [75] segments with [4661] characters from: french. Chars translated so far:[80339] with [20] API calls.
16/01/14 13:19:42 INFO  translating [45] segments with [4685] characters from: italian. Chars translated so far:[85000] with [21] API calls.
16/01/14 13:19:44 INFO  translating [63] segments with [4604] characters from: dutch. Chars translated so far:[89685] with [22] API calls.
16/01/14 13:19:46 INFO  translating [81] segments with [4307] characters from: german. Chars translated so far:[94289] with [23] API calls.
16/01/14 13:19:47 INFO  translating [36] segments with [4574] characters from: portuguese. Chars translated so far:[98596] with [24] API calls.
16/01/14 13:19:47 ERROR utils.GoogleTranslateAPI:172 - Could not execute query to the API
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
  "code": 403,
  "errors": [
    {
      "domain": "usageLimits",
      "message": "User Rate Limit Exceeded",
      "reason": "userRateLimitExceeded"
    }
  ],
  "message": "User Rate Limit Exceeded"
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:145)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:312)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1049)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:410)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:343)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:460)




Nicholas (Google Cloud Support)

unread,
Jan 14, 2016, 2:09:43 PM1/14/16
to Google Translate API Developer Forum
It appears you are indeed encountering the per-second rate limitation of the Translate API. The is in fact somewhat unclear however, the behavior is being discussion the a related thread entitled 'Translate API 403 error - userRateLimitExceeded'. I would suggest consulting the two most recent posts from Nick there. In short, the rate is actually 100 characters per second for which an increase can be request via the Translate API Quota Increase Request form.

To avoid encountering this rate limit, I would suggest throttling your requests, reducing bursts of characters below 100 characters per second effectively distributing your translation requests over time. As for the meaning of 'User' in this rate limitation context, as far as I understand, the user represents whatever means by which the API recognizes the request coming from a particular source such as an API key or login credentials.
Reply all
Reply to author
Forward
0 new messages