Welcome everyone to pay attention to my public number [old week chat architecture], The principle of Java backend mainstream technology stack, source code analysis, architecture and a variety of Internet high concurrency, high performance, high availability solutions.
First, similarities
Dubbo and Feign both rely on registries and load balancing.
Second, the difference between
1, the agreement
Dubbo:
- Support for multiple transport protocols (Dubbo, Rmi, HTTP, Redis, etc.), depending on the business scenario. Very flexible.
- Default Dubbo protocol: use
Netty
.TCP
Transmission, single, asynchronous,A long connection
, suitable for scenarios with small data volumes, high concurrency, and far fewer service providers than consumers.
Feign:
Based on Http transport protocol, short connection, not suitable for high concurrency access.
2. Load balancing
Dubbo:
- Four algorithms (random, polling, activity, Hash consistency) are supported, and the concept of weight is introduced into the algorithm.
- Configuration forms support not only code configuration, but also flexible dynamic configuration for the Dubbo console.
- The load balancing algorithm can be accurate to a certain method of a certain service interface.
Feign:
- Only N policies are supported: polling, random, and ResponseTime weighting.
- The load balancing algorithm is client-level.
3. Fault tolerance strategy
Dubbo:
Supports multiple fault tolerance policies, such as failover, failfast, brodecast, and forking. Parameters such as retry times and timeout are also introduced.
Feign:
The use of circuit breakers to achieve fault tolerance, the way of processing is different.