Apigee에서는 할당량 정책을 사용하여 특정 기간 동안 API 프록시에 허용되는 요청 수를 구성할 수 있습니다.
안티패턴
API 프록시 요청은 메시지 프로세서라는 하나 이상의 분산된 Apigee 구성요소로 처리될 수 있습니다. 여러 메시지 프로세서가 API 요청을 처리하도록 구성된 경우 각 메시지 프로세서가 자신이 처리하는 요청의 '수'를 유지하기 때문에 할당량을 초과할 가능성이 높습니다.
예를 들어 설명해 보겠습니다. API 프록시에 다음과 같은 할당량 정책이 있다고 가정합니다.
[[["이해하기 쉬움","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-08-18(UTC)"],[[["\u003cp\u003eThis document covers Apigee and Apigee hybrid documentation, specifically focusing on the Quota policy for managing API request limits.\u003c/p\u003e\n"],["\u003cp\u003eWhen multiple Message Processors serve API requests, each maintains an independent quota count, which can lead to exceeding the intended total request limit.\u003c/p\u003e\n"],["\u003cp\u003eThe impact of independent quota counts across message processors includes potential stress on backend servers and possible 503 errors due to excessive traffic.\u003c/p\u003e\n"],["\u003cp\u003eSetting the \u003ccode\u003e<Distributed>\u003c/code\u003e element to \u003ccode\u003etrue\u003c/code\u003e within the Quota policy ensures a unified counter across all Message Processors, aligning the actual request limit with the configured quota.\u003c/p\u003e\n"]]],[],null,["*You're viewing **Apigee** and **Apigee hybrid** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/antipatterns/non-distributed-quota) documentation.*\n\nApigee provides the ability to configure the number of allowed requests to an API Proxy for\na specific period of time using the [Quota policy](/apigee/docs/api-platform/reference/policies/quota-policy).\n\nAntipattern\n\nAn API proxy request can be served by one or more distributed Apigee components called\n*Message Processors*. If there are multiple Message Processors configured for serving API\nrequests, then the quota will likely be exceeded because each Message Processor keeps it's own\n\"count\" of the requests it processes.\n\nLet's explain this with the help of an example. Consider the following [Quota policy](/apigee/docs/api-platform/reference/policies/quota-policy) for an API\nproxy: \n\n```world-of-warcraft-toc\n\u003c!-- /antipatterns/examples/1-6.xml --\u003e\n\u003cQuota name=\"CheckTrafficQuota\"\u003e\n \u003cInterval\u003e1\u003c/Interval\u003e\n \u003cTimeUnit\u003ehour\u003c/TimeUnit\u003e\n \u003cAllow count=\"100\"/\u003e\n\u003c/Quota\u003e\n```\n\nThe above configuration should allow a total of 100 requests per hour.\n\nIn practice, however, when multiple message processors are serving the API requests, the\nfollowing happens:\n\nIn the above illustration:\n\n- The quota policy is configured to allow 100 requests per hour.\n- The requests to the API Proxy are being served by two Message Processors.\n- Each Message Processor maintains its own quota count variable, `quota_count_mp1` and `quota_count_mp2`, to track the number of requests they are processing.\n- Therefore each of the Message Processor will allow 100 API requests separately. The net effect is that a total of 200 requests are processed instead of 100 requests.\n\nImpact\n\nThis situation defeats the purpose of the quota configuration and can have detrimental effects on\nthe backend servers that are serving the requests.\n\nThe backend servers can:\n\n- Be stressed due to higher than expected incoming traffic\n- Become unresponsive to newer API requests leading to 503 errors\n\nBest Practice\n\nConsider, setting the `\u003cDistributed\u003e` element to `true` in the [Quota policy](/apigee/docs/api-platform/reference/policies/quota-policy) to\nensure that a common counter is used to track the API requests across all Message Processors.\nThe `\u003cDistributed\u003e` element can be set as shown in the code snippet below: \n\n```world-of-warcraft-toc\n\u003c!-- /antipatterns/examples/1-7.xml --\u003e\n\u003cQuota name=\"CheckTrafficQuota\"\u003e\n \u003cInterval\u003e1\u003c/Interval\u003e\n \u003cTimeUnit\u003ehour\u003c/TimeUnit\u003e\n \u003cDistributed\u003etrue\u003c/Distributed\u003e\n \u003cAllow count=\"100\"/\u003e\n\u003c/Quota\u003e\n```"]]