×
Community Blog A Practical Guide on Dubbo-Admin Function Display and Operations

A Practical Guide on Dubbo-Admin Function Display and Operations

In this article, we will explore several features of Dubbo-Admin and share some tips on how to use it effectively.

Service Information

The service list of Dubbo displays the provided service information in the dimension of interface, and is distinguished by interface level or application level of the registration source.

1

The service details page displays information on providers and consumers and methods of interfaces.

2

Dynamic Routing

Conditional Routing

Conditional routing can write some customized routing rules to meet some service governance requirements, such as black and white lists and read/write splitting. Conditional routing can create rules at the interface level and consumer application level.

To create a conditional routing rule, you need to fill in the information about interface, version, and group (but if there is no information on version and group, it is not necessary to fill in). The following figure shows a simple configuration of a blacklist. The left side of the => icon represents the consumer matching condition, and the right side represents the provider matching condition (no information means no matching). For details of the rule, refer to the official website (see the related link at the end of this article).

Therefore, the configuration means a consumer whose consumer IP is 192.168.1.3 does not receives services offered by a provider.

3

Label-based Routing

By dividing providers of one or more services into the same group, label-based routing limits traffic within the specified group to realize traffic isolation and provides basic capabilities for blue-green deployments and canary releases. To create a rule at the provider application level, the static tag is:

dubbo.provider.tag=tag1``````
@DubboService(tag = "tag2")

4

Mesh Routing

Mesh routing is a new traffic management policy introduced in Dubbo 3.0. It supports more matching conditions and combinations of conditions to easily implement various routing functions. It divides the entire traffic management into two parts, VirtualService and DestinationRule. VirtualService matches ingress traffic, and DestinationRule matches egress traffic. For more information, refer to the document (and see the link at the end of this article for details).

Case

The number parameter of an interface org.test.apache.dubbo.interfaces.HelloService#hi(Integer number) is of the integer type. The following rule indicates that when the number is an even number, it matches a provider with a label of v1 (that is, a service whose URL contains the test-version = v1 parameter). When the number is an odd number, it matches a provider with a label of v2 (that is, a service whose URL contains the test-version = v2 parameter). It can mark the service via dubbo.application.parameters.test-version = v1 to realize a simple canary function.

apiVersion: service.dubbo.apache.org/v1alpha1
kind: VirtualService
metadata:
  name: demo/oddEvenRouter
spec:
  dubbo:
  - routedetail:
    - match:
      - method:
          argc: 1
          args:
          - index: 0
            num_value:
              oneof:
              - exact: 0.0
                mod: 2.0
            type: int
          name_match:
            exact: hi
      name: even-route
      route:
      - destination:
          host: demo
          subset: v1
    - match:
      - method:
          argc: 1
          args:
          - index: 0
            num_value:
              oneof:
              - exact: 1.0
                mod: 2.0
            type: int
          name_match:
            exact: hi
      name: odd-route
      route:
      - destination:
          host: demo2
          subset: v2          
    services:
    - exact: org.test.apache.dubbo.interfaces.HelloService                                
---
apiVersion: service.dubbo.apache.org/v1alpha1
kind: DestinationRule
metadata:
  name: test-route
spec:
  host: demo
  subsets:
    - name: v1
      labels:
        test-version: v1
    - name: v2
      labels:
        test-version: v2

Dynamic Configuration

Dynamic configuration provides the ability to dynamically adjust RPC call behavior without restarting, including modifying the timeout period, weight, and policy adjustment of load balancing. It operates at the interface level and the application level. The following figure shows that the timeout period is adjusted to 6000 ms, which is applied to all nodes on the consumer side.

5

Service Testing

The Dubbo service can be tested in the Admin background. Parameters automatically generate a JSON template based on the metadata content.

6
7

Service Mock

Rules can be configured in the Admin background based on the service name and method name.

8

You can use Dubbo references to introduce Mock dependencies and startup parameter -Denable.dubbo.admin.mock=true by adding Java virtual machine (JVM). Thus, you can realize the simulated call of a consumer to a provider when the provider is unavailable, and return the simulated data configured in the Admin.

<denpendency>
    <groupId>org.apache.dubbo.extensions</groupId>
    <artifactId>dubbo-mock-admin</artifactId>
    <version>last</version>
</denpendency>

New Features

  • Application-level service discovery
  • Mesh routing
  • Service mock
  • Permission SPI (Service Provider Interface) extension

References

1) Official Website:
https://dubbo.apache.org/en/docs/v2.7/user/examples/routing-rule/

2) Document:
https://dubbo.apache.org/zh/docs/concepts/traffic-management/ (This document is currently available in Chinese only)

0 0 0
Share on

You may also like

Comments

Related Products