Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdaptiveLoadBalancer ¶
type AdaptiveLoadBalancer struct {
// contains filtered or unexported fields
}
func NewAdaptiveLoadBalancer ¶
func NewAdaptiveLoadBalancer() *AdaptiveLoadBalancer
func (*AdaptiveLoadBalancer) NextServer ¶
func (alb *AdaptiveLoadBalancer) NextServer(pool ServerPool, r *http.Request, w *http.ResponseWriter) *Server
func (*AdaptiveLoadBalancer) RecordMetrics ¶
func (alb *AdaptiveLoadBalancer) RecordMetrics(algorithm string, responseTime time.Duration, isError bool)
type Algorithm ¶
type Algorithm interface {
NextServer(pool ServerPool, r *http.Request, w *http.ResponseWriter) *Server
Name() string
}
func CreateAlgorithm ¶
type AlgorithmStats ¶
type BoundedLeastConnections ¶
type BoundedLeastConnections struct {
// contains filtered or unexported fields
}
func NewBoundedLeastConnections ¶
func NewBoundedLeastConnections(sampleSize int) *BoundedLeastConnections
func (*BoundedLeastConnections) Name ¶
func (blc *BoundedLeastConnections) Name() string
func (*BoundedLeastConnections) NextServer ¶
func (blc *BoundedLeastConnections) NextServer(pool ServerPool, _ *http.Request, w http.ResponseWriter) *Server
type IPHash ¶
type IPHash struct{}
func (*IPHash) NextServer ¶
func (ih *IPHash) NextServer(pool ServerPool, r *http.Request, w *http.ResponseWriter) *Server
type LeastConnections ¶
type LeastConnections struct{}
func (*LeastConnections) Name ¶
func (lc *LeastConnections) Name() string
func (*LeastConnections) NextServer ¶
func (lc *LeastConnections) NextServer(pool ServerPool, _ *http.Request, w *http.ResponseWriter) *Server
type LeastResponseTime ¶
type LeastResponseTime struct {
// contains filtered or unexported fields
}
func NewLeastResponseTime ¶
func NewLeastResponseTime() *LeastResponseTime
func (*LeastResponseTime) Name ¶
func (lrt *LeastResponseTime) Name() string
func (*LeastResponseTime) NextServer ¶
func (lrt *LeastResponseTime) NextServer( pool ServerPool, _ *http.Request, w *http.ResponseWriter, ) *Server
func (*LeastResponseTime) UpdateResponseTime ¶
func (lrt *LeastResponseTime) UpdateResponseTime(serverURL string, duration time.Duration)
type RoundRobin ¶
type RoundRobin struct{}
func (*RoundRobin) Name ¶
func (rr *RoundRobin) Name() string
func (*RoundRobin) NextServer ¶
func (rr *RoundRobin) NextServer(pool ServerPool, _ *http.Request, w *http.ResponseWriter) *Server
type Server ¶
type Server struct {
URL string
Weight int
CurrentWeight atomic.Int32
ConnectionCount int32
MaxConnections int32
Alive atomic.Bool
LastResponseTime time.Duration
}
func (*Server) CanAcceptConnection ¶
type ServerPool ¶
type SessionAffinity ¶ added in v0.4.4
type SessionAffinity struct {
// contains filtered or unexported fields
}
func NewSessionAffinity ¶ added in v0.4.4
func NewSessionAffinity() *SessionAffinity
NewSessionAffinity creates a new sticky session manager with default settings
func (*SessionAffinity) Name ¶ added in v0.4.4
func (ss *SessionAffinity) Name() string
Name returns the identifier of the session affinity
func (*SessionAffinity) NextServer ¶ added in v0.4.4
func (ss *SessionAffinity) NextServer(pool ServerPool, r *http.Request, w *http.ResponseWriter) *Server
NextServer selects the appropriate backend server based on session stickiness
type WeightedRoundRobin ¶
type WeightedRoundRobin struct {
// contains filtered or unexported fields
}
func (*WeightedRoundRobin) Name ¶
func (wrr *WeightedRoundRobin) Name() string
func (*WeightedRoundRobin) NextServer ¶
func (wrr *WeightedRoundRobin) NextServer(pool ServerPool, _ *http.Request, w *http.ResponseWriter) *Server
Click to show internal directories.
Click to hide internal directories.