All Projects → umputun → rlb

umputun / rlb

Licence: MIT license
Redirecting Load Balancer

Programming Languages

go
31211 projects - #10 most used programming language
Dockerfile
14818 projects

Projects that are alternatives of or similar to rlb

serviceq
Super fault-tolerant HTTP load balancer & queue. White paper for reference - https://github.com/gptankit/serviceq-paper
Stars: ✭ 66 (+120%)
Mutual labels:  http-proxy, load-balancer
Multitor
Create multiple TOR instances with a load-balancing.
Stars: ✭ 624 (+1980%)
Mutual labels:  http-proxy, load-balancer
Armor
Uncomplicated, modern HTTP server
Stars: ✭ 1,629 (+5330%)
Mutual labels:  http-proxy, load-balancer
freeproxy
Get http proxies from some free proxy sites. (爬取免费HTTP代理)
Stars: ✭ 18 (-40%)
Mutual labels:  http-proxy
Proxy
The type-safe REST library for .NET Standard 2.0 (NetCoreStack Flying Proxy)
Stars: ✭ 40 (+33.33%)
Mutual labels:  load-balancer
proxy-ng
No description or website provided.
Stars: ✭ 33 (+10%)
Mutual labels:  http-proxy
docker-django-nginx-uwsgi-postgres-load-balance-tutorial
實戰 Docker + Django + Nginx + uWSGI + Postgres - Load Balance -Tutorial 📝
Stars: ✭ 102 (+240%)
Mutual labels:  load-balancer
ddal
DDAL(Distributed Data Access Layer) is a simple solution to access database shard.
Stars: ✭ 33 (+10%)
Mutual labels:  load-balancer
HttpFilteringEngine
Transparent filtering TLS proxy.
Stars: ✭ 48 (+60%)
Mutual labels:  http-proxy
system-design-notebook
Learn System Design step by step
Stars: ✭ 372 (+1140%)
Mutual labels:  load-balancer
trickster
Open Source HTTP Reverse Proxy Cache and Time Series Dashboard Accelerator
Stars: ✭ 1,753 (+5743.33%)
Mutual labels:  http-proxy
small-proxy
Go实现的一个跨平台域名式访问内网穿透工具
Stars: ✭ 49 (+63.33%)
Mutual labels:  http-proxy
cnn-proxy
Subdomain method that proxies websockets, XMLHttpRequests, and more.
Stars: ✭ 13 (-56.67%)
Mutual labels:  http-proxy
android-sdk
AppSpector is a debugging service for mobile apps
Stars: ✭ 39 (+30%)
Mutual labels:  http-proxy
llb
Dead simple event-driven load-balancer
Stars: ✭ 27 (-10%)
Mutual labels:  load-balancer
swish
C++ HTTP requests for humans
Stars: ✭ 52 (+73.33%)
Mutual labels:  http-proxy
k8s-deployer
Deploy Kubernetes service and store retrieved information in the Consul K/V store
Stars: ✭ 23 (-23.33%)
Mutual labels:  load-balancer
nanoproxy
Small fast HTTP forward proxy in Go.
Stars: ✭ 31 (+3.33%)
Mutual labels:  http-proxy
php-proxy
php proxy based on GoAgent protocal,Implemented by golang
Stars: ✭ 85 (+183.33%)
Mutual labels:  http-proxy
go-srvlb
DNS SRV Load Balancer for gRPC
Stars: ✭ 41 (+36.67%)
Mutual labels:  load-balancer

RLB - Redirecting Load Balancer

Build Status Coverage Status Go Report Card Docker Automated build

This service redirects incoming GET and HEAD requests (with 302) to the upstream servers. Servers picked up randomly, unhealthy boxes excluded dynamically.

Note: This is not a replacement for reverse proxy. All it does is HTTP redirect, not the real network proxying.

Install

  1. Copy provided docker-compose.yml
  2. Make rlb.yml config for your service(s) (see rlb-sample.yml below in Config file format section).
  3. Start container with docker-compose up -d

This will start rlb on port :7070 by default and requests like http://host/api/v1/jump/service1?url=/files/blah.mp3 will be redirected to the one of upstreams.

API

  • GET|HEAD /api/v1/jump/<service>?url=/blah/blah2.mp3 – returns 302 redirect to destination server
  • GET|HEAD /<service>?url=/blah/blah2.mp3 – same as above

Failback support (optional)

This allow to check the upstreams health for the requested resource and failback to a predefined servers if request fails. failback defined in the config file and in case if non-empty will add an additional HEAD request to the final URL. If request returns 200, the request will be passed to the upstream, if not - the result will be assembled from the failback + resource. I.e. if failback is http://failback.com/ and resource is /files/blah.mp3 then the final URL will be http://failback.com/files/blah.mp3.

Config file format

# top level services
service1:
    n1: # node id
        server: http://n1.radio-t.com     # base url 
        ping: /rtfiles/rt_podcast480.mp3  # ping url to check node's health
        method: HEAD                      # ping method, uses HEAD if nothing defined
        weight: 1                         # relative weight of the node [1..n]   

    n2:
        server: http://n2.radio-t.com
        ping: /rtfiles/rt_podcast480.mp3
        method: HEAD
        weight: 1

    n3:
        server: http://n3.radio-t.com
        ping: /rtfiles/rt_podcast480.mp3
        method: HEAD
        weight: 5                         # this node will get 5x hits comparing to n1 and n2 

service2:
    n1:
        server: http://n1.radio-t.com
        ping: /rtfiles/rt_podcast480.mp3
        method: GET
        weight: 1

    n2:
        server: http://n2.radio-t.com
        ping: /rtfiles/rt_podcast480.mp3
        method: GET
        weight: 3

    n3:
        server: http://n3.radio-t.com
        ping: /rtfiles/rt_podcast480.mp3
        method: GET
        weight: 1

failback: http://archives.radio-t.com/media

Stats

RLB does not implement any statistics internally but supports external service for requests like this:

	type LogRecord struct {
		ID       string    `json:"id,omitempty"` // uniuque id
		FromIP   string    `json:"from_ip"`      // source ip
		TS       time.Time `json:"ts,omitempty"` // timestamp
		Fname    string    `json:"file_name"`    // requested file name
		Servcie  string	   `json:"service"`      // requested service
		DestHost string    `json:"dest"`         // picked destination node
	}

If stats url defined in command line or environment, each redirect will also hit stats url (POST) with LogRecord in body.

Parameters

Usage:
  main [OPTIONS]

Application Options:
  -p, --port=    port (default: 7070) [$PORT]
  -c, --conf=    configuration file (default: rlb.yml) [$CONF]
  -r, --refresh= refresh interval (default: 30) [$REFRESH]
  -t, --timeout= HEAD/GET timeouts (default: 5) [$TIMEOUT]
  -s, --stats=   stats url [$STATS]
      --dbg      debug mode [$DEBUG]

Status

RLB runs in production for several years and serves downloads from radio-t

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].