oystr-foss / proxy-load-balancer

Oplb is a dynamic proxy load balancer that enables us to handle as many ephemeral clients as possible, while being careless about what discovery backend is being used.

Home Page:https://www.oystr.com.br

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

oplb (Oystr Proxy - Load Balancer)

badge

oplb is a dynamic proxy load balancer that enables us to handle as many ephemeral clients as possible, while being careless about what discovery backend is being used. All requests are sharded using a consistent hashing algorithm based in a Java implementation by rafaelsilverioit.

Requirements

  • build-essential
  • C++17
  • cmake
  • libboost-dev
  • libboost-system-dev
  • libboost-thread-dev
  • libcurl4-openssl-dev
  • libssl-dev
  • libcrypto++-dev
  • libjsoncpp-dev

Building from source

Just follow the steps below on a Docker image based on Alpine:

$ git clone https://github.com/oystr-foss/proxy-load-balancer oplb
$ cd oplb
$ ./build-and-install.sh

Configuration

A proxy.conf configuration file is expected to exist under /etc/oplb/.

The default configuration looks like:

# general config
host=0.0.0.0
port=8080
log_info=<PATH>

# interval in seconds between each query to the discovery backend.
refresh_interval=60

# discovery backend
discovery_url=http://localhost:10000
endpoint=/services

Discovery backend

Basically, we expect an endpoint that serves a JSON payload with at least the following strutcture:

{
  "host": "<IP ADDRESS>",
  "port": 8888
}

Running

In order to run the load balancer, just type oplb:

$ oplb
Listening on: 0.0.0.0:8080

[06/10/2020 12:39:24] 127.0.0.1:36588 -> 127.0.0.1:8888
[06/10/2020 12:39:28] 127.0.0.1:36596 -> 127.0.0.1:8888

Debugging

By default, all logs are sent to stdin/stderr but you can set log_info=<PATH> to store it in a custom file.

TODO

  • Create/use an http client;
  • Add tests.

About

Oplb is a dynamic proxy load balancer that enables us to handle as many ephemeral clients as possible, while being careless about what discovery backend is being used.

https://www.oystr.com.br

License:Other


Languages

Language:C++ 93.4%Language:CMake 4.7%Language:Dockerfile 1.2%Language:Shell 0.7%