0.0
No commit activity in last 3 years
No release in over 3 years
Easily distribute any code in multiple servers
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

Madrox Gem Version Code Climate

Easily distribute any code across multiple servers

Install

gem install madrox-cluster

Usage

###Starting a Server

madrox 127.0.0.1 5000

###Adding servers

#configure a server
Madrox.config(["server_1:5000", "server_1:5001", "server_2:5000", "server_2:5001"])

###Executing a block

#Distribute processing across the servers
result = Madrox.collect([35, 30, 35, 37, 25, 30]) do |x|
  def fib(n)
    n<=1 ? n : fib(n-2) + fib(n-1)
  end
  fib(x)
end

###Register code in advance

CalcClass = Proc.new { |x|
  class Calc
    def fib(n)
      n<=1 ? n : fib(n-2) + fib(n-1)
    end
  end

  Calc
}

#stores this class in all servers
Madrox.register("Calc", CalcClass)

result = Madrox.collect([35, 30, 35, 37, 25, 30]) do |x|
  Calc.new.fib(x)
end

Benchmarks

Benchmarks for 10 x fibbonaci(40):
┌──────────────────────┬───────────────────────────────┬─────────────────────┐
│                      │ Machines Used                 │ Time Taken          │
├──────────────────────────────────────────────────────┼─────────────────────┤
│ Normal Ruby Process  │ 1 mac 4 cores                 │ 3 minutes 40 secs   │
├──────────────────────┼───────────────────────────────┼─────────────────────┤
│ 4 Madrox Servers     │ 1 mac 4 cores                 │ 1 minute  36 secs   │
├──────────────────────┼───────────────────────────────┼─────────────────────┤
│ 6 Madrox Servers     │ 1 mac 4 cores + 1 mac 2 cores │ 1 minute   5 secs   │
└──────────────────────┴───────────────────────────────┴─────────────────────┘

Disclaimer

This gem is provided as is - therefore, the creators and contributors of this gem are not responsible for any damages that may result from its usage. Although Authentication and SSL may be added later, Madrox is experimental and is meant to be used in private trusted local networks. Use at your own risk.

Madrox is an experiment. For a more solid solution please check dRuby

Bitdeli Badge