dubbo-go Documentation

Go Implementation For Apache Dubbo .

4,972 stars Go Go 9 files Β· ~8,032 tokens #go#http2#microservices#rpc#service-mesh
RAW Doc

Docker & Self-Hosted Deployment Verified OCI

Deploy dubbo-go on any server, homelab, or cloud container platform.

1-Click Terminal Command
bash (docker run)
docker run -d --name dubbo-go --restart always apache/dubbo-go:latest

Technical Documentation: apache/dubbo-go

ℹ️ Provenance: Multi-Tier Ingestion Β· CodeWiki Reference

Overview (`README.md`)

Apache Dubbo for Golang




English | δΈ­ζ–‡

Apache Dubbo-go is a high-performance RPC and microservice framework compatible with other Dubbo language implementations. It leverages Golang's concurrency features to provide efficient service governance, including service discovery, load balancing, and traffic management. Dubbo-go supports multiple protocols, such as Dubbo, JSONRPC, Triple(gRPC-compatible), gRPC, HTTP, HTTP2, and HTTP/3 (experimental), ensuring seamless integration in heterogeneous environments.

You can visit the official website for more information.

Recent Updates

For detailed changes, refer to CHANGELOG.md.

  • 3.3.2:

    BREAKING CHANGE: config package has been removed, please use modern global package, check dubbo-go-samples for usage instructions.

    Apache Dubbo-go 3.3.2 is a production-readiness release focused on API consolidation, Triple protocol capabilities, application-level metadata, service governance, concurrency safety, and release tooling. It completes the removal of the legacy config package, expands generic invocation and HTTP-facing Triple features, refreshes generated-project workflows, and fixes multiple races, stale-snapshot issues, and resource leaks.

  • 3.3.1: Optimized configuration hot-reloading with content-based caching to prevent redundant notifications. Added experimental HTTP/3 support, Apollo integration, and Triple protocol OpenAPI generation. Fixed critical race conditions in service discovery under high-concurrency.

  • 3.3.0: Introduced script routing, multi-destination conditional routing, Triple protocol keepalive and connection pooling, Nacos multi-category subscriptions, and enhancements for observability and interoperability.

Getting started

Prerequisites

  • Go 1.24 or later (recommended for compatibility with recent updates).

Installation

To install Dubbo-go, use the following command:

bash
go get dubbo.apache.org/dubbo-go/v3@latest

Quick Example

You can learn how to develop a dubbo-go RPC application step by step in 5 minutes by following our Quick Start demo.

It's as simple as the code shown below, you define a service with Protobuf, provide your own service implementation, register it to a server, and start the server.

go
func (srv *GreetTripleServer) Greet(ctx context.Context, req *greet.GreetRequest) (*greet.GreetResponse, error) {
	resp := &greet.GreetResponse{Greeting: req.Name}
	return resp, nil
}

func main() {
	srv, _ := server.NewServer(
		server.WithServerProtocol(
			protocol.WithPort(20000),
			protocol.WithTriple(),
		),
	)

	_ := greet.RegisterGreetServiceHandler(srv, &GreetTripleServer{})

	if err := srv.Serve(); err != nil {
		logger.Error(err)
	}
}

After the server is up and running, call your service via cURL:

shell
curl \
    --header "Content-Type: application/json" \
    --data '{"name": "Dubbo"}' \
    http://localhost:20000/greet.GreetService/Greet

Or, you can start a standard dubbo-go client to call the service:

go
func main() {
	cli, _ := client.NewClient(
		client.WithClientURL("127.0.0.1:20000"),
	)

	svc, _ := greet.NewGreetService(cli)

	resp, _ := svc.Greet(context.Background(), &greet.GreetRequest{Name: "hello world"})
	
	logger.Infof("Greet response: %s", resp.Greeting)
}

See the samples for detailed information on usage. Next, learn how to deploy, monitor and manage the traffic of your dubbo-go application by visiting the official website.

Features

Dubbo-go provides robust service governance capabilities:

  • RPC Protocols: Triple, gRPC compatible and HTTP-friendly
  • Service Discovery: Nacos, Zookeeper, Etcd, Polaris-mesh.
  • Load Balance: Adaptive, Random, RoundRobin, LeastActive, ConsistentHash
  • Traffic Management: traffic split, timeout, rate limiting, canary release
  • Configuration: yaml file, dynamic configuration(Nacos, Apollo, Zookeeper, etc.).
  • Observability: Metrics (Prometheus), tracing (OpenTelemetry v1.21.0+ with insecure options and standardized span names), logging (with service registration lifecycle events).
  • HA Strategy: Failover, Failfast, Failsafe/Failback, Available, Broadcast, Forking.
  • Interoperability: Full compatibility with Apache Dubbo (Java) via Triple protocol generic calls, group/version wildcard matching, and TLS API redesign.

Tools

Common development tools live in tools/.

Tool Purpose
dubbogo-cli Scaffold demos/apps, install companion tools, inspect metadata, and debug services.
protoc-gen-go-triple Generate dubbo-go Triple bindings from protobuf service definitions.
protoc-gen-triple-openapi Generate OpenAPI v3 documents from Triple protobuf services.
imports-formatter Format Go import blocks using dubbo-go grouping rules.
dubbo-go-schema Provide JSON Schema completion and validation for dubbo-go YAML config.
benchmark Performance benchmark suite for comparing Dubbo-Go, Dubbo-Java, and gRPC frameworks.

Ecosystem

Documentation

Community

Contributions, issues, and discussions are welcome. Please visit CONTRIBUTING for details on submitting patches and the contribution workflow.

Contact

Join our discussion group through Ding talk or WeChat.

[User List](https://github.com/apache/dubbo-go/issues/2)

If you are using apache/dubbo-go and think that it helps you or want to contribute code for Dubbo-go, please add your company to the user list to let us know your needs.

See more user cases

License

Apache Dubbo-go software is licensed under the Apache License Version 2.0. See the LICENSE file for details.


Overview (`filter/README.md`)

Filter

Dubbo-go filters are interceptor-style extensions around RPC invocation.
They are typically used to add cross-cutting behavior such as authentication,
rate limiting, logging, tracing, metrics, generic invocation adaptation, and
graceful shutdown handling.

Getting Started

The recommended approach is to import only the filters your application needs.

go
package demo

import _ "dubbo.apache.org/dubbo-go/v3/filter/echo"
import _ "dubbo.apache.org/dubbo-go/v3/filter/generic"

If you prefer the legacy all-in-one import, you can still use:

go
package demo

import _ "dubbo.apache.org/dubbo-go/v3/filter/filter_impl"

Where Filters Apply

Dubbo-go distinguishes between two filter chains:

  • service.filter: provider-side filters
  • reference.filter: consumer-side filters

The built-in defaults are defined in common/constant/default.go.

Built-in Filters

Core

  • echo: echo health check support
  • generic: consumer-side generic invocation filter
  • generic_service: provider-side generic service filter
  • graceful_shutdown: graceful shutdown behavior for provider and consumer paths

Traffic Control

  • active: active request counting
  • exec_limit: provider-side execute concurrency limiting
  • tps: TPS limiting
  • adaptivesvc: adaptive service filter
  • polaris/limit: Polaris rate limiting
  • sentinel: Sentinel integration for provider and consumer traffic protection

Security

  • token: token-based request validation
  • auth: request signing and authentication
  • seata: Seata distributed transaction propagation

Observability

  • accesslog: invocation access logging
  • metrics: metrics collection
  • tracing: tracing integration
  • otel/trace: OpenTelemetry tracing integration

Extension Note

Common Usage

In practice, filters are usually enabled through application config instead of
being called directly from business code. Typical examples:

  • enable a provider filter through service.filter
  • enable a consumer filter through reference.filter
  • import the filter package so it registers itself via extension.SetFilter(...)

Notes

  • Importing a filter package registers it; the filter still needs to be enabled
    by the corresponding consumer/provider configuration path when applicable.
  • Some filter names differ slightly from their package directory because the
    runtime key is defined in common/constant/key.go.
  • Filters under subdirectories such as otel/trace and polaris/limit are
    still ordinary Dubbo-go filters; the subdirectory just reflects feature
    grouping.

Overview (`tools/benchmark/README.md`)

Dubbo-Go Benchmark Suite

English | δΈ­ζ–‡

Performance benchmark suite for comparing Dubbo-Go / Dubbo-Java / gRPC frameworks.

Environment Requirements

  • Go: 1.23+
  • Java: 8+
  • Maven: 3.6+
  • protoc: 3.0+

Default Port Configuration

Framework Default Port
Dubbo-Go 20000
Dubbo-Java 20001
gRPC 50051

Directory Structure

text
/* Detailed source-code truncated for AI context efficiency. */

Configuration

Test configuration is in config.yaml, including:

  • payload_sizes: Payload sizes (in bytes)
  • serializations: Serialization protocols
  • compressions: Compression strategies
  • call_modes: Call modes
  • concurrency_levels: Concurrency levels
  • benchmark: Benchmark parameters (warmup time, test duration, timeout)

Code Generation

After modifying proto/benchmark.proto, regenerate code:

bash
./scripts/gen_code.sh

This script generates:

  • benchmark.pb.go - Protobuf basic code
  • benchmark.triple.go - Dubbo Triple protocol code
  • benchmark_grpc.pb.go - gRPC protocol code

Usage

Single Benchmark

bash
# Using script
./scripts/run_single.sh dubbo-go 1024 protobuf none 100 unary

# Or run directly
go run client/main.go \
  --framework dubbo-go \
  --payload 1024 \
  --serialization protobuf \
  --compression none \
  --concurrency 100 \
  --mode unary

Full Benchmark

bash
./scripts/run_all.sh

Command Line Parameters

Parameter Description Default
--framework Test framework dubbo-go
--payload Payload size (bytes) 1024
--serialization Serialization protocol protobuf
--compression Compression strategy none
--concurrency Concurrency level 100
--mode Call mode unary
--duration Test duration 60s
--warmup Warmup duration 10s
--addr Server address Auto select
--pid Server PID (for system monitoring) 0

Parameter Values

Parameter Values
--framework dubbo-go / dubbo-java / grpc
--serialization hessian2 / protobuf / msgpack
--compression none / default / fastest
--mode unary / streaming

Start Server Separately

bash
# Dubbo-Go Server
cd server/dubbo-go
go run main.go --serialization protobuf --compression none --port 20000

# gRPC Server
cd server/grpc
go run main.go --port 50051

# Dubbo-Java Server
cd server/dubbo-java
mvn clean package
java -jar target/benchmark-dubbo-java.jar

Benchmark Report

Test Environment

  • Go Version: 1.25
  • Java Version: 8+
  • Test Frameworks: Dubbo-Go / Dubbo-Java / gRPC
  • Test Date: 2026-07-27
  • Warmup Duration: 10s
  • Test Duration: 60s per test case

Test Configuration

Parameter Value
Payload Size 128B / 1KiB / 16KiB / 1MiB
Serialization protobuf / hessian2 / msgpack
Compression none / default / fastest
Concurrency 50 / 100 / 500 / 1000 / 2000
Call Mode unary / streaming

128 bytes Payload

QPS

Concurrency dubbo-go dubbo-java grpc
50 19,732 18,560 106,648
100 19,231 18,120 118,044

P99 Latency (ms)

Concurrency dubbo-go dubbo-java grpc
50 3.30 8.21 0.94
100 6.37 12.50 1.61

1024 bytes Payload

QPS

Concurrency dubbo-go dubbo-java grpc
50 17,563 16,830 93,172
100 16,075 15,240 103,253

P99 Latency (ms)

Concurrency dubbo-go dubbo-java grpc
50 3.64 9.15 1.07
100 7.27 14.80 1.72

16384 bytes Payload

QPS

Concurrency dubbo-go dubbo-java grpc
50 9,461 8,720 43,339
100 7,944 7,350 41,723

P99 Latency (ms)

Concurrency dubbo-go dubbo-java grpc
50 6.89 18.30 1.99
100 21.32 35.60 3.67

1048576 bytes Payload

QPS

Concurrency dubbo-go dubbo-java grpc
50 347 486 1,431
100 310 452 1,453

P99 Latency (ms)

Concurrency dubbo-go dubbo-java grpc
50 347.29 285.40 59.81
100 795.42 420.60 109.15

Resource Usage (128B Payload, 100 Concurrency)

Framework CPU Avg (%) Memory Peak (MB)
dubbo-go 324.0 69.7
dubbo-java 52.8 256.3
grpc 415.7 34.3

Output Files

Data Files

Test results are saved in data/ directory with the naming format:

text
{framework}_{payload}_{serialization}_{compression}_{concurrency}_{mode}.json

JSON structure:

json
{
  "framework": "dubbo-go",
  "payload_size": 1024,
  "serialization": "protobuf",
  "compression": "none",
  "concurrency": 100,
  "call_mode": "unary",
  "timestamp": "2026-07-23 15:00:00",
  "qps": 21450.0,
  "success_rate": 99.99,
  "latency_p50_ms": 4.65,
  "latency_p99_ms": 5.53,
  "cpu_avg_percent": 45.2,
  "memory_peak_mb": 128.5
}

Log Files

Logs are saved in logs/ directory, including:

  • {scenario}.log - Client benchmark logs
  • {scenario}.server.log - Server runtime logs

Performance Optimization

Dubbo-Go Client Optimization

For best performance, Dubbo-Go client uses the following optimizations:

Configuration Description
WithClientNoCheck() Skip service check, reduce unnecessary overhead
MaxCallRecvMsgSize: 16MB Max receive message size for large payload tests
MaxCallSendMsgSize: 16MB Max send message size for large payload tests

Dubbo-Go Server Optimization

Server configuration includes the following optimizations:

Configuration Description
WithMaxServerRecvMsgSize("16MB") Max receive message size
WithMaxServerSendMsgSize("16MB") Max send message size

License

Apache License 2.0


Overview (`tools/dubbo-go-schema/README.md`)

dubbo-go-schema

English | δΈ­ζ–‡

dubbo-go-schema provides the JSON Schema used by editors and YAML language servers to validate and complete Apache dubbo-go configuration files such as dubbogo.yaml, dubbo.yaml, and application.yaml.

The schema is maintained from the current global/*_config.go YAML tags and common dubbo-go configuration examples.

Files

  • dubbo-go.json: JSON Schema for dubbo-go YAML configuration.
  • application.yaml: example configuration that exercises common provider, consumer, Triple, metrics, tracing, logger, and shutdown settings.
  • images/: screenshots used by this README.

VS Code

Install a YAML language server extension, such as the Red Hat YAML extension, then add this to settings.json:

json
{
  "yaml.schemas": {
    "https://raw.githubusercontent.com/apache/dubbo-go/develop/tools/dubbo-go-schema/dubbo-go.json": [
      "dubbo.yaml",
      "dubbogo.yaml",
      "application.yaml"
    ]
  }
}

When testing local schema changes, point VS Code at the checked-out schema file instead:

json
{
  "yaml.schemas": {
    "./tools/dubbo-go-schema/dubbo-go.json": [
      "dubbo.yaml",
      "dubbogo.yaml",
      "application.yaml"
    ]
  }
}

IntelliJ IDEA / GoLand

Open Settings | Languages & Frameworks | Schemas and DTDs | JSON Schema Mappings, add dubbo-go.json, and map it to the config file names you use.

Validate Locally

At minimum, verify that the schema is valid JSON:

bash
node -e "JSON.parse(require('fs').readFileSync('tools/dubbo-go-schema/dubbo-go.json', 'utf8'))"

For editor validation, open application.yaml in VS Code or GoLand with the local schema mapping enabled. The schema expects dubbo-go v3 style configuration under the dubbo: root key.

Screenshots


Overview (`tools/dubbogo-cli/README.md`)

dubbogo-cli

English | δΈ­ζ–‡

dubbogo-cli is the command-line helper for the Apache dubbo-go toolchain. It can scaffold dubbo-go projects, install companion tools, inspect registry or metadata-center entries, and call Dubbo services during local debugging.

Installation

bash
go install dubbo.apache.org/dubbo-go/v3/tools/dubbogo-cli@latest

Make sure $GOPATH/bin or $(go env GOPATH)/bin is in your PATH.

Commands

bash
dubbogo-cli version
dubbogo-cli install all
dubbogo-cli install triple
dubbogo-cli install triple-openapi
dubbogo-cli install formatter
dubbogo-cli newDemo .
dubbogo-cli newApp .
dubbogo-cli show --r zookeeper --h 127.0.0.1:2181
dubbogo-cli show --mc zookeeper --h 127.0.0.1:2181
dubbogo-cli call --h localhost --p 20001 --proto dubbo --i com.example.UserProvider --method GetUser --sendObj ./request.json --recvObj ./response.json
dubbogo-cli hessian --include ./

Install Toolchain

dubbogo-cli install all installs the companion tools used by current dubbo-go projects:

  • protoc-gen-go-triple: generates Triple client and server bindings.
  • protoc-gen-triple-openapi: generates OpenAPI v3 documents from Triple protobuf definitions.
  • imports-formatter: formats Go import blocks using dubbo-go import grouping rules.

You can install a single tool with dubbogo-cli install triple, dubbogo-cli install triple-openapi, or dubbogo-cli install formatter.

Create a Demo

bash
mkdir hello-triple
cd hello-triple
dubbogo-cli newDemo .
make proto-gen
go mod tidy

Generated layout:

text
.
|-- Makefile
|-- api
|   `-- samples_api.proto
|-- go-client
|   `-- cmd
|       `-- client.go
|-- go-server
|   `-- cmd
|       `-- server.go
`-- go.mod

Run the server:

bash
go run ./go-server/cmd

Run the client in another terminal:

bash
go run ./go-client/cmd

The template keeps only protobuf source files in the scaffold. make proto-gen generates *.pb.go and *.triple.go files with protoc-gen-go and protoc-gen-go-triple.

Create an Application

bash
mkdir dubbo-go-app
cd dubbo-go-app
dubbogo-cli newApp .
make proto-gen
go mod tidy

Generated layout:

text
.
|-- Makefile
|-- api
|   `-- api.proto
|-- build
|   `-- Dockerfile
|-- chart
|   |-- app
|   `-- nacos_env
|-- cmd
|   `-- app.go
|-- conf
|   `-- dubbogo.yaml
|-- go.mod
`-- pkg
    `-- service
        `-- service.go

Typical workflow:

  1. Edit api/api.proto.
  2. Run make proto-gen.
  3. Run go mod tidy.
  4. Implement the service in pkg/service.
  5. Update image and Helm settings in Makefile and chart/app/values.yaml.
  6. Build, publish, and deploy with the provided Make targets.

Useful Make targets:

bash
make proto-gen
make build
make buildx-publish
make deploy
make remove

Inspect Registry and Metadata

Zookeeper registry:

bash
dubbogo-cli show --r zookeeper --h 127.0.0.1:2181

Zookeeper metadata center:

bash
dubbogo-cli show --mc zookeeper --h 127.0.0.1:2181

The command prints registered interfaces and method names. Nacos and Istio support are not implemented yet.

Debug Dubbo Protocol Services

dubbogo-cli call can invoke Dubbo protocol services with request and response shapes described as JSON files.

bash
dubbogo-cli call \
  --h localhost \
  --p 20001 \
  --proto dubbo \
  --i com.example.UserProvider \
  --method GetUser \
  --sendObj ./request.json \
  --recvObj ./response.json

Request fields use the form type@value, for example:

json
{
  "ID": "string@A000",
  "Male": "bool@true",
  "JavaClassName": "[email protected]"
}

Every Hessian object should provide a JavaClassName value that matches the provider-side type.

Debug Triple Services

Triple services are compatible with the gRPC ecosystem. If reflection is enabled on the provider, grpc_cli can inspect and call services:

bash
grpc_cli ls localhost:20000 -l
grpc_cli type localhost:20000 org.apache.dubbo.samples.HelloRequest
grpc_cli call localhost:20000 SayHello "name: 'laurence'"

Install grpc_cli from the gRPC project documentation.


Overview (`tools/imports-formatter/README.md`)

imports-formatter

English | δΈ­ζ–‡

imports-formatter rewrites Go import blocks using the grouping style used by dubbo-go.

It scans a Go module, skips generated files that contain Code generated by, and groups imports into:

  • Go standard library imports
  • third-party imports
  • current module imports

Installation

bash
go install dubbo.apache.org/dubbo-go/v3/tools/imports-formatter@latest

Make sure $(go env GOPATH)/bin is in your PATH.

You can also install it through dubbogo-cli:

bash
dubbogo-cli install formatter

Usage

Format the current module:

bash
imports-formatter

Format a specific module path:

bash
imports-formatter --path /path/to/module

Pass the module path explicitly when the target directory does not contain go.mod:

bash
imports-formatter --path /path/to/module/subdir --module dubbo.apache.org/dubbo-go/v3

Disable blank lines between third-party import groups:

bash
imports-formatter --bl=false

Flags

Flag Default Description
--path current directory Directory to scan recursively.
--module module from go.mod Go module path used to identify internal imports.
--bl true Whether to insert blank lines between third-party import groups.

Notes

imports-formatter edits files in place. Review the diff before committing.


Overview (`tools/protoc-gen-go-triple/README.md`)

protoc-gen-go-triple

English | δΈ­ζ–‡

protoc-gen-go-triple is the protobuf compiler plugin that generates dubbo-go Triple client and server bindings.

It works together with protoc-gen-go: protoc-gen-go generates protobuf message types, and protoc-gen-go-triple generates Triple service interfaces, clients, handlers, and registration helpers.

Requirements

  • Go 1.23 or later
  • protoc
  • protoc-gen-go

Install protoc-gen-go if it is not already available:

bash
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest

Installation

bash
go install dubbo.apache.org/dubbo-go/v3/tools/protoc-gen-go-triple@latest

Make sure $(go env GOPATH)/bin is in your PATH.

Usage

bash
protoc \
  --go_out=. \
  --go_opt=paths=source_relative \
  --go-triple_out=. \
  --go-triple_opt=paths=source_relative \
  ./api/greet.proto

For greet.proto, the generated files are:

  • greet.pb.go: protobuf messages generated by protoc-gen-go
  • greet.triple.go: Triple bindings generated by protoc-gen-go-triple

Proto Example

proto
syntax = "proto3";

package greet;

option go_package = "example.com/hello/api;api";

message GreetRequest {
  string name = 1;
}

message GreetResponse {
  string greeting = 1;
}

service GreetService {
  rpc Greet(GreetRequest) returns (GreetResponse) {}
}

The protobuf package controls the Triple service name exposed on the wire. The go_package option controls the Go import path and package name for generated files.

Generated API

Current generated code uses the dubbo-go v3 Triple API:

go
greeter, err := api.NewGreetService(cli)
go
err := api.RegisterGreetServiceHandler(srv, &GreetServiceImpl{})

The generated file suffix is .triple.go.

Legacy Compatibility

For dubbo-go 3.2.0 and later, use the default generator output.

To generate stubs compatible with older dubbo-go releases, pass useOldVersion=true:

bash
protoc \
  --go_out=. \
  --go_opt=paths=source_relative \
  --go-triple_out=. \
  --go-triple_opt=paths=source_relative,useOldVersion=true \
  ./api/greet.proto

The old compatibility mode is retained for migration only. New projects should use the default output.


Overview (`tools/protoc-gen-triple-openapi/README.md`)

protoc-gen-triple-openapi

English | δΈ­ζ–‡

protoc-gen-triple-openapi is a protoc plugin that generates OpenAPI v3 documents from protobuf services used with the Dubbo Triple protocol.

Requirements

  • Go 1.23 or later
  • protoc
  • protobuf files that define Triple services

Installation

bash
go install dubbo.apache.org/dubbo-go/v3/tools/protoc-gen-triple-openapi@latest

Make sure $(go env GOPATH)/bin is in your PATH.

Usage

Generate YAML, the default format:

bash
protoc \
  --triple-openapi_out=. \
  --triple-openapi_opt=format=yaml \
  ./api/greet.proto

Generate JSON:

bash
protoc \
  --triple-openapi_out=. \
  --triple-openapi_opt=format=json \
  ./api/greet.proto

Generated file names use the input proto base name:

  • greet.triple.openapi.yaml
  • greet.triple.openapi.json

Proto Example

proto
syntax = "proto3";

package org.apache.dubbo.samples.greet;

option go_package = "example.com/hello/api;api";

service GreetService {
  rpc Greet(GreetRequest) returns (GreetResponse) {}
}

message GreetRequest {
  string name = 1;
}

message GreetResponse {
  string greeting = 1;
}

Options

Option Values Default Description
format yaml, json yaml Output document format.

Version

bash
protoc-gen-triple-openapi --version

Overview (`protocol/grpc/internal/README.md`)

internal

This internal package is for test. So don't use internal in production.

require

usage


--- METRICS ---