How Dubbo-go’s New Triple Protocol Transforms Cloud‑Native Microservices
The article introduces Dubbo‑go 3.2’s comprehensive upgrade, focusing on the Triple protocol’s gRPC and HTTP compatibility, simplified API, service‑governance features, code examples for server and client, configuration‑driven deployment, built‑in observability, traffic‑management capabilities, and the modular plugin architecture.
Overview of Dubbo-go 3.2 Upgrade
Dubbo-go, the Go implementation of Apache Dubbo, receives a comprehensive upgrade covering API, protocol, traffic management, and observability to better support cloud‑native microservice scenarios.
Triple Protocol Enhancements
The Triple protocol is upgraded to be compatible with gRPC and standard HTTP clients, allowing services to run on both HTTP/1 and HTTP/2. It provides a concise API for writing RPC servers and clients.
func main() {
srv, err := server.NewServer(
server.WithServerProtocol(
protocol.WithTriple(),
protocol.WithPort(50051),
),
)
if err != nil { panic(err) }
if err := greettriple.RegisterGreetServiceHandler(srv, &api.GreetTripleServer{}); err != nil { panic(err) }
if err := srv.Serve(); err != nil { panic(err) }
}Publishing a Triple RPC Service
type GreeterServer struct{}
func (s *GreeterServer) SayHello(ctx context.Context, in *greet.HelloRequest) (*greet.User, error) {
return &greet.User{Name: "Hello " + in.Name, Id: "12345", Age: 21}, nil
}Testing the Service with cURL
curl \
--header "Content-Type: application/json" \
--data '{"name": "Dubbo"}' \
http://localhost:50051/greet.GreetService/GreetClient Usage
func main() {
cli, err := client.NewClient(client.WithURL("tri://127.0.0.1:50052"))
if err != nil { panic(err) }
svc, err := greettriple.NewGreetService(cli)
if err != nil { panic(err) }
resp, err := svc.Greet(context.Background(), &greet.GreetRequest{Name: "triple"})
if err != nil { return err }
logger.Infof("TRIPLE unary call resp: %s", resp.Greeting)
}YAML‑Based Configuration (dubbogo.yml)
dubbo:
application:
name: myApp
registries:
nacos:
protocol: nacos
address: 127.0.0.1:8848
group: DEFAULT_GROUP
namespace: 9fb00abb-278d-42fc-96bf-e0151601e4a1
protocols:
dubbo:
name: tri
port: 20000
provider:
services:
UserProviderWithCustomGroupAndVersion:
interface: org.apache.dubbo.UserProvider.Test
version: myInterfaceVersion
group: myInterfaceGroupObservability and Metrics
Since version 3.2.0, Dubbo-go includes built‑in metrics collection for RPC latency, QPS, success/failure counts, concurrency, as well as registry and configuration interactions. Metrics can be exported to Prometheus/Grafana for full‑stack monitoring.
Traffic Management Features
Address discovery & load balancing
Rule‑based routing
Weight‑based traffic splitting
Gray verification
Canary release
Parameter‑based routing
Region‑priority
Timeout adjustment
Retry
Rate‑limit & downgrade
Architecture Layers
API Layer : Supports IDL, interface/struct contracts, YAML configuration, synchronous/asynchronous, unary/streaming RPC models.
Service Governance Layer : Provides service discovery, load balancing, metrics, traffic management, tracing.
RPC Protocol Layer : Core Triple protocol works over HTTP/1, HTTP/2 and coexists with Dubbo2, REST, JSON‑RPC.
Transport Layer : Supports HTTP 1/2 and TCP with multiple serialization options.
Plugin Ecosystem
Protocol : Triple, Dubbo2, REST, etc., extensible via plugins.
Service Discovery : Integrates with Nacos, Zookeeper, Polaris.
Traffic Management : Dynamic rule engine for A/B testing, canary, multi‑version traffic splitting.
Metrics : Built‑in collection exported to Prometheus.
Logging : Supports Zap, Logrus.
Tracing : Plugins for Zipkin, Jaeger, SkyWalking.
Resources
Triple protocol implementation (alpha): https://github.com/apache/dubbo-go/tree/feature-triple/protocol/triple/internal
Dubbo-go project homepage: https://github.com/apache/dubbo-go
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Alibaba Cloud Native
We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
