AVAniketh0905/go-balancing

★ 0Forks 0GoGitHub ↗Compare

README

Go Load Balancing

LB Algos

  • Round Robin
  • Weighted Round Robin
  • Random
  • Least Connections

Types

Server

weak numConns, currently only wrks for server side, thus server side db(in memory)

// helper global var
MaxConnsDB(in mem sync.Map)
  • numConns (atomic)
  • config
  • context
  • handlerFunc

Service

  • server
  • type

Instance

  • id
  • service
  • state
  • stateChan
  • mutex

not nice: changes ->

  • id, port, ctx, state, stateChan, mutex, server, serviceType

shuld be able to pass state chan to service

Reverse Proxy

to be used before passing to a server()

  • lb (loadbalancer)
  • servers(slice of addresses)

Load Balancer

  • servers
  • weights (optional)

Contributors

AVAniketh0905

Issues