GithubHelp home page GithubHelp logo

messagepipe's Introduction

MessagePipe

MessagePack (msgpack.org/) based high performance rpc layer built on zmq

This fork is built on zmq rather than tcp. ZMQ already supports multiple transport layers, as well as multilpe messaging paradigms (www.zeromq.org/).

tl;dr Just switching zmq for tcp here made this consistently 20% faster. zmq is the shit.

Example

server.rb:

class TestServer < ZMQMessagePipeServer

  def add(a, b)
    a + b
  end

  def echo(string)
    string
  end

end

TestServer.new.start

client.rb

client = MessagePipe.new('localhost', 9191))
client.call :add, 1, 2 #=> 3
client.call :echo, 'hello' #=> 'hello'
client.call :does_not_exist #=> raise MessagePipe::RemoteError, 'NoMethodError: no method with name does_not_exist'

benchmarks

Tobi’s original release:

$ time ruby -rsocket benchmark.rb benchmark finished in 7.11434507369995s benchmark finished in 7.72831606864929s benchmark finished in 8.28042602539062s benchmark finished in 8.66085696220398s benchmark finished in 8.80554294586182s

real 0m8.914s user 0m1.036s sys 0m0.934s

jessestorimer@jessebook:~/projects/messagepipe
git:master
ree-1.8.7@messagepipe

$ time ruby -rsocket benchmark.rb benchmark finished in 7.20177602767944s benchmark finished in 7.79495096206665s benchmark finished in 8.26117610931396s benchmark finished in 8.58127403259277s benchmark finished in 8.78165793418884s

real 0m8.891s user 0m1.030s sys 0m0.933s

Same thing but with zmq

$ time ruby benchmark.rb benchmark finished in 7.06875610351562s benchmark finished in 7.06779718399048s benchmark finished in 7.07593989372253s benchmark finished in 7.12636685371399s benchmark finished in 7.13110589981079s

real 0m7.240s user 0m1.124s sys 0m1.917s

jessestorimer@jessebook:~/projects/messagepipe
git:master+
ree-1.8.7@messagepipe

$ time ruby benchmark.rb benchmark finished in 7.06084990501404s benchmark finished in 7.0807249546051s benchmark finished in 7.08461308479309s benchmark finished in 7.08931183815002s benchmark finished in 7.0946729183197s

real 0m7.200s user 0m1.112s sys 0m1.913s

todo

  • improve file structure

  • implement EM based client transport

  • implement redis based client transport with delivery guarantees

  • allow calls to be async if transport supports it (will require you to call result.get to get the actual payload)

  • support timeouts and reconnects

messagepipe's People

Contributors

jstorimer avatar

Stargazers

 avatar

Watchers

 avatar  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.