Go 1.11은 지원이 종료되었으며 2026년 1월 31일에
지원 중단됩니다. 지원 중단 후에는 조직에서 이전에 조직 정책을 사용하여 레거시 런타임의 배포를 다시 사용 설정한 경우에도 Go 1.11 애플리케이션을 배포할 수 없습니다. 기존 Go 1.11 애플리케이션은
지원 중단 날짜 이후에도 계속 실행되고 트래픽을 수신합니다.
지원되는 최신 Go 버전으로 마이그레이션하는 것이 좋습니다.
준비 요청 구성으로 성능 향상
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
준비 요청을 사용하면 앱 코드가 새로 생성된 인스턴스에 로드되는 동안 요청 및 응답의 지연 시간을 줄일 수 있습니다.
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
으로 전송된 요청을 처리하는 핸들러를 만듭니다.
핸들러는 앱에 필요한 준비 로직을 수행해야 합니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-09-04(UTC)
[[["이해하기 쉬움","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 reduce latency by loading your app's code into a new instance before live requests arrive, avoiding delays caused by loading requests.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine uses warmup requests to initialize new instances when needed, such as during redeployments, increased traffic, or infrastructure maintenance.\u003c/p\u003e\n"],["\u003cp\u003eWarmup requests are triggered by App Engine issuing \u003ccode\u003eGET\u003c/code\u003e requests to \u003ccode\u003e/_ah/warmup\u003c/code\u003e, and you can implement handlers for this endpoint to perform tasks like pre-caching.\u003c/p\u003e\n"],["\u003cp\u003eEnabling warmup requests involves adding the \u003ccode\u003ewarmup\u003c/code\u003e element under the \u003ccode\u003einbound_services\u003c/code\u003e directive in your \u003ccode\u003eapp.yaml\u003c/code\u003e file, which activates the feature.\u003c/p\u003e\n"],["\u003cp\u003eWhile warmup requests aim to prevent loading requests, they are not guaranteed in all situations, such as when an instance is the very first one being started or if there is a sudden surge in traffic.\u003c/p\u003e\n"]]],[],null,["# Configuring Warmup Requests to Improve Performance\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/legacy/standard/go111/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.\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/legacy/standard/go111/config/appref#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/legacy/standard/go111/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/legacy/standard/go111/config/appref#inbound_services)\ndirective in your `app.yaml` file, for example: \n\n inbound_services:\n - warmup\n\n\u003cbr /\u003e\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\n\n // Sample warmup demonstrates usage of the /_ah/warmup handler.\n package main\n\n import (\n \t\"context\"\n \t\"fmt\"\n \t\"log\"\n \t\"net/http\"\n \t\"os\"\n \t\"time\"\n\n \t\"cloud.google.com/go/storage\"\n )\n\n var startupTime time.Time\n var client *storage.Client\n\n func main() {\n \t// Perform required setup steps for the application to function.\n \t// This assumes any returned error requires a new instance to be created.\n \tif err := setup(context.Background()); err != nil {\n \t\tlog.Fatalf(\"setup: %v\", err)\n \t}\n\n \t// Log when an appengine warmup request is used to create the new instance.\n \t// Warmup steps are taken in setup for consistency with \"cold start\" instances.\n \thttp.HandleFunc(\"/_ah/warmup\", func(w http.ResponseWriter, r *http.Request) {\n \t\tlog.Println(\"warmup done\")\n \t})\n \thttp.HandleFunc(\"/\", indexHandler)\n\n \tport := os.Getenv(\"PORT\")\n \tif port == \"\" {\n \t\tport = \"8080\"\n \t\tlog.Printf(\"Defaulting to port %s\", port)\n \t}\n\n \tlog.Printf(\"Listening on port %s\", port)\n \tif err := http.ListenAndServe(\":\"+port, nil); err != nil {\n \t\tlog.Fatal(err)\n \t}\n }\n\n // setup executes per-instance one-time warmup and initialization actions.\n func setup(ctx context.Context) error {\n \t// Store the startup time of the server.\n \tstartupTime = time.Now()\n\n \t// Initialize a Google Cloud Storage client.\n \tvar err error\n \tif client, err = storage.NewClient(ctx); err != nil {\n \t\treturn err\n \t}\n\n \treturn nil\n }\n\n // indexHandler responds to requests with our greeting.\n func indexHandler(w http.ResponseWriter, r *http.Request) {\n \tif r.URL.Path != \"/\" {\n \t\thttp.NotFound(w, r)\n \t\treturn\n \t}\n \tuptime := time.Since(startupTime).Seconds()\n \tfmt.Fprintf(w, \"Hello, World! Uptime: %.2fs\\n\", uptime)\n }\n\n\n\u003cbr /\u003e"]]