All Products
Search
Document Center

Microservices Engine:Configure graceful start and shutdown in YAML

Last Updated:Mar 11, 2026

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.

Important

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:

  1. 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.

  2. 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-up

Graceful shutdown protects traffic when an instance terminates:

  1. 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.

ParameterDescriptionDefault
mse.lossless.enableEnable graceful start. Valid values: 'true', 'false'.'false'
mse.lossless.delayTimeRegistration delay in seconds. MSE waits this long after the application starts before registering the service with Microservices Registry.'0'
mse.lossless.warmupTimeWarmup duration in seconds. After service registration, MSE gradually increases traffic to the instance over this period.'120'
mse.lossless.noticeEnable 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:

Add MSE labels to your Deployment

  1. Open the Deployment YAML for your application on the Workloads page.

  2. Add the MSE labels under spec.template.metadata.labels: Replace the following placeholders with your values:

    PlaceholderDescription
    <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>
  3. Save and apply the YAML. The application restarts with the new configuration.

Note

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

  1. Log on to the MSE console and select a region.

  2. In the left-side navigation pane, choose Microservices Governance > Application Governance.

  3. On the Application list page, click the resource card of the target application.

  4. In the left-side navigation pane, click Traffic management, and then click the Graceful Start/Shutdown tab.

  5. 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.

Related topics