Skip to content

Commit dd6630e

Browse files
authored
specify loadbalance strategy on dubbo proxy (#613)
1 parent 87c6239 commit dd6630e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pixiu/pkg/client/dubbo/config.go

+2
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,6 @@ type DubboProxyConfig struct {
3333
AutoResolve bool `yaml:"auto_resolve" json:"auto_resolve,omitempty"`
3434
// Protoset path to load protoset files
3535
Protoset []string `yaml:"protoset" json:"protoset,omitempty"`
36+
// Load
37+
LoadBalance string `yaml:"load_balance" json:"load_balance,omitempty"`
3638
}

pixiu/pkg/client/dubbo/dubbo.go

+6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ import (
2727

2828
import (
2929
_ "dubbo.apache.org/dubbo-go/v3/cluster/cluster/failover"
30+
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/consistenthashing"
31+
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/leastactive"
32+
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/p2c"
3033
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/random"
34+
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/ringhash"
35+
_ "dubbo.apache.org/dubbo-go/v3/cluster/loadbalance/roundrobin"
3136
"dubbo.apache.org/dubbo-go/v3/common/constant"
3237
_ "dubbo.apache.org/dubbo-go/v3/common/proxy/proxy_factory"
3338
dg "dubbo.apache.org/dubbo-go/v3/config"
@@ -313,6 +318,7 @@ func (dc *Client) create(key string, irequest fc.IntegrationRequest) *generic.Ge
313318
Generic: "true",
314319
Version: irequest.DubboBackendConfig.Version,
315320
Group: irequest.Group,
321+
Loadbalance: dc.dubboProxyConfig.LoadBalance,
316322
}
317323

318324
if len(irequest.DubboBackendConfig.Retries) == 0 {

0 commit comments

Comments
 (0)