Définir des paramètres d'autoscaling à l'aide de l'explorateur d'API
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Si vous déployez votre application à l'aide des outils de gcloud CLI, tels que gcloud app deploy
, vous pouvez définir les paramètres d'autoscaling suivants dans le fichier de configuration app.yaml
:
min_instances
max_instances
target_throughput_utilization
target_cpu_utilization
Vous pouvez également utiliser l'interface utilisateur de l'explorateur d'API pour définir un paramètre d'autoscaling :
Ouvrez la page de l'explorateur d'API.
Dans le panneau de droite, sous le libellé Essayer cette API, localisez la zone de texte nom, puis saisissez la chaîne de nom de l'application au format suivant :
apps/<YOUR-PROJECT-ID>/services/default/versions/<YOUR-VERSION-ID>
Remplacez YOUR-PROJECT-ID
par l'ID de projet de l'application et <YOUR-VERSION-ID>
par la version de l'application à laquelle vous envoyez la requête. Utilisez le reste de la chaîne comme indiqué.
Dans la zone de texte updateMask, saisissez le nom complet du chemin d'accès à l'objet .json
du paramètre que vous définissez, en utilisant les noms updateMask
de la table ci-dessous :
Nom updateMask |
automatic_scaling.standard_scheduler_settings.max_instances |
automatic_scaling.standard_scheduler_settings.min_instances |
automatic_scaling.standard_scheduler_settings.target_cpu_utilization |
automatic_scaling.standard_scheduler_settings.target_throughput_utilization |
Si vous définissez plusieurs paramètres dans une requête, indiquez le nom du masque pour chaque paramètre, en les séparant par une virgule. Par exemple, si vous définissez le nombre minimal et maximal d'instances, ainsi que l'utilisation du processeur, vous allez utiliser les noms updateMask suivants :
automatic_scaling.standard_scheduler_settings.max_instances,
automatic_scaling.standard_scheduler_settings.min_instances,
automatic_scaling.standard_scheduler_settings.target_cpu_utilization
Dans la zone Corps de la requête, cliquez sur Add request body parameters (Ajouter des paramètres de corps de la requête).
Sélectionnez automaticScaling.
Cliquez sur l'info-bulle d'aide (icône +
), puis sélectionnez standardSchedulerSettings.
Cliquez sur l'info-bulle d'aide, puis sélectionnez le paramètre de programmeur d'autoscaling souhaité et indiquez la valeur désirée.
Pour fournir un autre paramètre de programmeur d'autoscaling, cliquez à nouveau sur l'info-bulle d'aide, sélectionnez le paramètre et indiquez sa valeur.
Voici un exemple de corps de requête renseigné :
{
"automaticScaling": {
"standardSchedulerSettings": {
"maxInstances": 100,
"minInstances": 1,
"targetCpuUtilization": 0.75
}
}
}
Cliquez sur Exécuter. Vous serez peut-être invité à autoriser l'explorateur d'API lors de la première exécution. Le cas échéant, autorisez l'explorateur d'API en suivant les invites.
Vérifiez que les paramètres appliqués sont corrects. Pour ce faire, ouvrez la page des versions d'App Engine du projet, puis cliquez sur Afficher dans la colonne Configuration. Vous devez voir les valeurs que vous venez de définir.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eYou can configure autoscaling parameters for your application using the \u003ccode\u003egcloud app deploy\u003c/code\u003e command and specifying values in the \u003ccode\u003eapp.yaml\u003c/code\u003e file for \u003ccode\u003emin_instances\u003c/code\u003e, \u003ccode\u003emax_instances\u003c/code\u003e, \u003ccode\u003etarget_throughput_utilization\u003c/code\u003e, and \u003ccode\u003etarget_cpu_utilization\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe API explorer user interface allows for the configuration of autoscaling parameters by specifying the \u003ccode\u003eupdateMask\u003c/code\u003e names such as \u003ccode\u003eautomatic_scaling.standard_scheduler_settings.max_instances\u003c/code\u003e and corresponding values in the request body.\u003c/p\u003e\n"],["\u003cp\u003eTo update multiple parameters using the API explorer, you must include each parameter's \u003ccode\u003eupdateMask\u003c/code\u003e name separated by commas within the \u003ccode\u003eupdateMask\u003c/code\u003e field.\u003c/p\u003e\n"],["\u003cp\u003eAfter setting your parameters through the API explorer, you can confirm the new values have been correctly applied by viewing the \u003cem\u003eConfig\u003c/em\u003e column on the App Engine versions page for your project.\u003c/p\u003e\n"]]],[],null,["# Setting Autoscaling Parameters with the API Explorer\n\nIf you use the gcloud CLI tooling to deploy your app, such as\n`gcloud app deploy`,\n\nyou can set the following autoscaling parameters in the\n`app.yaml` configuration file:\n\n- `min_instances`\n- `max_instances`\n- `target_throughput_utilization`\n- `target_cpu_utilization`\n\nYou can also use the API explorer user interface to set an [autoscaling parameter](/appengine/docs/legacy/standard/python/config/appref#scaling_elements):\n\n1. Open the [API explorer\n page](/appengine/docs/admin-api/reference/rest/v1/apps.services.versions/patch).\n\n2. In the right panel under the label *Try This API* , locate the **name**\n text box and enter the application name string in the following format:\n\n apps/\u003cYOUR-PROJECT-ID\u003e/services/default/versions/\u003cYOUR-VERSION-ID\u003e\n\n Replace `YOUR-PROJECT-ID` with your application's project ID, and\n `\u003cYOUR-VERSION-ID\u003e` with the version of the app you are sending the request\n to. Use the rest of the string as shown.\n3. In the **updateMask** text box, enter the full `.json` object path name of the\n parameter you are setting, using `updateMask` names from the table below:\n\n If you are setting more than one parameter in one request, supply the mask\n name for each parameter, separated by a comma. For example, if you are\n setting the min and max instances, and the CPU utilization, use the\n following updateMask: \n\n automatic_scaling.standard_scheduler_settings.max_instances,\n automatic_scaling.standard_scheduler_settings.min_instances,\n automatic_scaling.standard_scheduler_settings.target_cpu_utilization\n\n4. In the **Request body** box, click **Add request body parameters** .\n\n5. Select **automaticScaling**.\n\n6. Click the hint bubble (the `+` icon), then select **standardSchedulerSettings**.\n\n7. Click the hint bubble, then select the desired auto scaling scheduler\n parameter and supply the desired value.\n\n8. To supply another auto scaling scheduler parameter, click the hint bubble\n again, select the parameter, and supply its value.\n\n The following example shows a sample filled out request body: \n\n {\n \"automaticScaling\": {\n \"standardSchedulerSettings\": {\n \"maxInstances\": 100,\n \"minInstances\": 1,\n \"targetCpuUtilization\": 0.75\n }\n }\n }\n\n9. Click **Execute**. You may be prompted to authorize API Explorer the first\n time you run this. If you are prompted, authorize API Explorer by following the\n prompts.\n\n10. Confirm that the correct settings have been applied by opening the\n [App Engine\n versions page](https://console.cloud.google.com/appengine/versions) for your project, and clicking **View** in the\n *Config* column. You should see the values you just set."]]