Skip to content

johnnewto/msgpack-rpc-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MessagePack RPC for Python with_tornado_453

MessagePack RPC implementation based on Tornado 453 builtin for use with if Jupyter is installed . This may not be the best solution, but for me it solves the issue. Can now use jupyterlab and notebook together with msgpack-rpc-python. The example works. It is hard to interrupt the server side tho...

forked from https://github.com/xaedes/msgpack-rpc-python/tree/with_tornado_453

To use it, just clone it and checkout the branch with_tornado_453. Remove any existing installation of msgpack-rpc-python: pip uninstall msgpack-rpc-python

Install msgpack-rpc-python with integrated tornado from the local directory in which you cloned my fork, for example when you are currently in this directory: pip install .

Installation

pip uninstall msgpack-rpc-python
pip install git+https://github.com/johnnewto/msgpack-rpc-python.git@with_tornado_453

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 Python with with_tornado_453

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%