Documentation ¶
Index ¶
- Constants
- type BackendCtx
- type BalancePolicy
- type SimpleBalancePolicy
- func (sbp *SimpleBalancePolicy) BackendToRoute(backends []BackendCtx) BackendCtx
- func (sbp *SimpleBalancePolicy) BackendsToBalance(backends []BackendCtx) (from, to BackendCtx, balanceCount float64, reason string, ...)
- func (sbp *SimpleBalancePolicy) Init(cfg *config.Config)
- func (sbp *SimpleBalancePolicy) SetConfig(cfg *config.Config)
Constants ¶
View Source
const ( // ConnBalancedRatio is the threshold of ratio of the most connection count and least count. // If the ratio exceeds the threshold, we migrate connections. ConnBalancedRatio = 1.2 // BalanceCount4Health indicates how many connections to balance per second. // If some backends are unhealthy, migrate fast but do not put too much pressure on TiDB. BalanceCount4Health = 1000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendCtx ¶
type BalancePolicy ¶
type BalancePolicy interface { Init(cfg *config.Config) BackendToRoute(backends []BackendCtx) BackendCtx // balanceCount is the count of connections to balance per second. BackendsToBalance(backends []BackendCtx) (from, to BackendCtx, balanceCount float64, reason string, logFields []zap.Field) SetConfig(cfg *config.Config) }
type SimpleBalancePolicy ¶
type SimpleBalancePolicy struct { }
SimpleBalancePolicy is used for serverless tier and testing of router. It simply balances by health and connection count.
func NewSimpleBalancePolicy ¶
func NewSimpleBalancePolicy() *SimpleBalancePolicy
func (*SimpleBalancePolicy) BackendToRoute ¶
func (sbp *SimpleBalancePolicy) BackendToRoute(backends []BackendCtx) BackendCtx
func (*SimpleBalancePolicy) BackendsToBalance ¶
func (sbp *SimpleBalancePolicy) BackendsToBalance(backends []BackendCtx) (from, to BackendCtx, balanceCount float64, reason string, logFields []zap.Field)
func (*SimpleBalancePolicy) Init ¶
func (sbp *SimpleBalancePolicy) Init(cfg *config.Config)
func (*SimpleBalancePolicy) SetConfig ¶
func (sbp *SimpleBalancePolicy) SetConfig(cfg *config.Config)
Click to show internal directories.
Click to hide internal directories.