[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-20。"],[[["\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"]]