Golang Super Simple Load Balance

Related tags

Network sslb
Overview

SSLB (Super Simple Load Balancer) ver 0.1.0

It's a Super Simple Load Balancer, just a little project to achieve some kind of performance.

Features

  • High availability (improving with time the speed)
  • Support to WebSockets
  • Monitoring the internal state (improving)
  • Really easy to configure, just a little JSON file

Next features

  • Manage configurations in runtime without downtime
  • Complete internal status and diagnostics
  • HTTP/2 support
  • Cache
  • HTTPS support

If you have any suggestion don't hesitate to open an issue, pull requests are welcome too.

Install

To install type:

go get github.com/eduardonunesp/sslb

Don't forget to create your configuration file config.json at the same directory of project and run it. You can use the command sslb -c to create an example of configuration file.

Usage

Type sslb -h for the command line help

sslb -h                                                                                                                                                              
NAME:
   SSLB (github.com/eduardonunesp/sslb) - sslb

USAGE:
   sslb [global options] command [command options] [arguments...]

VERSION:
   0.1.0

COMMANDS:
   status, s	Return the internal status
   help, h	Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --verbose, -b	activate the verbose output
   --filename, -f 	set the filename as the configuration
   --help, -h		show help
   --version, -v	print the version

After the configuration file completed you can type only sslb -b to start SSLB with verbose mode, that command will log the output from SSLB in console. That will print something like that:

sslb -b                                                                                                                                                               
2015/10/25 22:58:33 Start SSLB (Server)
2015/10/25 22:58:33 Create worker pool with [1000]
2015/10/25 22:58:33 Prepare to run server ...
2015/10/25 22:58:33 Setup and check configuration
2015/10/25 22:58:33 Setup ok ...
2015/10/25 22:58:33 Run frontend server [Front1] at [0.0.0.0:80]
2015/10/25 22:58:34 Backend active [Backend 1]
2015/10/25 22:58:34 Backend active [Backend 2]
2015/10/25 22:58:34 Backend active [Backend 3]

Configuration options

  • general:

    • maxProcs: Number of processors used by Go runtime (default: Number of CPUS)
    • workerPoolSize: Number of workers for processing request (default: 10)
    • gracefulShutdown: Wait for the last connection closed, before shutdown (default: true)
    • websocket: Ready for respond websocket connections (default: true)
    • rpchost: Address to expose the internal state (default: 127.0.0.1)
    • rpcport: Port to expose the internal state (default: 42555)
  • frontends:

    • name: Just a identifier to your front server (required)
    • host: Host address that serves the HTTP front (required)
    • port: Port address that serves the HTTP front (required)
    • route: Route to receive the traffic (required)
    • timeout: How long can wait for the result (ms) from the backend (default: 30000ms)
  • backends:

    • name: Just a identifier (required)
    • address: Address (URL) for your backend (required)
    • hearbeat: Addres to send Head request to test if it's ok (required)
    • hbmethod: Method used in request to check the heartbeat (default: HEAD)
    • inactiveAfter: Consider the backend inactive after the number of checks (default: 3)
    • activeAfter: COnsider the backend active after the number of checks (default: 1)
    • heartbeatTime: The interval to send a "ping" (default: 30000ms)
    • retryTime: The interval to send a "ping" after the first failed "ping" (default: 5000ms)

Example (config.json)

{
    "general": {
        "maxProcs": 4,
        "workerPoolSize": 10,
    },
    
    "frontends" : [
        {
            "name" : "Front1",
            "host" : "127.0.0.1",
            "port" : 9000,
            "route" : "/",
            "timeout" : 5000,
            
            "backends" : [
                {
                    "name" : "Back1",
                    "address" : "http://127.0.0.1:9001",
                    "heartbeat" : "http://127.0.0.1:9001",
                    "inactiveAfter" : 3,
                    "heartbeatTime" : 5000,
                    "retryTime" : 5000
                },{
                    "name" : "Back2",
                    "address" : "http://127.0.0.1:9002",
                    "heartbeat" : "http://127.0.0.1:9002",
                    "inactiveAfter" : 3,
                    "heartbeatTime" : 5000,
                    "retryTime" : 5000
                }
            ]
        }
    ]
}

LICENSE

Copyright (c) 2015, Eduardo Nunes Pereira All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of sslb nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

You might also like...
Client-Side Load Balancing for Golang

cslb Client-Side Load Balancer This Project is in early developing state Feature Multiple client-side load balancing solutions support Round-Robin DNS

High-performance PHP application server, load-balancer and process manager written in Golang
High-performance PHP application server, load-balancer and process manager written in Golang

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a serv

Laptop Booking Application in Golang and gRPC, load-balancing with NGINX, and fully compatible with HTTPS OpenAPI v3

Laptop Booking Application in Golang and gRPC Goals GitHub CI & Coverage Badge Serialize protobuf messages Create laptop unary gRPC Search laptop Serv

Seesaw v2 is a Linux Virtual Server (LVS) based load balancing platform.

Seesaw v2 Note: This is not an official Google product. About Seesaw v2 is a Linux Virtual Server (LVS) based load balancing platform. It is capable o

A modern layer 7 load balancer from baidu

BFE BFE is a modern layer 7 load balancer from baidu. Advantages Multiple protocols supported, including HTTP, HTTPS, SPDY, HTTP2, WebSocket, TLS, Fas

Generate HTTP load and plot the results in real-time
Generate HTTP load and plot the results in real-time

ali A load testing tool capable of performing real-time analysis, inspired by vegeta and jplot. ali comes with an embedded terminal-based UI where you

A load balancer supporting multiple LB strategies written in Go
A load balancer supporting multiple LB strategies written in Go

farely A load balancer supporting multiple LB strategies written in Go. Goal The goal of this project is purley educational, I started it as a brainst

gobetween - modern & minimalistic load balancer and reverse-proxy for the ☁️ Cloud era.
gobetween - modern & minimalistic load balancer and reverse-proxy for the ☁️ Cloud era.

gobetween - modern & minimalistic load balancer and reverse-proxy for the ☁️ Cloud era. Current status: Maintenance mode, accepting PRs. Currently in

 ZheTian Powerful remote load and execute ShellCode tool
ZheTian Powerful remote load and execute ShellCode tool

ZheTian ZheTian Powerful remote load and execute ShellCode tool 免杀shellcode加载框架 命令详解 -u:从远程服务器加载base64混淆后的字节码。 -r:从本地文件内读。 -s:读取无修改的原始文件,只能从本地加载 -o:参数

Comments
  • Version 0.1.0 Ready

    Version 0.1.0 Ready

    • Create new workers if cached are exausted
    • Support to cancelled requests
    • Graceful shutdown
    • Added support to websocket
    • Cleanup the structure
    • Better configuration
    • Better JSON config file check
    • Default values
    • Tests for configuration files
    • Restructuring the server
    • Removed races and useless structs
    • Cleanup and better command display
    • Readme
    opened by eduardonunesp 0
Owner
Eduardo Pereira
Software Engineer, Gamedev, Blockchain Enthusiast, and Guitar Student
Eduardo Pereira
Using Envoy Proxy to load-balance gRPC services on GKE with header value based Session Affinity

Using Envoy Proxy to load-balance gRPC services on GKE with header value based S

Daniel William Clarke 2 Aug 24, 2022
Super simple tcp intranet penetration proxy program

A super easy to configure tcp intranet penetration proxy program that forwards intranet tcp ports to public network servers. Tested proxies for intranet HTTP services, windows remote desktop, ssh access and other scenarios.

null 18 Dec 11, 2022
Super fault-tolerant gateway for HTTP clusters, written in Go. White paper for reference - https://github.com/gptankit/serviceq-paper

ServiceQ ServiceQ is a fault-tolerant gateway for HTTP clusters. It employs probabilistic routing to distribute load during partial cluster shutdown (

Ankit Gupta 66 Jul 16, 2022
Simple, fast and scalable golang rpc library for high load

gorpc Simple, fast and scalable golang RPC library for high load and microservices. Gorpc provides the following features useful for highly loaded pro

Aliaksandr Valialkin 667 Dec 19, 2022
Consul Load-Balancing made simple

Notes From release 1.5.15 onward, fabio changes the default GOGC from 800 back to the golang default of 100.

fabio 7.1k Dec 27, 2022
Consul Load-Balancing made simple

Notes From release 1.5.15 onward, fabio changes the default GOGC from 800 back to the golang default of 100. Apparently this made some sense back in t

fabio 7.1k Dec 31, 2022
Simple Reverse Proxy Load Balancer

lb - a reverse proxy load-balancing server, It implements the Weighted Round Robin Balancing algorithm

Blessing Pariola 3 Mar 23, 2022
Simple Nginx Load Balancing Use Docker Engine

Load Balancing Menggunakan Nginx Load Balancing adalah sebuah mekanisme untuk membagi atau mendistribusikan trafik ke beberapa server. Nginx selain be

Widya Ade Bagus 5 Dec 14, 2021
Simple load-balancer for npchat servers, based on the xor distance metric between node & user id

npchat-helmsman Simple load-balancer for npchat servers, based on the xor distance metric between node & user id. Local Development Clone this reposit

npchat 0 Jan 15, 2022
High-performance PHP application server, load-balancer and process manager written in Golang

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a serv

Spiral Scout 6.9k Jan 1, 2023