Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.
/ dice Public archive

🎲 A yet experimental load balancer for non-microservice infrastructures.

License

Notifications You must be signed in to change notification settings

dominikbraun/dice

Repository files navigation





Dice – An experimental load balancer for non-microservice infrastructures.





🎲 Dice is an experimental load balancer designed for non-microservice, static infrastructures with focus on simplicity, operability and high flexibility.

Project status: In active development.

Included Features

  • Different load balancing methods for each application
  • Periodic health checks for deployed instances
  • Service and server updates without downtime
  • Configuration changes without restart
  • Nodes with less computing resources receive less requests
  • Attachment and detachment of instances on the fly
  • Deployments managed by logical and physical affiliation
  • Dice is passive and explicit: Make services available for load balancing yourself

Simple Example

The Scenario

Our infrastructure is quite simple: We've got two servers, main-server and another-server. Servers, virtual machines etc. are known to Dice as nodes. Also, we have the services A, B and C. These services might be web applications, REST APIs or authentication services for example.




Each service A, B and C has an instance deployed to main-server. An instance is a concrete executable instance of a service, like a PHP application running on Apache or a standalone Go binary. Additionally, there are instances of A and B deployed to another-server because they're under heavy load.

Setting up our environment

To keep things short, we'll just create one node, one service and one instance. After starting Dice, we can register our main-server:

$ dice node create --attach --weight=2 main-server

Registering nodes will help Dice choosing an appropriate service instance later. --weight=2 indicates that the server has double computing capacities.

After that, we have to tell Dice about our services – let's just create service A here.

$ dice service create --urls=example.com --enable A

By using --url=example.com, we specify a public URL that the service is associated with. We can add or remove these URLs later as well. When a request for example.com hits Dice, it will forward the request to an instance of service A.

Start load balancing

Registering a service instance is fairly easy:

$ dice instance create --name=first-instance A main-server 172.21.21.1:8080

This tells Dice to register an instance of service A that has been deployed to main-server and is available at 172.21.21.1:8080.

Attaching the created instance to Dice will make it available for load balancing:

$ dice instance attach first-instance

Incoming requests for example.com will be balanced among instances of A. In this case, first-instance will be used each time.

Installation

Download the latest release of Dice [...]

Getting started

[...]