Extremely efficient object serialization library for cross-language communication.
It's like JSON, but very fast and small.
MessagePack is a binary-based efficient object serialization library. It enables to exchange structured objects between many languages like JSON. But unlike JSON, it is very fast and small.
Typical small integer (like flags or error code) is saved only in 1 byte, and typical short string only needs 1 byte except the length of the string itself. [1,2,3] (3 elements array) is serialized in 4 bytes using MessagePack as follows:
> require 'msgpack' > msg = [1,2,3].to_msgpack #=> "\x93\x01\x02\x03" > MessagePack.unpack(msg) #=> [1,2,3]
MessagePack-RPC is cross-language RPC library for client, server and cluster applications. Because it releases you from complicated network programming completely and provides well-designed API, you can easily implement advanced network applications with MessagePack-RPC.
require 'msgpack/rpc'
class MyHandler
def add(x,y) return x+y end
end
svr = MessagePack::RPC::Server.new
svr.listen('0.0.0.0', 18800, MyHandler.new)
svr.run
require 'msgpack/rpc'
c = MessagePack::RPC::Client.new('127.0.0.1',18800)
result = c.call(:add, 1, 2) #=> 3
In this test (source code), it measured the elapsed time of serializing and deserializing 200,000 target objects. The target object consists of the three integers and 512 bytes string.
| MessagePack-RPC | Thrift | Avro | |
|---|---|---|---|
| Asynchronous RPC | |||
| Parallel Pipelining | |||
| Thrift IDL | |||
| Dynamic Typing | |||
| Connection pooling | |||
| Delayed return | |||
| Event-driven I/O |
Information of these related projects are available from: JSON, Protocol Buffers, Thrift, Avro.
Quick Start Reference: RPC Serialization
> gem install msgpack > gem install msgpack-rpc
Ruby implementation supports zero-copy facility.
port install msgpack (MacPorts)
Download msgpack-0.5.4.tar.gz and build it. RPC for C++ is at msgpack-rpc-0.3.0.tar.gz. C/C++ implementation supports zero-copy facility.
Quick Start Reference: RPC Serialization
Maven2 repository is located here. See javadoc for actual APIs. IDL may be greatly useful with Java.
Source code is available from here, and test cases will give you a sample usage.
> cabal install msgpack > cabal install msgpack-rpc
See hackageDB page (msgpack, msgpack-rpc) for details.
More details about design of MessagePack-RPC.
More details about design of MessagePack.
Articles and slides about the designs and comparisons.
MessagePack format specification.
MessagePack-RPC protocol specification.
Start MessagePack-RPC Interface Definition Language.
If you use MessagePack, please subscribe to the MessagePack mailing list. If you'd like to contribute to MessagePack, please subscribe to the MessagePack developers mailing list.
Many of the MessagePack developers and community members hang out in the #msgpack channel on irc.freenode.net. If you are new to IRC and don't have a client, you can use a web-based client.
Issues are managed on Redmine (Issues). Note that you need to create an account on the registration page to add issues.
Sources are located at github. Send pull requests to msgpack account.