Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Apache Dubbo, a Java-Based RPC Framework, Graduates to Top-Level Project

Apache Dubbo, a Java-Based RPC Framework, Graduates to Top-Level Project

Leia em Português

This item in japanese

The Apache Software Foundation recently announced Apache Dubbo as a top-level project. Apache Dubbo is an open source, remote procedure call framework based on Java. It was originally developed at Alibaba, open-sourced in 2011, and entered the Apache Incubator in February 2018. Dubbo brings key functionalities such as interface-based remote call, fault tolerance and load balancing, and automatic service registration and discovery.

The Dubbo architecture is shown below:

(Image taken from

  1. Container is responsible for launching, loading, and running the service Provider
  2. Provider registers its services to Register during its initialization
  3. Consumer subscribes the services it needs from the Register when it starts
  4. Register returns the Providers list to Consumer, and when a change occurs, the Register push the changed data to Consumer
  5. Based on a soft load balancing algorithm, the Consumer will select one of the Providers and executes the invocation, automatically choose another Provider when a fail occurs.
  6. Both Consumer and Provider will count the number service invocations and time-consuming in memory, and send the statistics to Monitor every minute.

Apache Dubbo features include:

  • A transparent interface based RPC
  • Intelligent load balancing, which supports multiple load balancing strategies out of the box
  • Automatic service registration and discovery
  • High extensibility, micro-kernel and plugin design which ensures that it can easily be extended by third party implementation across core features like protocol, transport, and serialization
  • Runtime traffic routing, which can be configured at runtime so that traffic can be routed according to different rules, making it easy to support features such as blue-green deployment, data center aware routing, etc
  • Visualized service governance, which provides rich tools for service governance and maintenance such as querying service metadata, health status, and statistics

To get started using Dubbo, developers first add the Maven dependency:


Next, a service interface is defined and implemented in the provider:

package org.apache.dubbo.samples.api;

//service interface
public interface GreetingService {
    String sayHello(String name);
//provider, implementation of service interface
public class GreetingServiceImpl implements GreetingService {
    public String sayHello(String name) {
        return "Hello " + name;

The provider would be configured as follows:

package org.apache.dubbo.demo.provider;

import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.config.ServiceConfig;
import org.apache.dubbo.samples.api.GreetingService;
public class Application {

    public static void main(String[] args) throws IOException {
        ServiceConfig serviceConfig = new ServiceConfig();
        serviceConfig.setApplication(new ApplicationConfig("first-dubbo-provider"));
        serviceConfig.setRegistry(new RegistryConfig("multicast://"));
        serviceConfig.setRef(new GreetingServiceImpl());

And then built and run:

# mvn clean package
# mvn -Dexec.mainClass=org.apache.dubbo.demo.provider.Application exec:java

The following code snippets show how to create a consumer:

package org.apache.dubbo.demo.consumer;

import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.config.RegistryConfig;
import org.apache.dubbo.samples.api.GreetingService;

public class Application {
    public static void main(String[] args) {
        ReferenceConfig referenceConfig = new ReferenceConfig();
        referenceConfig.setApplication(new ApplicationConfig("first-dubbo-consumer"));
        referenceConfig.setRegistry(new RegistryConfig("multicast://"));
        GreetingService greetingService = referenceConfig.get();

Beginning a new project using Apache Dubbo is relatively simple; developers can follow the steps above, or by use Dubbo's Spring initializr, which is basically a fork of Spring initializr. In addition to Java, Dubbo supports Node.js, Python, and PHP.

Apache Dubbo is in use at companies such as Alibaba Group, China Life, China Telecom, Dangdang, Didi Chuxing, Haier, Industrial and Commercial Bank of China, NetEase, Qunar, and Youzan.

More details about Dubbo can be found at Developers who want to contribute should access the contributor guide. There is also extensive documentation available.

Rate this Article