package
module
Version:
v0.0.0-...-3baf643
Opens a new window with list of versions in this module.
Published: Nov 2, 2024
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
GoLB: The Lightweight, User-Friendly Load Balancer for Testing in Go
GoLB is a simple RoundRobin golang loadbalancer. It performs active cleaning and passive recovery for unhealthy backends.
Features:
Cleans: Excludes servers marked as unhealthy from the round-robin rotation.
Recovers: Periodically tries to recheck and reintegrate previously unhealthy servers back into service.
package main
import (
"github.com/dhyanio/golb"
)
func main() {
// Slice of servers
servers := []string{"http://localhost:8081", "http://localhost:8082"}
// Start Loadbalancer
golb.Start(serverList, "3000")
}
Documentation
¶
Start initializes servers, sets up the load balancer, and starts listening on the specified port.
type LoadBalancer struct {
}
LoadBalancer represents a simple round-robin load balancer with active cleaning and passive recovery.
NewLoadBalancer initializes a LoadBalancer with the specified port and servers.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.