dubbo
The java implementation of Apache Dubbo. An RPC and microservice framework.
Top Related Projects
Support for using OpenFeign in Spring Cloud apps
The Java gRPC implementation. HTTP/2 based RPC
Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.
A powerful flow control component enabling reliability, resilience and monitoring for microservices. (面向云原生微服务的高可用流控防护组件)
Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.
Quick Overview
Apache Dubbo is a high-performance, lightweight, and open-source Java RPC (Remote Procedure Call) framework. It is designed to provide a simple yet effective way to build scalable and reliable distributed applications, making it a popular choice for microservices architecture.
Pros
- High Performance: Dubbo is known for its efficient and low-latency RPC communication, making it suitable for high-throughput applications.
- Scalability: Dubbo's service discovery and load balancing features allow for easy scaling of distributed systems.
- Flexibility: Dubbo supports multiple protocols (such as Dubbo, HTTP, and Thrift) and serialization formats (such as Hessian, JSON, and Protobuf), providing flexibility in integration with other systems.
- Reliability: Dubbo includes features like failover, failback, and circuit breaker to ensure reliable and fault-tolerant service invocations.
Cons
- Java-centric: Dubbo is primarily designed for Java-based applications, which may limit its adoption in polyglot environments.
- Steep Learning Curve: Dubbo has a relatively complex configuration and setup process, which can be challenging for developers new to the framework.
- Limited Documentation: While Dubbo has a growing community, the documentation and resources available may not be as comprehensive as some other popular RPC frameworks.
- Vendor Lock-in: Dubbo is an Apache project, but it was originally developed by Alibaba, which may raise concerns about vendor lock-in for some users.
Code Examples
Here are a few code examples demonstrating the usage of Dubbo:
Defining a Dubbo Service Interface
public interface GreetingService {
String sayHello(String name);
}
Implementing a Dubbo Service Provider
@Service(version = "1.0.0")
public class GreetingServiceImpl implements GreetingService {
@Override
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
Consuming a Dubbo Service
@Reference(version = "1.0.0")
private GreetingService greetingService;
public void greet(String name) {
String greeting = greetingService.sayHello(name);
System.out.println(greeting);
}
Configuring Dubbo in Spring Boot
dubbo:
application:
name: dubbo-demo-application
registry:
address: zookeeper://127.0.0.1:2181
protocol:
name: dubbo
port: 20880
Getting Started
To get started with Dubbo, follow these steps:
-
Install Dependencies: Ensure you have Java 8 or higher installed on your system.
-
Set up a Service Registry: Dubbo requires a service registry, such as Zookeeper or Nacos, to handle service discovery and coordination. Follow the instructions for your chosen registry to set it up.
-
Create a Dubbo Service Provider: Define your service interface and implement the service logic. Annotate the implementation class with
@Service
and configure the Dubbo properties. -
Create a Dubbo Service Consumer: Inject the service interface into your consumer class using the
@Reference
annotation. Dubbo will handle the RPC invocation and service discovery. -
Configure Dubbo: In your Spring Boot application, create a
dubbo.properties
orapplication.yml
file to configure Dubbo, such as the application name, registry address, and protocol settings. -
Start the Application: Run your Dubbo service provider and consumer applications. Dubbo will automatically handle the service registration, discovery, and RPC communication.
For more detailed instructions and advanced configurations, refer to the Dubbo documentation.
Competitor Comparisons
Support for using OpenFeign in Spring Cloud apps
Pros of Spring Cloud OpenFeign
- Simplicity: Spring Cloud OpenFeign provides a simple and straightforward way to create HTTP clients for interacting with RESTful services, reducing boilerplate code.
- Integration with Spring Ecosystem: As part of the Spring Cloud ecosystem, OpenFeign integrates seamlessly with other Spring projects, making it a natural choice for Spring-based applications.
- Declarative Approach: OpenFeign uses a declarative approach to defining HTTP clients, which can make the code more readable and maintainable.
Cons of Spring Cloud OpenFeign
- Limited to Spring Ecosystem: OpenFeign is primarily designed for use within the Spring ecosystem, which may limit its adoption in non-Spring-based projects.
- Dependency on Spring Cloud: OpenFeign is a part of the Spring Cloud project, which means that it may have a larger dependency footprint compared to a standalone library.
- Potential Performance Overhead: The abstraction and integration with the Spring ecosystem may introduce some performance overhead compared to a more lightweight HTTP client library.
Code Comparison
Apache Dubbo
@Service
public class GreetingServiceImpl implements GreetingService {
@Override
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
Spring Cloud OpenFeign
@FeignClient(name = "greeting-service")
public interface GreetingService {
@GetMapping("/greeting/{name}")
String sayHello(@PathVariable("name") String name);
}
In the Apache Dubbo example, the service implementation is defined using the @Service
annotation. In the Spring Cloud OpenFeign example, the service interface is defined using the @FeignClient
annotation, and the method is defined using the @GetMapping
annotation.
The Java gRPC implementation. HTTP/2 based RPC
Pros of grpc/grpc-java
- Language Agnostic: gRPC supports a wide range of programming languages, making it easier to build distributed systems with components written in different languages.
- Efficient Data Serialization: gRPC uses Protocol Buffers, a highly efficient binary serialization format, which can significantly reduce network bandwidth and improve performance.
- Streaming Support: gRPC provides first-class support for bidirectional streaming, allowing for more efficient communication patterns in certain use cases.
Cons of grpc/grpc-java
- Complexity: Setting up and configuring gRPC can be more complex compared to simpler RPC frameworks like Dubbo, especially for smaller projects.
- Learning Curve: Developers may need to invest more time in learning the gRPC ecosystem and its various concepts, such as service definitions, stubs, and interceptors.
Code Comparison
Dubbo:
@Service
public class GreetingServiceImpl implements GreetingService {
@Override
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
gRPC-Java:
@Override
public void sayHello(HelloRequest request,
StreamObserver<HelloResponse> responseObserver) {
HelloResponse response = HelloResponse.newBuilder()
.setMessage("Hello, " + request.getName() + "!")
.build();
responseObserver.onNext(response);
responseObserver.onCompleted();
}
Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.
Pros of Hystrix
- Hystrix provides a comprehensive set of features for implementing the Circuit Breaker pattern, which helps to improve the resilience and fault tolerance of distributed systems.
- Hystrix offers a rich set of metrics and monitoring capabilities, making it easier to understand the behavior and performance of your application.
- Hystrix supports a wide range of programming languages, including Java, Scala, and others, making it a versatile choice for various development environments.
Cons of Hystrix
- Hystrix has a relatively steep learning curve, especially for developers who are new to the concept of the Circuit Breaker pattern.
- Hystrix can add some overhead to your application, as it requires additional processing and resource usage to implement the Circuit Breaker functionality.
- Hystrix is primarily focused on the Circuit Breaker pattern and may not provide the same level of functionality as a more comprehensive service mesh or service discovery solution.
Code Comparison
Dubbo:
public class GreetingService {
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
Hystrix:
public class GreetingCommand extends HystrixCommand<String> {
private final String name;
public GreetingCommand(String name) {
super(HystrixCommandGroupKey.Factory.asKey("GreetingGroup"));
this.name = name;
}
@Override
protected String run() {
return "Hello, " + name + "!";
}
}
A powerful flow control component enabling reliability, resilience and monitoring for microservices. (面向云原生微服务的高可用流控防护组件)
Pros of Sentinel
- Sentinel provides a comprehensive set of features for service flow control, including rate limiting, circuit breaking, and load balancing.
- Sentinel has a user-friendly dashboard for monitoring and managing the system's health.
- Sentinel supports a wide range of programming languages, including Java, Go, and Node.js.
Cons of Sentinel
- Sentinel has a steeper learning curve compared to Dubbo, as it requires more configuration and setup.
- Sentinel's documentation may not be as comprehensive as Dubbo's, making it more challenging for new users to get started.
- Sentinel's performance may not be as optimized as Dubbo's, especially for high-throughput applications.
Code Comparison
Dubbo:
@Service(version = "1.0.0")
public class HelloServiceImpl implements HelloService {
@Override
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
Sentinel:
@RestController
public class HelloController {
@SentinelResource("sayHello")
@GetMapping("/hello")
public String sayHello(@RequestParam String name) {
return "Hello, " + name + "!";
}
}
Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.
Pros of Tars
- Tars provides a more comprehensive set of features, including support for multiple programming languages (C++, Java, Node.js, PHP, Python, and Go) and a web-based management console.
- Tars has a more active community, with a larger number of contributors and more frequent updates.
- Tars is designed to be more scalable and fault-tolerant, with features like load balancing and service discovery.
Cons of Tars
- Tars has a steeper learning curve compared to Dubbo, especially for developers who are more familiar with the Java ecosystem.
- Tars has a smaller ecosystem of third-party libraries and tools compared to Dubbo, which has a larger and more established community.
- Tars may have less widespread adoption and recognition compared to Dubbo, which is a more well-known and widely-used framework.
Code Comparison
Dubbo:
public interface GreetingService {
String sayHello(String name);
}
public class GreetingServiceImpl implements GreetingService {
@Override
public String sayHello(String name) {
return "Hello, " + name + "!";
}
}
Tars:
class GreetingServantImp : public GreetingServant {
public:
virtual std::string sayHello(const std::string& name) {
return "Hello, " + name + "!";
}
};
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Apache Dubbo Project
Apache Dubbo is an easy-to-use Web and RPC framework that provides multiple language implementations(Java, Go, Rust, Node.js, Web) for communication, service discovery, traffic management, observability, security, tools, and best practices for building enterprise-ready microservices.
We are now collecting Dubbo user info to help us to improve Dubbo further. Kindly support us by providing your usage information on Wanted: who's using dubbo, thanks :)
Architecture
- Consumer and provider communicate with each other using RPC protocol like triple, tcp, rest, etc.
- Consumers automatically trace provider instances registered in registries(Zookeeper, Nacos) and distribute traffic among them by following traffic strategies.
- Rich features for monitoring and managing the cluster with dynamic configuration, metrics, tracing, security, and visualized console.
Getting started
Follow the instructions below to learn how to:
Programming with lightweight RPC API
Dubbo supports building RPC services with only a few lines of code while depending only on a lightweight SDK (<10MB). The protocol on the wire can be Triple(fully gRPC compatible and HTTP-friendly), Dubbo2(TCP), REST, or any protocol of your choice.
Building a microservice application with Spring Boot
It's highly recommended to start your microservice application with the Spring Boot Starter dubbo-spring-boot-starter
provided by Dubbo. With only a single dependency and yaml file, and optionally a bunch of other useful spring boot starters, you can enable all of the Dubo features like service discovery, observability, tracing, etc.
Next, learn how to deploy, monitor, and manage the traffic of your Dubbo application and cluster.
More Features
Get more details by visiting the links below to get your hands dirty with some well-designed tasks on our website.
- Launch a Dubbo project
- RPC protocols
- Traffic management
- Service discovery
- Observability
- Extensibility
- Security
- Visualized console and control plane
- Kubernetes and Service mesh
Which Dubbo version should I use?
Dubbo3 | JDK | Dependencies | Description |
---|---|---|---|
3.3.0-beta | 1.8 ï½ 17 | dependency list | - Unstable version - Features - Triple - gRPC and cURL compatible. - Rest-style programming support. - Spring Boot Starters. |
3.2.5 | 1.8 ï½ 17 | dependency list | - Stable version (active) - Features - Out-of-box metrics and tracing support. - Threadpool Isolation - 30% performance - Native Image |
3.1.11 | 1.8 ï½ 11 | dependency list | Stable version (not active) |
Dubbo2 | JDK | Dependencies | Description |
---|---|---|---|
2.7.23 | 1.8 | dependency list | EOL |
2.6.x, 2.5.x | 1.6 ï½ 1.7 | EOL |
Contributing
See CONTRIBUTING for details on submitting patches and the contribution workflow.
How does the Dubbo Community collaborate?
The Dubbo Community primarily communicates on GitHub through issues, discussions, and pull requests.
- Issues: We use issues to track bugs and tasks. Any work-related item is associated with an issue.
- Discussions: We use discussions for questions, early proposals, and announcements. Any idea-related item is associated with a discussion.
- Pull Requests: We use pull requests to merge a set of changes from contributors into Dubbo.
We have also implemented a project board to monitor all the items.
Any essential changes should be discussed on the mailing list before they happen.
Seeking for help
If you have questions such as:
- What is Dubbo?
- How do I use Dubbo?
- Why did an unexpected result occur?
Please start a discussion at https://github.com/apache/dubbo/discussions.
However, if you encounter the following situations:
- You're certain there's a bug that Dubbo needs to fix,
- You believe a feature could be enhanced,
- You have a detailed proposal for improving Dubbo,
Please open an issue at https://github.com/apache/dubbo/issues.
To ask effective questions, we recommend reading How To Ask Questions The Smart Way first.
Contribution
- Browse the "help wanted" tasks in the Dubbo project board.
- Participate in discussions on the mailing list. See the subscription guide.
- Respond to queries in the discussions.
- Resolve bugs reported in issues and send us a pull request.
- Review existing pull requests.
- Enhance the website. We typically need:
- Blog posts
- Translations for documentation
- Use cases showcasing Dubbo integration in enterprise systems.
- Improve the dubbo-admin.
- Contribute to the projects listed in the ecosystem.
- Any other forms of contribution not listed above are also welcome.
- If you're interested in contributing, please send an email to dev@dubbo.apache.org to let us know!
For further details, please refer our guide about how to contribute Dubbo.
Reporting bugs
Please follow the template for reporting any issues.
Reporting a security vulnerability
Please report security vulnerabilities to us privately.
Contact
- WeChat: apachedubbo
- DingTalk group: 37290003945
- Mailing list: guide
- Twitter: @ApacheDubbo
- Security issues: please mail to us privately.
Contributing
See CONTRIBUTING for details on submitting patches and the contribution workflow.
How can I contribute?
- Take a look at issues with tags marked
Good first issue
orHelp wanted
. - Join the discussion on the mailing list, subscription guide.
- Answer questions on issues.
- Fix bugs reported on issues, and send us a pull request.
- Review the existing pull request.
- Improve the website, typically we need
- blog post
- translation on documentation
- use cases around the integration of Dubbo in enterprise systems.
- Improve the dubbo-admin/dubbo-monitor.
- Contribute to the projects listed in ecosystem.
- Other forms of contribution not explicitly enumerated above.
- If you would like to contribute, please send an email to dev@dubbo.apache.org to let us know!
Reporting bugs
Please follow the template for reporting any issues.
Reporting a security vulnerability
Please report security vulnerabilities to us privately.
Dubbo ecosystem
- Dubbo Ecosystem Entry - A GitHub group
dubbo
to gather all Dubbo relevant projects not appropriate in apache group yet - Dubbo Website - Apache Dubbo official website
- Dubbo Samples - samples for Apache Dubbo
- Dubbo Admin - The reference implementation for Dubbo admin
- Dubbo Awesome - Dubbo's slides and video links in Meetup
Language
License
Apache Dubbo is licensed under the Apache License Version 2.0. See the LICENSE file for details.
Top Related Projects
Support for using OpenFeign in Spring Cloud apps
The Java gRPC implementation. HTTP/2 based RPC
Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.
A powerful flow control component enabling reliability, resilience and monitoring for microservices. (面向云原生微服务的高可用流控防护组件)
Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot