During releases, scaling, and restarts, microservice instances go offline and come back online. Without protection, new instances receive requests before initialization completes, and terminating instances drop in-flight requests. Microservices Engine (MSE) prevents traffic loss during these transitions through delayed service registration, warmup-based traffic ramping, and proactive consumer notification. You configure these behaviors by adding labels to your Kubernetes Deployment YAML.
Changing these labels triggers an immediate pod restart. Apply changes during a maintenance window or use a rolling update strategy to avoid service disruption.
How it works
Graceful start controls how a new instance receives traffic:
After the application starts, MSE waits for the delay period (
delayTime) before registering the service with Microservices Registry. This gives the application time to finish initialization tasks such as loading configuration, establishing database connections, or building caches.Once registered, MSE gradually ramps up traffic to the instance over the warmup period (
warmupTime) instead of sending full traffic immediately. This allows caches, connection pools, and JIT compilation to warm up under increasing load.
App starts --> [delayTime] --> Service registered --> [warmupTime] --> Full traffic
wait before registry sees the gradual
registering instance ramp-upGraceful shutdown protects traffic when an instance terminates:
When shutdown notification is enabled (
notice), MSE proactively notifies consumers to stop sending new requests to the terminating instance.
Parameters
Add the following labels under spec.template.metadata.labels in your Deployment YAML. All values must be quoted strings.
| Parameter | Description | Default |
|---|---|---|
mse.lossless.enable | Enable graceful start. Valid values: 'true', 'false'. | 'false' |
mse.lossless.delayTime | Registration delay in seconds. MSE waits this long after the application starts before registering the service with Microservices Registry. | '0' |
mse.lossless.warmupTime | Warmup duration in seconds. After service registration, MSE gradually increases traffic to the instance over this period. | '120' |
mse.lossless.notice | Enable shutdown notification. When set to 'true', MSE notifies consumers to stop routing traffic to the provider before it shuts down. Valid values: 'true', 'false'. | 'false' |
Configure graceful start and shutdown
Prerequisites
Before you begin, make sure that you have:
A microservice application deployed in a Container Service for Kubernetes (ACK) cluster
MSE Microservices Governance enabled for the application. For more information, see Enable Microservices Governance for microservice applications in an ACK cluster
Add MSE labels to your Deployment
Open the Deployment YAML for your application on the Workloads page.
Add the MSE labels under
spec.template.metadata.labels: Replace the following placeholders with your values:Placeholder Description <your-app-name>Your application name <your-image>Your container image apiVersion: apps/v1 kind: Deployment metadata: name: <your-app-name> spec: replicas: 3 selector: matchLabels: app: <your-app-name> template: metadata: labels: app: <your-app-name> # Graceful start and shutdown configuration mse.lossless.enable: 'true' mse.lossless.delayTime: '30' mse.lossless.warmupTime: '60' mse.lossless.notice: 'false' spec: containers: - name: <your-app-name> image: <your-image>Save and apply the YAML. The application restarts with the new configuration.
If you do not configure these parameters in YAML, the default values listed in the parameter table are automatically used. If you also modify the rule in the MSE console, the YAML configuration takes precedence. After the next restart, the YAML labels overwrite the console settings.
Verify the configuration
Log on to the MSE console and select a region.
In the left-side navigation pane, choose Microservices Governance > Application Governance.
On the Application list page, click the resource card of the target application.
In the left-side navigation pane, click Traffic management, and then click the Graceful Start/Shutdown tab.
Confirm that the parameter values match your YAML configuration. During the next start or shutdown event, the events and QPS trend chart on this tab reflect the configured warmup and notification behavior.