[[["易于理解","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\u003eApp Engine uses instances as computing units to automatically scale applications, and requests are distributed across one or more instances.\u003c/p\u003e\n"],["\u003cp\u003eInstances undergo periodic health checks, which include liveness checks to verify the instance and container are running, and readiness checks to ensure the instance is ready to accept requests.\u003c/p\u003e\n"],["\u003cp\u003eInstances can be in various states such as healthy, unhealthy, lameduck, or app lameduck, reflecting their operational status and ability to handle requests.\u003c/p\u003e\n"],["\u003cp\u003eAutomatic scaling adjusts the number of instances based on request rates and application metrics, while manual scaling runs a fixed number of instances regardless of load.\u003c/p\u003e\n"],["\u003cp\u003eServices and versions within App Engine can be managed, stopped, or deleted through the Google Cloud console or gcloud CLI.\u003c/p\u003e\n"]]],[],null,["# How instances are managed\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nInstances are the computing units that App Engine uses to automatically\nscale your\n[application](/appengine/docs/an-overview-of-app-engine).\nAt any given time, your application can be running on one instance or many\ninstances, with requests being spread across all of them.\n\nYour instances with manual scaling should run indefinitely, but\nthere is no uptime guarantee as instances can get early termination due to failures or restart for the updates. Hardware or software failures that cause early\ntermination or frequent restarts can occur without warning and can take\nconsiderable time to resolve.\n\nAll flexible instances may be restarted on a weekly basis\nif there are updates available. This schedule is not guaranteed.\nDuring restarts,\ncritical, backwards-compatible updates are automatically rolled out to the\nunderlying operating system. Your application's image will remain the same\nacross restarts.\n\nHealth checking\n---------------\n\nApp Engine sends periodic health check requests to confirm that an instance\nis running, and to check that an instance is fully\nstarted and ready to accept incoming requests. By default, these health checks\nare enabled and are known as **split health checks**. An instance that receives\na health check must answer the health check within a specified time interval.\n\nIf you need to extend the default behavior of split health checks to your\napplication, you can customize the [`app.yaml`](/appengine/docs/flexible/reference/app-yaml#updated_health_checks) file to configure two types of health checks:\n\n- **Liveness checks** detect that a VM instance and its container are running. When a VM instance fails the liveness check, the instance is restarted automatically. Liveness checks can fail due to the configured thresholds and time intervals, or due to the container crashing.\n- **Readiness checks** detect that a VM instance is ready to accept incoming requests. If a VM instance fails the readiness check, it means that the VM instance has not finished its startup and is not ready to receive requests. When the VM instance passes the readiness check and has completed its startup, it is added to the pool of available instances.\n\nLearn more about split health check behaviors in the [Migrating to Split Health Checks](/appengine/docs/flexible/migrating-to-split-health-checks) guide.\n\nAs the instance goes through these health checks, the\n[App Engine logs](https://console.cloud.google.com/logs/query) can indicate that the\ninstance is in any of the following states:\n\n- **Healthy** . The instance received the health check requests and is processing the requests. A healthy status indicates that the instance has more than 820 MB of available disk space and should respond to a health check with an HTTP status code of `200`.\n- **Unhealthy**. The instance refused the health check requests and failed to respond to a specified number of consecutive health check requests. App Engine continues to send health check requests and restarts the instance if an unhealthy instance continues to fail to respond to a predetermined number of consecutive health checks.\n- **Lameduck** . The instance is scheduled to be shut down or restarted. During shutdowns, the instance finishes up ongoing requests, and refuses new requests. The app returns a `503` code to indicate that the instance is unable to handle requests. Before an instance shuts down or restarts, the shutdown script has a limited time period to run, and cannot be configured to be shorter or longer.\n- **App Lameduck** . The instance is preparing to serve traffic. The app returns a `503` code to indicate that the instance is unable to handle requests. When a VM instance has completed startup and is ready to serve traffic, the instance will become healthy and process requests. If a VM instance does not start up in time, the instance changes to unhealthy and gets removed.\n\nBoth lameduck and app lameduck behaviors are part of a normal process that the\nVM instance goes through.\n\nMonitoring resource usage\n-------------------------\n\nThe Instances page of the [Google Cloud console](https://console.cloud.google.com/appengine/instances) provides visibility into how your instances are performing. You can see the memory and CPU usage of each instance, uptime, number of requests, and other statistics. You can also manually initiate the shutdown process for any instance.\n\nNTP with App Engine flexible environment\n----------------------------------------\n\nThe App Engine flexible environment has network time protocol (NTP) services which use Google NTP\nservers. However, the NTP services in the flexible environment is not editable.\n\nInstance location\n-----------------\n\nInstances are automatically located by geographical region according to the\n[project settings](/appengine/docs/flexible/managing-projects-apps-billing).\n\nInstance scaling\n----------------\n\nWhile an application is running, incoming requests are routed to an existing or\nnew instance of the appropriate service/version. Each active version must have\nat least one instance running, and the scaling type of a service/version\ncontrols how additional instances are created.\nYou specify the scaling type in your app's\n[`app.yaml`](/appengine/docs/flexible/reference/app-yaml#services).\nBy default, your app uses automatic scaling, which means App Engine will\nmanage the number of idle instances.\n\nAutomatic scaling\n: Automatic scaling creates instances based on request rate, response latencies,\n and other application metrics. You can specify thresholds for each of these\n metrics, as well as a minimum number instances to keep running at all times\n by configuring the [`automatic_scaling`](/appengine/docs/flexible/reference/app-yaml#automatic_scaling) element.\n\nManual scaling\n: Manual scaling specifies the number of instances that continuously run\n regardless of the load level. This allows tasks such as complex initializations\n and applications that rely on the state of the memory over time.\n\nManage services\n---------------\n\nDepending on the [scaling type](#instance_scaling) of your instance, you can manage\nservices and versions in the Google Cloud console or Google Cloud CLI.\n\n### Stop a version\n\nEach version in App Engine runs within one or more instances, depending\non how much traffic you configured it to handle.\n\nClick the tab for instructions on using the tool of your choice: \n\n### Console\n\nTo stop or disable a version for your service:\n\n1. Go to the App Engine **Versions** page in the Google Cloud console:\n\n [Go to Versions](https://console.cloud.google.com/appengine/versions)\n2. Select a version from the table, and click **Stop**.\n\n### gcloud\n\nRun the following: \n\n gcloud app versions stop --service=\u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e\n\nReplace:\n\n- \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e with the name of your service.\n- \u003cvar translate=\"no\"\u003eVERSION\u003c/var\u003e with the version name of your service.\n\n### Delete a service\n\nEach service can be configured to use different runtimes and to operate with\ndifferent performance settings. You can't delete the default service. Deleting a\nservice also deletes all of its accompanying versions in your project.\n\nClick the tab for instructions on using the tool of your choice: \n\n### Console\n\nTo delete a service:\n\n1. Go to the App Engine **Services** page in the Google Cloud console:\n\n [Go to Services](https://console.cloud.google.com/appengine/services)\n2. Select a service from the table, and click **Delete**.\n\n### gcloud\n\nRun the following: \n\n gcloud app services delete \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e\n\nReplace:\n\n- \u003cvar translate=\"no\"\u003eSERVICE\u003c/var\u003e with the name of your service."]]