Coder Social home page Coder Social logo

loadbalancing's Introduction

Load balancing utilities

Utilities for load balancing of scale out storage solutions, such as the knsfd NFS proxy.

vip_manager

VIP Manager is a utility to manage virtual ("alias") IPs for instances in a Managed Instance Group. Virtual IPs are distributed in an even way between all the nodes in the instance group. When the number of nodes changes, Virtual IPs are automatically re-balanced.

Build

go build vip_manager.go

Run

vip_manager \
  -project PROJECT \
  -zone GCE_ZONE \
  -gce_instance_group INSTANCE_GROUP_NAME \
  -alias_network NAME_OF_ALIAS_NETWORK \
  -vips NETWORK_PREFIX

Replace works in ALL_CAPS with values for your environment.

Project and GCE zone are auto configured inside Google Cloud Platform (GCE or GKE).

Permissions

vip_manager needs permissions to:

  1. List GCE instances and instance groups.
  2. Add and remove alias IPs to/from GCE instances.

These permissions are not included in "Compute Engine Read Write" nor "Allow full access to all Cloud APIs" when creating a VM. One way to allow vip_manager to run inside a VM in GCE/GKE is to grant the "Compute Instance Admin (v1)" role to the GCE service account ([email protected]).

(TODO: Figure out a better way)

metrics_exporter

Metrics Exporter is a utility to export system metrics for load balancing, for example to load balance connections based on current NFS connections.

Build

go build metrics_exporter.go

Run

metrics_exporter [-p PORT]

The default port is 9001.

Manual test

curl http://IP:PORT/metrics

Replace IP and PORT.

Load balancing with Cloud DNS

Once vip_manager is set up and managing the virtual IPs, a simple way to orchestrate random ("round robin") DNS is using Google Cloud DNS.

Create a new private zone

Create private zone

Click "Create" then "Add Standard"

Add Standard

Add all the IPs in the virtual IP network prefix.

Example with the 10.9.8.0/30 prefix:

Add Ips

Virtual machines in the designated network can now query the new DNS zone.

# host myservice.loadbalancing.mydomain.com
myservice.loadbalancing.mydomain.com has address 10.9.8.3
myservice.loadbalancing.mydomain.com has address 10.9.8.1
myservice.loadbalancing.mydomain.com has address 10.9.8.0
myservice.loadbalancing.mydomain.com has address 10.9.8.2

loadbalancing's People

Contributors

bjornleffler avatar

Watchers

 avatar  avatar

Forkers

gunpowder-tech

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.