모든 시간 기반 오류 (X분당 최대 N개의 요청)의 경우 코드가 예외를 포착하고 잘린 지수 백오프를 사용하여 기기에서 과도한 부하가 발생하지 않도록 하는 것이 좋습니다.
지수 백오프는 네트워크 애플리케이션의 표준 오류 처리 전략입니다. 지수 백오프 알고리즘은 요청 간 대기 시간을 기하급수적으로 늘려 최대 백오프 시간까지 요청을 재시도합니다. 요청이 여전히 실패하는 경우 요청이 성공할 때까지 요청 간 지연 시간이 시간이 지남에 따라 증가하는 것이 중요합니다.
예시 알고리즘
지수 백오프 알고리즘이 재시도 간 대기 시간을 최대 백오프 시간까지 늘려서 기하급수적으로 요청을 재시도합니다. 예를 들면 다음과 같습니다.
Google Drive API에 요청을 전송합니다.
요청이 실패하면 1 + random_number_milliseconds를 대기한 후 요청을 재시도합니다.
요청이 실패하면 2 + random_number_milliseconds를 대기한 후 요청을 재시도합니다.
요청이 실패하면 4 + random_number_milliseconds를 대기한 후 요청을 재시도합니다.
maximum_backoff 시간까지 이를 반복합니다.
최대 재시도 횟수까지 계속 대기하고 재시도하지만 재시도 간 대기 시간을 늘리지는 않습니다.
각 항목의 의미는 다음과 같습니다.
대기 시간은 min(((2^n)+random_number_milliseconds), maximum_backoff)이며, n은 반복 (요청)할 때마다 1씩 증가합니다.
random_number_milliseconds는 1,000밀리초 이하의 임의 숫자입니다. 이렇게 하면 특정 상황에 따라 많은 클라이언트가 동기화되고 모두 한 번에 재시도되어 일련의 동기화된 작업으로 요청을 보내지 않도록 하는 데 도움이 됩니다. random_number_milliseconds 값은 각 재시도 요청 후 다시 계산됩니다.
maximum_backoff는 일반적으로 32 또는 64초입니다. 적절한 값은 사용 사례에 따라 다릅니다.
클라이언트는 maximum_backoff 시간에 도달한 후 재시도를 계속할 수 있습니다.
이후 재시도는 백오프 시간을 계속 늘릴 필요가 없습니다. 예를 들어 클라이언트가 maximum_backoff 시간으로 64초를 사용하는 경우 이 값에 도달한 후 클라이언트는 64초마다 재시도할 수 있습니다. 특정 시점에서 클라이언트가 무한정 재시도하지 못하게 해야 합니다.
재시도 간 대기 시간과 재시도 횟수는 사용 사례 및 네트워크 조건에 따라 달라집니다.
가격 책정
Google Drive API는 모두 추가 비용 없이 사용할 수 있습니다. 할당량 요청 한도를 초과해도 추가 요금이 발생하지 않으며 계정에 비용이 청구되지 않습니다.
할당량 상향 조정 요청
프로젝트의 리소스 사용량에 따라 할당량 조정을 요청할 수 있습니다. 서비스 계정의 API 호출은 단일 계정을 사용하는 것으로 간주됩니다. 조정된 할당량을 신청해도 승인된다고 보장할 수 없습니다. 할당량 값을 크게 늘리는 할당량 조정 요청은 승인에 더 오랜 시간이 걸릴 수 있습니다.
모든 프로젝트의 할당량이 동일하지는 않습니다. 시간이 지남에 따라 Google Cloud 사용량이 늘어나면 할당량 값을 늘려야 할 수 있습니다. 앞으로 사용량이 현저하게 늘어날 것으로 예상되는 경우 Google Cloud 콘솔의 할당량 페이지에서 사전에 할당량 조정을 요청할 수 있습니다.
[null,null,["최종 업데이트: 2025-08-04(UTC)"],[],[],null,["# Usage limits\n\nAs the Google Drive API is a shared service, we apply quotas and limitations to\nmake sure it's used fairly by all users and to protect the overall performance\nof the Google Workspace system.\n\n[Notifications](/workspace/drive/api/guides/push) delivered to the address specified when\nopening a notification channel don't count against your quota limits. However,\ncalls to the [`changes.watch`](/workspace/drive/api/v3/reference/changes/watch),\n[`channels.stop`](/workspace/drive/api/v3/reference/channels/stop), and\n[`files.watch`](/workspace/drive/api/v3/reference/files/watch) methods do count against\nyour quota.\n\nIf you exceed a quota, you'll receive a [`403: User rate limit\nexceeded`](/workspace/drive/api/guides/handle-errors#resolve_a_403_error_user_rate_limit_exceeded)\nHTTP status code response. Additional rate limit checks on the\nDrive backend might also generate a [`429: Too many\nrequests`](/workspace/drive/api/guides/handle-errors#resolve_a_429_error_too_many_requests)\nresponse. If this happens, you should use an [exponential backoff\nalgorithm](#exponential) and try again later. Provided you stay within the\nper-minute quotas below, there's no limit to the number of requests you can make\nper day.\n\nThe following table details the query limits:\n\n| Quotas ||\n|---------|----------------------------------------------------------------------------------------------------------------|\n| Queries | |-------------------------|--------| | Per 60 seconds | 12,000 | | Per 60 seconds per user | 12,000 | |\n\n| **Note:** Depending on your type of Google Workspace account, there are additional [Drive storage limits](https://support.google.com/a/answer/172541). Google Workspace users can only upload 750 GB per day between My Drive and all shared drives; this limit also applies to copies. Users who reach the 750 GB limit or upload a file larger than 750 GB can't upload or copy additional files until 24 hours have passed. The maximum file size that users can upload is 5 TB; only the first file that breaks the limit completes uploading. The maximum file size that users can copy is 750 GB.\n\nResolve time-based quota errors\n-------------------------------\n\n\nFor all time-based errors (maximum of N requests per X minutes), we recommend\nyour code catches the exception and uses a *truncated exponential backoff* to make sure your\ndevices don't generate excessive load.\n\n\nExponential backoff is a standard error handling strategy for network applications. An\nexponential backoff algorithm retries requests using exponentially increasing wait times\nbetween requests, up to a maximum backoff time. If requests are still unsuccessful, it's\nimportant that the delays between requests increase over time until the request is successful.\n\n### Example algorithm\n\n\nAn exponential backoff algorithm retries requests exponentially, increasing the wait time\nbetween retries up to a maximum backoff time. For example:\n\n1. Make a request to Google Drive API.\n2. If the request fails, wait 1 + `random_number_milliseconds` and retry the request.\n3. If the request fails, wait 2 + `random_number_milliseconds` and retry the request.\n4. If the request fails, wait 4 + `random_number_milliseconds` and retry the request.\n5. And so on, up to a `maximum_backoff` time.\n6. Continue waiting and retrying up to some maximum number of retries, but don't increase the wait period between retries.\n\n\nwhere:\n\n- The wait time is `min(((2^n)+random_number_milliseconds), maximum_backoff)`, with `n` incremented by 1 for each iteration (request).\n- `random_number_milliseconds` is a random number of milliseconds less than or equal to 1,000. This helps to avoid cases in which many clients are synchronized by some situation and all retry at once, sending requests in synchronized waves. The value of `random_number_milliseconds` is recalculated after each retry request.\n- `maximum_backoff` is typically 32 or 64 seconds. The appropriate value depends on the use case.\n\n\nThe client can continue retrying after it has reached the `maximum_backoff` time.\nRetries after this point don't need to continue increasing backoff time. For\nexample, if a client uses a `maximum_backoff` time of 64 seconds, then after reaching\nthis value, the client can retry every 64 seconds. At some point,\nclients should be prevented from retrying indefinitely.\n\n\nThe wait time between retries and the number of retries depend on your use case\nand network conditions.\n\nPricing\n-------\n\n\nAll use of the Google Drive API is available at no additional cost. Exceeding the quota\nrequest limits doesn't incur extra charges and your account is not billed.\n\nRequest a quota increase\n------------------------\n\n\nDepending on your project's resource usage, you might want to request a quota\nadjustment. API calls by a service account are considered to be using a\nsingle account. Applying for an adjusted quota doesn't guarantee approval. Quota adjustment\nrequests that would significantly increase the quota value can take longer to be approved.\n\n\nNot all projects have the same quotas. As you increasingly use Google Cloud over\ntime, your quota values might need to increase. If you expect a notable upcoming\nincrease in usage, you can proactively\n[request quota adjustments](https://cloud.google.com/docs/quota#requesting_higher_quota)\nfrom the [Quotas page](https://console.cloud.google.com/iam-admin/quotas)\nin the Google Cloud console.\n\nTo learn more, see the following resources:\n\n- [About quota adjustments](https://cloud.google.com/docs/quotas/overview#about_increase_requests)\n- [View your current quota usage and limits](https://cloud.google.com/docs/quota#viewing_your_quota_console)\n- [Request a higher quota limit](https://cloud.google.com/docs/quota#requesting_higher_quota)"]]