Routing is the core traffic control mechanism in Dubbo. Based on it, we can implement canary releases, proportional traffic forwarding, same-region prioritization, full-link grayscale, and other traffic strategies. The design and basic principles of the routing (Router) mechanism in Dubbo, along with several built-in routing rules.
The built-in traffic strategies in Dubbo are very flexible, but there is also a certain understanding and usage cost. Therefore, we summarize some common usage scenarios and provide configuration methods:
| Scenario | Effect | Target | Description |
|---|---|---|---|
| Timeout | |||
| Access Log | |||
| Call Retry |
Next, let’s take a conditional routing example to see how to use the Dubbo traffic control mechanism.
The requirements are very straightforward.
!Draw a diagram of traffic matching and forwarding
This is implemented in Dubbo through conditional routing, and its detailed working principle is explained in our introduction. In the above example, xxx represents; yyy represents.
We need to deploy the rules to the running Dubbo SDK. In the Dubbo system, this is done as follows.
!Routing Rule Distribution and Effect Principle Diagram
A zk/nacos distributes a rule, and the Dubbo instance receives the rule push. During the RPC call, rules are applied to filter, selecting a subset of addresses to call.
Kubernetes Best Practices.At this point, if we send a request to the xxx service,
There is one very important point.
Dubbo Routing Rule Troubleshooting MethodsScript RoutingExtending Dubbo's Routing Implementation