Skip to content

zeppaman/.Net-Load-Balancer

Repository files navigation

.Net-Load-Balancer

A simple load balancer implemented using ASP.NET Core

This is a lightweight bundle that supports :

  1. Filters
  2. Chaching
  3. Rewrite
  4. Balancing
  5. Transformation

Whole application is written in .NET Core, so it can be run as embedded app or in a webserver.

The main principle is to provide an easy to use solution that can be installed in 5 minutes.

Every feature of application is implemented with its own owin module that can be enabled or disabled by cofiguration. Each module is configurable by a dedicated config file.

Where I can Download it?

At the moment, there aren't any release available. This is beacause I'm still working on it, please be patient. You cannot download a release package but you can clone and compile. Please open an issue or contact me to let me know if this project may be useful and of use for you. This will make me work harder ;-)

Contibute

If interested, please contact me or open an issue.

How .Net Load Balancer works

Please see the full documentation at wiki page.

Filters

This module provide an easy way to filter request based on some rules. All request that match the filter will be dropped. Each url is tested over a set of rule. If the url matches the rule then the request will be dropped. Only one match determine the rule activations so, basically, all rules are "OR" conditions by default. Each rule can test a set of request parameters (url, agent, headers). Inside a single rule, all condition must be true to activate it. This means that we are working with something like this ( CONDITION A AND CONDITION B) OR (CONDITION C) and this will support most cases.

Chaching

By using standard .NET Core caching module we can provide cache support for url, defining policy, etc. Caching has many options that are basically a wrap of the original module, so you ca referr to here for more details.

Rewrite

This stage will allow static rewrite rule. This is often demanded to the application but can be implemented here to simplify server part or to map virtual urls over many different applications. This is mostly a way to couple external url with internal one in case there isnt' a way to change balanced applications. Balancer itself will balance the output of this transformation.

Balancig

This is the core module that define, for each url wath will be the destination. This step generates only the real path, replacing selected host. The host can be selected using one of the following algorithm:

  1. Number of request coming
  2. Number of request pending
  3. Quicker response
  4. Affiliation (Based on Cookie)

Proxy

After Balancing stage complete the computation of right url, proxy module will invoke the request repling the client.

Transformation

Based on rules, similar to filters, you can define some regular expression to alter content. In that way you can replace absolute urls with the proxy one, or change local url with cdn ones.

How to use

This balancer can be used in theese ways:

  1. As binary: using embedded or iis web hosted package, you can download it, configure changes files and run.
  2. As library: downloading from nuget, you can create your own bundle where you can add feature or complicate logics.

What package is for me? My suggestion is to start with binary pack then, if you'll need will be out of the standards, you will implement your custom rules to modules to add to the queue.

Releases

No releases published

Packages

No packages published