GithubHelp home page GithubHelp logo

plorentz / ocelot-graceful-load-balancer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sjefvanleeuwen/ocelot-graceful-load-balancer

0.0 0.0 0.0 34 KB

A Provider for Ocelot which provides a Round Robin Load balancer with API Nodes Health Checking.

License: MIT License

C# 100.00%

ocelot-graceful-load-balancer's Introduction

Ocelot Graceful Load Balancer

nuget .NET Core

What is it?

A Provider for Ocelot which provides a Round Robin Load Balancer with API Nodes Health Checking.

Status

The provider is in alpha stage but should be usable. It has been tested as part of my cluster setup.

This project is open to pull requests.

Setup

The setup is comparable to other Ocelot providers. Its target framework is netcoreapp3.1.

Install nuget package

dotnet add package Ocelot.GracefulLoadBalancer --version 0.0.2-alpha

or visit the nuget for other options on: https://www.nuget.org/packages/Ocelot.GraceFulLoadBalancer

Adding the provider to your project

The following shows a typical configuration a cluster for a 3 Node API Endpoint setup on the balancer and should be easily adaptable to your own settings. I assume you already have basic knowledge of Ocelot. Note! That I am using the YAML Configuration provider from NetEscapedes in the sample project instead of configuring via JSON. If you prefer JSON it should be easy to convert it manually or with a YAML to JSON converter.

Consider the following configuration:

Routes:
- DownstreamPathTemplate: "/api/auth/{everything}"
  DownstreamScheme: http
  DownstreamHostAndPorts:
  - Host: 192.168.178.88
    Port: 8800
  - Host: 192.168.178.90
    Port: 8800
  - Host: 192.168.178.91
    Port: 8800
  LoadBalancerOptions:
    Type: GracefulLoadBalancer
  UpstreamPathTemplate: "/api/auth/{everything}"
  UpstreamHttpMethod:
  - Get

The LoadBalancer options simply point to the implementation. You can add the loadbalancer as follows:

builder.ConfigureServices(s => {
    s.AddOcelot().AddGracefulLoadBalancer();
})

View the sample ApiGateway for starting up an entire gateway.

ocelot-graceful-load-balancer's People

Contributors

sjefvanleeuwen avatar plorentz avatar

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.