준비 요청을 사용하면 앱 코드가 새로 생성된 인스턴스에 로드되는 동안 요청 및 응답의 지연 시간을 줄일 수 있습니다.
App Engine이 새 인스턴스에 앱 코드를 로드해야 하는 경우가 종종 있습니다. 다음과 같은 상황에서 인스턴스를 로드할 수 있습니다.
특정 버전의 앱을 다시 배포하는 경우
요청의 부하가 현재 실행 중인 인스턴스 집합의 용량을 초과해 새 인스턴스가 생성되는 경우
기본 인프라나 실제 하드웨어를 유지보수 및 수리하는 경우
앱 코드를 새 인스턴스에 로드하면 로드 요청이 발생할 수 있습니다.
로드 요청으로 인해 사용자의 요청 지연 시간이 증가할 수 있으나 준비 요청을 사용하면 이러한 지연 시간을 방지할 수 있습니다. 준비 요청은 실시간 요청이 새 인스턴스에 도달하기 전에 앱 코드를 이 인스턴스에 로드합니다.
준비 요청은 다른 요청과 마찬가지로 요청 시간 제한이 적용됩니다.
애플리케이션에 준비 요청을 사용 설정하면 App Engine이 애플리케이션에 새 인스턴스가 필요한 시점을 감지하고 준비 요청을 시작하여 새 인스턴스를 초기화합니다. 하지만 이러한 감지 시도가 항상 성공하는 것은 아닙니다. 따라서 앱에 준비 요청이 사용 설정되어 있더라도 로드 요청이 발생할 수 있습니다. 예를 들어 앱에서 어떠한 트래픽도 처리하고 있지 않으면 앱에 대한 최초 요청은 항상 준비 요청이 아닌 로드 요청이 됩니다.
준비 요청은 App Engine 애플리케이션에 대한 다른 요청과 마찬가지로 인스턴스 시간을 사용합니다. 준비 요청을 사용 설정한 경우 대부분 애플리케이션은 로드 요청이 아닌 준비 요청에서 초기화되므로 인스턴스 시간이 거의 증가하지 않습니다. 그러나 준비 요청 중에 사전 캐싱과 같은 추가 작업을 수행하면 인스턴스 시간 사용량이 증가할 수 있습니다. min_idle_instances를 0보다 높게 설정하면 인스턴스가 처음 시작될 때 준비 요청이 발생할 수 있지만 그 후에도 인스턴스를 계속 사용할 수 있습니다.
준비 요청 사용 설정
준비 요청은 사용자가 제공한 구성에 맞게 인스턴스 자동 확장을 제어하는 App Engine 스케줄러에서 사용됩니다. 준비 요청을 사용 설정하면 App Engine이 /_ah/warmup에 GET 요청을 보냅니다. 이 요청에 필요한 핸들러를 구현하여 애플리케이션 데이터 사전 캐싱과 같은 애플리케이션별 태스크를 수행할 수 있습니다.
스케줄러는 인스턴스가 더 많이 필요하다고 판단하면 인스턴스를 시작합니다. 스케줄러는 준비 요청을 사용하여 인스턴스를 시작하므로, 준비 요청이 중지되더라도 로그에 나타날 수 있습니다.
준비 요청이 항상 호출되는 것은 아닙니다. 예를 들어 첫 번째로 시작되는 인스턴스이거나 트래픽 양이 갑자기 증가하는 등의 일부 경우에는 로드 요청이 대신 전송됩니다. 하지만 준비 요청이 사용 설정된 경우에는 이미 준비된 인스턴스에 요청을 보내는 것이 '최고의 방법'입니다.
준비 요청을 사용 설정하려면 app.yaml 파일의 inbound_services 지시문에 warmup 요소를 추가합니다. 예를 들면 다음과 같습니다.
inbound_services:
- warmup
핸들러 만들기
/_ah/warmup으로 전송된 요청을 처리하는 핸들러를 만듭니다.
핸들러는 앱에 필요한 준비 로직을 수행해야 합니다.
[[["이해하기 쉬움","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\u003eWarmup requests help reduce latency by loading your app's code into new instances before live requests arrive, avoiding delays caused by loading requests.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine uses warmup requests to initialize new instances in situations like deployments, increased traffic, or infrastructure maintenance, but they are not guaranteed in every scenario.\u003c/p\u003e\n"],["\u003cp\u003eEnabling warmup requests in your \u003ccode\u003eapp.yaml\u003c/code\u003e file with the \u003ccode\u003einbound_services: - warmup\u003c/code\u003e directive allows App Engine to send \u003ccode\u003eGET\u003c/code\u003e requests to \u003ccode\u003e/_ah/warmup\u003c/code\u003e for instance initialization.\u003c/p\u003e\n"],["\u003cp\u003eYou can create a handler for the \u003ccode\u003e/_ah/warmup\u003c/code\u003e path to execute application-specific tasks, such as pre-caching data, during the warmup process.\u003c/p\u003e\n"],["\u003cp\u003eWarmup requests do consume instance hours, however in most cases they will replace loading requests and will not result in an increase in instance hours, and an increase in instance hour usage may occur if more tasks are done during warmup.\u003c/p\u003e\n"]]],[],null,["# Configuring warmup requests to improve performance\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\nGo Java Node.js PHP Python Ruby\n\nYou can use warmup requests to reduce request and response latency during the\ntime when your app's code is being loaded to a newly created instance.\n\nApp Engine frequently needs to load your app's code into a fresh\ninstance. Loading an instance can happen in the following situations:\n\n- When you redeploy a version of your app.\n- When new instances are created due to the load from requests exceeding the capacity of the current set of running instances.\n- When maintenance and repairs of the underlying infrastructure or physical hardware occur.\n\nLoading your app's code to a new instance can result in [loading\nrequests](/appengine/docs/standard/how-instances-are-managed#loading_requests).\nLoading requests can result in increased request latency for your users, but you\ncan avoid this latency using *warmup requests*. Warmup requests load your\napp's code into a new instance before any live requests reach that instance.\nWarmup requests, like other requests, are subject to the request timeout.\n\nIf warmup requests are enabled for your application, App Engine attempts\nto detect when your application needs a new instance and initiates a warmup\nrequest to initialize a new instance. However, these detection attempts do not\nwork in every case. As a result, you might encounter loading requests, even if\nwarmup requests are enabled in your app. For example, if your app is serving no\ntraffic, the first request to the app will always be a loading request, not a\nwarmup request.\n\nWarmup requests use instance hours like any other request to your\nApp Engine application. In most cases where warmup requests are enabled,\nyou won't notice an increase in instance hours because your application is\nsimply initializing in a warmup request instead of a loading request. Your\ninstance hour usage can increase if you decide to do more work, such as\npre-caching during a warmup request. If you set\n[`min_idle_instances`](/appengine/docs/standard/reference/app-yaml#min_idle_instances)\nto greater than `0`, you might encounter warmup requests when those instances\nfirst start, but they will remain available after that time.\n\nEnabling warmup requests\n------------------------\n\nWarmup requests are used by the App Engine scheduler, which controls the\nauto scaling of instances based on user-supplied configuration. With warmup\nrequests enabled, App Engine issues `GET` requests to `/_ah/warmup`. You\ncan implement handlers for this request to perform application-specific tasks,\nsuch as pre-caching application data.\n\nThe scheduler starts up instances when it determines that more instances are\nneeded. Warmup requests may appear in\n[logs](/appengine/docs/standard/writing-application-logs#viewing_logs)\neven if they are disabled because the scheduler uses them to start instances.\n\nNote that warmup requests are not guaranteed to be called. In some situations\nloading requests are sent instead: for example, if the instance is the first one\nbeing started up, or if there is a steep ramp-up in traffic. However, there\nwill be a \"best effort\" attempt to send requests to already warmed-up instances\nif warmup requests are enabled.\n\nTo enable warmup requests, add the `warmup` element under the\n[`inbound_services`](/appengine/docs/standard/reference/app-yaml#inbound_services)\ndirective in your `app.yaml` file, for example: \n\n inbound_services:\n - warmup\n\nCreating your handler\n---------------------\n\nCreate a handler that will process the requests that are sent to `/_ah/warmup`.\nYour handler should perform any warmup logic that is needed by your app.\n\n\u003cbr /\u003e"]]