Updated on 2025-08-29 GMT+08:00

Configuring a Fault Tolerance Policy

If an exception occurs when a microservice consumer accesses a provider, for example, the instance network is disconnected, the request needs to be forwarded to another available instance. Fault tolerance is often referred to as retry.

Prerequisites

You have created a microservice by referring to Creating a Microservice. After the microservice starts, the service instance is registered with the corresponding service based on the configurations in the YAML file. If the microservice is not created in advance or has been deleted, the microservice is automatically created when the service instance is registered.

Configuring Fault Tolerance

  1. Click the target engine.
  2. Choose Microservice Governance.

    • For engines with security authentication disabled, go to 4.
    • For engines with security authentication enabled, if the login VDC user is the user imported in Importing an IAM Account, go to 4. For other users, go to 3.

  3. In the displayed Security Authentication dialog box, enter the account name and password, and click OK.

  4. Click the target microservice. Click Fault Tolerance.
  5. Click New and select a proper policy. The following table describes the configuration items of fault tolerance.

    Figure 1 Configuring fault tolerance (for microservices accessed through Spring Cloud)
    Figure 2 Configuring fault tolerance (for microservices accessed through Java chassis)

    Parameter

    Description

    Downstream Microservice

    This configuration applies to microservices accessed through Spring Cloud.

    Configure fault tolerance for the microservice to invoke the downstream microservice. You can select a downstream microservice from the drop-down list.

    Fault Tolerance Object

    This configuration applies to microservices accessed through Java chassis.

    Microservice or method that the application relies on.

    Fault Tolerance

    Open: The system processes a request sent to the fault tolerance object based on the selected fault tolerance policy when the request encounters an error.

    Close: The system waits until the timeout interval expires and then returns the failure result even though the service request fails to be implemented.

    FT Policy

    This parameter is mandatory when Fault Tolerance is set to Open.

    For microservices accessed through Spring Cloud, set the following parameters:
    • Number of attempts to the same microservice instance
    • Number of attempts to the new microservice instance
    For microservices accessed through Java chassis, set the following parameters:
    • Failover

      The system attempts to connect to different servers.

    • Failfast

      The system does not attempt to connect to a server. After a request fails, a failure result is returned immediately.

    • Failback

      The system attempts to connect to the same server.

    • custom
      • Request Attempts of One Server: number of attempts to connect to the same server
      • Request Attempts of a New Server: number of attempts to connect to another server

  6. Click OK.