In Dubbo, you can configure dynamic configuration rules to dynamically adjust Remote Procedure Call (RPC) calls without application restart. In Dubbo 2.7.0 and later, you can modify dynamic configuration at the service and application levels.

Set a dynamic configuration

  1. At the top of the page, click the tab.
  2. In the Query Result section of the tab, click Create on the right.
  3. In the Create Dynamic Configuration dialog box, set a dynamic configuration rule and click Create.
    Notice In Dubbo service governance of Enterprise Distributed Application Service (EDAS), do not configure weights and load balancing in dynamic configuration. EDAS provides Weight configuration and Load balancing.
    • Service Name: in the format of group/service:version. group and version can be left blank.
    • Example: DUBBO/com.alibaba.edas.HelloService:1.0.0. Application Name: the name of an application created in EDAS.
    • Rule Content: Enter the parameters for dynamic configuration. Example:
      {
        "configVersion": "v2.7",
        "enabled": true,
        "configs": [
          {
            "addresses": [
              "0.0.0.0"
            ],
            "providerAddresses": [
              "1.1.1.1:20880",
              "2.2.2.2:20881"
            ],
            "side": "consumer",
            "parameters": {
              "timeout": "6000",
              "cluster": "failfast"
            }
          },
          {
            "addresses": [
              "0.0.0.0"
            ],
            "side": "consumer",
            "applications/services": [],
            "parameters": {
              "threadpool": "fixed",
              "threads": 200,
              "iothreads": 4,
              "dispatcher": "all"
            }
          }
        ]
      }

      In the preceding configuration example:

      • configVersion: the version of Dubbo.
      • enabled: specifies whether the overwrite rule takes effect. If you leave this parameter unspecified, the overwrite rule takes effect by default.
      • configs: the content of a rule. You can specify n (n >= 1) rule bodies, such as side, applications, services, parameters, addresses, and providerAddresses.

      Clarify the following configurations:

      1. Whether the current configuration is applied to consumers or providers:
        • Consumers: "side": "consumer". When configuring consumers, you can use providerAddress and applications to select provider examples or applications.
        • Providers: "side": "provider".
      2. Scope of the current configuration on application instances:
        • All instances: "addresses": ["0.0.0.0"] or "addresses": ["0.0.0.0:*"], depending on the side value.
        • Specified instances: "addresses": [Instance address list].
      3. Properties to be modified.

Examples of dynamic configuration rules

  • Disable provider applications: this feature is used to temporarily remove a provider instance. To disable access by consumers, apply a routing rule.
    {
        "configVersion": "v2.7",
        "enabled": true,
        "configs": [
          {
            "addresses": ["10.20.153.10:20880"],
            "side": "provider",
            "parameters": {
                "disabled": true
            }
          }
        ]
    }
  • Graceful service degradation: This feature is used to temporarily block an erroneous non-critical service.
    {
        "configVersion": "v2.7",
        "enabled": true,
        "configs": [
          {
            "addresses": ["10.20.153.10:20880"],
            "side": "provider",
            "parameters": {
                "force": "return null"
            }
          }
        ]
    }