Cloud Endpoints는 애플리케이션이 API를 호출하는 속도를 제어할 수 있도록 할당량을 제공합니다. 할당량을 설정하면 사용량 한도를 지정하여 호출 애플리케이션의 과도한 요청으로부터 API를 보호할 수 있습니다. 과도한 요청은 단순한 철자 오류로 인해 또는 불필요하게 API를 호출하는 비효율적으로 설계된 시스템으로 인해 발생할 수 있습니다. 원인과 무관하게 API를 전반적으로 정상 상태로 유지하려면 특정 소스의 트래픽이 일정 수준에 도달할 때 트래픽을 차단해야 합니다. 할당량을 설정하면 한 애플리케이션이 API를 사용하는 다른 애플리케이션에 부정적인 영향을 주지 않도록 할 수 있습니다.
이 페이지에서는 할당량에서 제공하는 핵심 기능을 간략하게 설명합니다.
요청이 소비자 프로젝트에 연결됨
할당량을 구성하면 Endpoints가 소비자 Google Cloud 프로젝트별로 분당 요청 수를 추적합니다. API를 호출하는 각 애플리케이션은 다음을 충족해야 합니다.
API에 요청할 때마다 API 키를 전송해야 합니다. 이렇게 하면 Endpoints가 호출 애플리케이션에 연결된Google Cloud 프로젝트를 식별하고 Google Cloud 프로젝트의 요청 카운터를 늘릴 수 있습니다.
API 소비자가Google Cloud 콘솔에서 고유한 프로젝트를 만들도록 하거나 개발자가 소비자용 프로젝트를 만들 수 있습니다. Endpoints는 프로젝트 단위로 할당량을 적용하므로 API 소비자마다 프로젝트가 한 개 있어야 합니다.
분당 요청 수 제한
할당량을 설정하면 전체 API 또는 특정 메서드에 대한 분당 요청 수를 제한할 수 있습니다. 소비자 프로젝트의 클라이언트 코드가 구성된 한도를 초과하면 요청이 API에 도달하기 전에 거부되고 HTTP 상태 코드 429 too many
requests가 반환됩니다. 호출 애플리케이션은 429 상태 코드를 처리하고 지수 백오프 또는 여러 다른 재시도 로직을 사용하여 API 호출 속도를 낮춰야 합니다.
할당량을 여러 개 구성
명명된 할당량을 여러 개 구성하고 각 할당량에 대해 서로 다른 속도 한도를 지정할 수 있습니다. 예를 들어, API에서 일부 메소드는 리소스를 많이 사용하고(예: 복잡한 쿼리를 실행하고 대규모 결과 목록을 반환하는 메소드) 다른 메소드는 빠르고 가벼울 수 있습니다. 이 경우 서로 다른 속도 한도를 사용하여 할당량 두 개를 구성하고, 리소스 사용량이 많은 메소드를 할당량 한 개에 연결하고 가벼운 메소드를 다른 할당량에 연결할 수 있습니다.
비용 구성
메서드를 할당량과 연결할 때는 항상 요청 비용을 지정합니다. 이렇게 하면 여러 메서드가 동일한 할당량을 서로 다른 속도로 소비할 수 있습니다. 여러 할당량을 구성하는 방법의 대안으로 비용을 사용할 수 있습니다.
예를 들어, 분당 요청 수 한도가 1,000개인 할당량을 구성한다고 가정합니다. 가벼운 메소드의 경우, 비용을 1로 구성합니다. 이는 클라이언트가 가벼운 메소드를 분당 1,000번 호출할 수 있음을 의미합니다. 리소스 사용량이 많은 메소드의 비용을 2로 구성합니다. 이 경우 요청 한도 1,000개에 도달할 때까지 클라이언트가 메소드를 호출할 때마다 요청 카운터가 2씩 증가합니다. 이를 통해 리소스 사용량이 많은 메소드의 분당 요청 수는 사실상 500개로 제한됩니다.
구성된 할당량 재정의
Endpoints > 서비스 페이지에 API의 각 메서드에 구성된 할당량이 표시됩니다. 필요한 경우 특정 소비자 프로젝트에 구성된 한도를 재정의할 수 있습니다. 재정의를 설정하려면 Endpoints > 서비스 페이지에서 소비자 프로젝트의 프로젝트 번호를 입력해야 합니다. 재정의하려는 소비자 프로젝트에 액세스할 수 없는 경우 액세스 권한이 있는 사용자에게 연락하여 프로젝트 번호를 확인해야 합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eCloud Endpoints quotas control the rate at which applications call an API, protecting it from excessive requests and ensuring one application doesn't negatively impact others.\u003c/p\u003e\n"],["\u003cp\u003eQuotas are tracked per minute per consumer Google Cloud project, requiring each application to have a project, enable the API, and send an API key.\u003c/p\u003e\n"],["\u003cp\u003eQuotas limit the number of requests per minute to an entire API or specific methods, rejecting requests exceeding the limit with a \u003ccode\u003e429 too many requests\u003c/code\u003e HTTP status code.\u003c/p\u003e\n"],["\u003cp\u003eMultiple quotas with different rate limits can be configured to accommodate resource-intensive and lightweight methods, also you can configure a request cost for each method as an alternative.\u003c/p\u003e\n"],["\u003cp\u003eThe enforced quota limit has an error margin of 30%, because the proxy uses aggregation and batching to improve request latency.\u003c/p\u003e\n"]]],[],null,["# About quotas\n\n[OpenAPI](/endpoints/docs/openapi/quotas-overview \"View this page for the Cloud Endpoints OpenAPI docs\") \\| gRPC\n\n\u003cbr /\u003e\n\n|\n| **Beta**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nCloud Endpoints provides quotas, which let you control the rate at which\napplications can call your API. Setting a quota lets you specify usage\nlimits to protect your API from an excessive number of requests from\ncalling applications. The excessive requests might have been caused\nby a simple typo or from an inefficiently designed system that makes needless\ncalls to your API. Regardless of the cause, blocking traffic from a\nsource once it reaches a certain level is necessary for the overall health of\nyour API. By setting a quota, you ensure that one application cannot negatively\nimpact other applications that use your API.\n\nThis page provides an overview of the key functionality provided by quotas.\n\nRequests are tied to the consumer project\n-----------------------------------------\n\nAfter you configure a quota, Endpoints tracks the number of\nrequests per minute per consumer Google Cloud project. Each\napplication that calls your API must:\n\n- Have a Google Cloud project.\n- Have [enabled your API](/endpoints/docs/grpc/control-api-callers) in their Google Cloud project.\n- Send an [API key](/endpoints/docs/grpc/restricting-api-access-with-api-keys) with each request to your API. This lets Endpoints identify the Google Cloud project that the calling application is associated with and to increment the request counter for the Google Cloud project.\n\nYou can either have your API consumers create their own projects in the\nGoogle Cloud console, or you can create the projects for them. Because\nEndpoints enforces quotas per *project*, you must have one\nproject for each API consumer.\n\nLimit the number of requests per minute\n---------------------------------------\n\nBy setting a quota, you can limit the number of requests per minute to your\nentire API or only to specific methods. If the client code from a consumer\nproject exceeds the limit that you have configured, the request is rejected\nbefore it gets to your API, and an HTTP status code of [`429 too many\nrequests`](https://tools.ietf.org/html/rfc6585#section-4) is returned. Calling\napplications will need to handle the `429` status code and use [exponential\nbackoff](https://wikipedia.org/wiki/Exponential_backoff) or some other retry\nlogic to decrease the rate of calls to your API.\n| **The enforced limit has 30% error margin.** Endpoints uses aggregation and batching at the proxy to reduce the runtime request latency. Instead of calling quota server to check available quota for each request, the proxy aggregates and batches the quota calls. As a result, the enforced quota limit is approximate, with a 30% margin of error. For example, if the expected limit is 100 requests per minute, the quota limit enforced could range from 70 requests per minutes to 130 requests per minute.\n\nConfigure one or more quotas\n----------------------------\n\nYou can configure one or more named quotas and specify a different rate limit\nfor each quota. For example, you could have some methods in your API that are\nresource-intensive (such as a method that runs a complex query and returns a\nlarge list of results), and other methods that are fast and lightweight. You\nmight want to configure two quotas with different rate limits, and associate the\nresource-intensive methods with one quota, and the lightweight methods with the\nother quota.\n\nConfigure a cost\n----------------\n\nWhen you associate a method with a quota, you always specify a cost for the\nrequest. This allows different methods to consume the same quota at different\nrates. You can use costs as an alternative to configuring different quotas.\nFor example, suppose you configure a quota with a limit of 1000 requests per\nminute. For the lightweight methods, you configure a cost of 1, which means\nclients can call the lightweight methods 1000 times per minute. For the\nresource-intensive methods, you configure a cost of 2, which means that each\ntime the client calls the method, the request counter is incremented by 2, until\nthe limit of 1000 is reached. In effect, this limits the resource-intensive\nmethods to 500 requests per minute.\n\nOverride the configured quota\n-----------------------------\n\nThe **Endpoints** \\\u003e **Services** page displays the quota configured for each\nmethod in your API. If needed, you can override the configured limit for a\nspecific consumer project. To set an override, you need to enter the project\nnumber of the consumer project on the **Endpoints** \\\u003e **Services** page. If you\ndon't have access to the consumer project that you want to override, you need to\ncontact someone who has access to obtain the project number.\n\nWhat's next\n-----------\n\n- [Configuring quotas](/endpoints/docs/grpc/quotas-configure)\n- [Overriding quotas](/endpoints/docs/grpc/quotas-override)"]]