0.0
No commit activity in last 3 years
No release in over 3 years
Hawatel_tlb is a ruby version load balancing which the purpose is to dynamic return selected address IP/domainame based on specified algorithm
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.10
~> 10.0
>= 0
 Project Readme

Hawatel_tlb

Hawatel_tlb is a ruby version of load balancer which the purpose is to dynamic return selected address IP/hostname based on specified algorithm. Depend on settings a gem has built features like regularly monitoring status backend nodes, response time, calculating fastest node based on history, flapping detection and more. Currently, supported algorithms are round robin, dynamic ration, fastest, ratio and weighted.

Installation

Add this line to your application's Gemfile:

gem 'hawatel_tlb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install hawatel_tlb

Available algorithms

Name Description
dynamicratio Dynamic load balancing algorithm based on dynamic ratio weights. Weight for each node is setting up by following formula: 100 - (respond_time / sum_respond_time) * 100
fastest Algorithm based on history statistics about respond time and 'online' states (flapping detection). Return host with fastest responds time.
ratio Static load balancing algorithm based on ratio weights
roundrobin Standard Round-robin algorithm with fail node and flapping detection
weighted Algorithm based on specified by user weight, return currently available host with highest metric.

Example usage

Create client
client = HawatelTlb::Client.new
Add hosts to group
client.add({:host => 'api.example.com', :port => 80, :weight => 0, :state => 'enable'})
client.add({:host => 'api.example2.com', :port => 80, :weight => 0, :state => 'enable'})
client.add({:host => 'api.example3.com', :port => 80, :weight => 0, :state => 'enable'})
Set algorithm
client.configure({:mode => 'fastest'})
Call API request
p client.node
{:host=>"example2.com", :port=>80}

Net::HTTP.get(client.node[:host], '/q=seach_example')

Contributing

See CONTRIBUTING

License

The gem is available as open source under the terms of the MIT License.