Skip to content

msgpack-rpc/msgpack-rpc-python

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
August 3, 2015 14:40
March 31, 2012 03:48
November 25, 2012 03:41
January 9, 2015 03:21

MessagePack RPC for Python

MessagePack RPC implementation based on Tornado.

Installation

% pip install msgpack-rpc-python

or

% python setup.py install

Module dependency

  • msgpack-python (>= 0.3)
  • tornado (>= 3)

Example

Server

import msgpackrpc

class SumServer(object):
    def sum(self, x, y):
        return x + y

server = msgpackrpc.Server(SumServer())
server.listen(msgpackrpc.Address("localhost", 18800))
server.start()

Client

import msgpackrpc

client = msgpackrpc.Client(msgpackrpc.Address("localhost", 18800))
result = client.call('sum', 1, 2)  # = > 3

Run test

In test directory:

% PYTHONPATH=../ python test/test_msgpackrpc.py

Run with timeout test(Timeout test takes about 5 seconds)

% PYTHONPATH=../ python test/test_msgpackrpc.py --timeout-test

Performance

OS: Mac OS X ver 10.8.3
CPU: Intel Core i7 2.7 GHz
Memory: 16 GB 1600 MHz DDR3

call(QPS)async(QPS)notify(QPS)
2.7.35903604024877
3.3.05493581223634
PyPy 1.9.0 with GCC 4.2.15519972946406

Test code are available in example directory(bench_client.py and bench_server.py).

TODO

  • Add advanced return to Server.
  • UDP, UNIX Domain support
  • Utilities (MultiFuture, SessionPool)

Copyright

AuthorMasahiro Nakagawa
CopyrightCopyright (c) 2011- Masahiro Nakagawa
LicenseApache License, Version 2.0

About

MessagePack RPC implementation for Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages