For online applications, operations such as release, scale-out, scale-in, and restart are necessary. Microservices Engine (MSE) provides the graceful start and shutdown features to protect applications when you perform the preceding operations. The graceful start and shutdown features provide capabilitues such as service prefetching, delayed service registration, and proactive notification. This topic describes how to configure the graceful start and shutdown features in YAML.
Configure a graceful start and shutdown rule
Enable MSE Microservices Governance for a microservice application in the ACK cluster. For more information, see Enable Microservices Governance for microservice applications in an ACK cluster.
On the Workloads page of the application, configure the parameters. For more information about the parameters, see Graceful start and Graceful shutdown.
The parameters are configured in spec > template > metadata > labels.
The following table describes the parameters.
Parameter
Description
Default value
mse.lossless.enable
Specifies whether to enable the graceful start feature.
true
false
false
mse.lossless.warmupTime
The prefetching duration. Unit: seconds.
120
mse.lossless.delayTime
The latency of service registration. Unit: seconds. If you specify a value of x for this parameter, the application or service is registered with Microservices Registry x seconds after the application is started.
0
mse.lossless.notice
Specifies whether to proactively send notifications to the consumer when the provider is shut down.
false
Sample code:
mse.lossless.enable: 'true' mse.lossless.delayTime: '30' mse.lossless.warmupTime: '60' mse.lossless.notice: 'false'
Verify the result
Log on to the MSE console, and select a region in the top navigation bar.
In the left-side navigation pane, choose Microservices Governance > Application Governance.
On the Application list page, click the resource card of the destination application.
In the left-side navigation pane, click Traffic management. On the Graceful Start/Shutdown tab of the page that appears, check that the configurations of the graceful start rule are the same as the configurations in YAML. When you start or shut down the application, you can check that the events and queries per second (QPS) trend chart match the configurations in YAML on the Graceful Start/Shutdown tab of the Traffic management page.
After you configure a graceful start and shutdown rule in YAML, the application is immediately restarted. After the application is restarted, the configured rule takes effect.
If you do not configure the parameters of a graceful start and shutdown rule in YAML, the default values of the parameters are automatically used.
If you modify a graceful start and shutdown rule for an application by using YAML on the Workloads page of the application and also modify the rule in the MSE console, the modification performed by using YAML takes precedence. If you modify a graceful start and shutdown rule in the MSE console, the rule configured by using YAML overwrites the existing rule in the console after the application is restarted.