A fast MessagePack RPC library
Project description
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Description: mprpc
=====
.. image:: https://badge.fury.io/py/mprpc.png
:target: http://badge.fury.io/py/mprpc
.. image:: https://travis-ci.org/studio-ousia/mprpc.png?branch=master
:target: https://travis-ci.org/studio-ousia/mprpc
mprpc is a lightweight `MessagePack RPC <https://github.com/msgpack-rpc/msgpack-rpc>`_ library. It enables you to easily build a distributed server-side system by writing a small amount of code. It is built on top of `gevent <http://www.gevent.org/>`_ and `MessagePack <http://msgpack.org/>`_.
Installation
------------
To install mprpc, simply:
.. code-block:: bash
$ pip install mprpc
Alternatively,
.. code-block:: bash
$ easy_install mprpc
Examples
--------
RPC server
^^^^^^^^^^
.. code-block:: python
from gevent.server import StreamServer
from mprpc import RPCServer
class SumServer(RPCServer):
def sum(self, x, y):
return x + y
server = StreamServer(('127.0.0.1', 6000), SumServer())
server.serve_forever()
RPC client
^^^^^^^^^^
.. code-block:: python
from mprpc import RPCClient
client = RPCClient('127.0.0.1', 6000)
print client.call('sum', 1, 2)
RPC client with connection pooling
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
import gsocketpool.pool
from mprpc import RPCPoolClient
client_pool = gsocketpool.pool.Pool(RPCPoolClient, dict(host='127.0.0.1', port=6000))
with client_pool.connection() as client:
print client.call('sum', 1, 2)
Performance
-----------
mprpc significantly outperforms the `official MessagePack RPC <https://github.com/msgpack-rpc/msgpack-rpc-python>`_ (**1.8x** faster), which is built using `Facebook's Tornado <http://www.tornadoweb.org/en/stable/>`_ and `MessagePack <http://msgpack.org/>`_, and `ZeroRPC <http://zerorpc.dotcloud.com/>`_ (**14x** faster), which is built using `ZeroMQ <http://zeromq.org/>`_ and `MessagePack <http://msgpack.org/>`_.
Results
^^^^^^^
.. image:: https://raw.github.com/studio-ousia/mprpc/master/docs/img/perf.png
:width: 550px
:height: 150px
:alt: Performance Comparison
mprpc
~~~~~
.. code-block:: bash
% python benchmarks/benchmark.py
call: 9508 qps
call_using_connection_pool: 10172 qps
Official MesssagePack RPC
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: bash
% pip install msgpack-rpc-python
% python benchmarks/benchmark_msgpackrpc_official.py
call: 4976 qps
ZeroRPC
~~~~~~~
.. code-block:: bash
% pip install zerorpc
% python benchmarks/benchmark_zerorpc.py
call: 655 qps
Documentation
-------------
Documentation is available at http://mprpc.readthedocs.org/.
Keywords: rpc,msgpack,messagepack,msgpackrpc,messagepackrpc,messagepack rpc,gevent
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Description: mprpc
=====
.. image:: https://badge.fury.io/py/mprpc.png
:target: http://badge.fury.io/py/mprpc
.. image:: https://travis-ci.org/studio-ousia/mprpc.png?branch=master
:target: https://travis-ci.org/studio-ousia/mprpc
mprpc is a lightweight `MessagePack RPC <https://github.com/msgpack-rpc/msgpack-rpc>`_ library. It enables you to easily build a distributed server-side system by writing a small amount of code. It is built on top of `gevent <http://www.gevent.org/>`_ and `MessagePack <http://msgpack.org/>`_.
Installation
------------
To install mprpc, simply:
.. code-block:: bash
$ pip install mprpc
Alternatively,
.. code-block:: bash
$ easy_install mprpc
Examples
--------
RPC server
^^^^^^^^^^
.. code-block:: python
from gevent.server import StreamServer
from mprpc import RPCServer
class SumServer(RPCServer):
def sum(self, x, y):
return x + y
server = StreamServer(('127.0.0.1', 6000), SumServer())
server.serve_forever()
RPC client
^^^^^^^^^^
.. code-block:: python
from mprpc import RPCClient
client = RPCClient('127.0.0.1', 6000)
print client.call('sum', 1, 2)
RPC client with connection pooling
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
import gsocketpool.pool
from mprpc import RPCPoolClient
client_pool = gsocketpool.pool.Pool(RPCPoolClient, dict(host='127.0.0.1', port=6000))
with client_pool.connection() as client:
print client.call('sum', 1, 2)
Performance
-----------
mprpc significantly outperforms the `official MessagePack RPC <https://github.com/msgpack-rpc/msgpack-rpc-python>`_ (**1.8x** faster), which is built using `Facebook's Tornado <http://www.tornadoweb.org/en/stable/>`_ and `MessagePack <http://msgpack.org/>`_, and `ZeroRPC <http://zerorpc.dotcloud.com/>`_ (**14x** faster), which is built using `ZeroMQ <http://zeromq.org/>`_ and `MessagePack <http://msgpack.org/>`_.
Results
^^^^^^^
.. image:: https://raw.github.com/studio-ousia/mprpc/master/docs/img/perf.png
:width: 550px
:height: 150px
:alt: Performance Comparison
mprpc
~~~~~
.. code-block:: bash
% python benchmarks/benchmark.py
call: 9508 qps
call_using_connection_pool: 10172 qps
Official MesssagePack RPC
~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: bash
% pip install msgpack-rpc-python
% python benchmarks/benchmark_msgpackrpc_official.py
call: 4976 qps
ZeroRPC
~~~~~~~
.. code-block:: bash
% pip install zerorpc
% python benchmarks/benchmark_zerorpc.py
call: 655 qps
Documentation
-------------
Documentation is available at http://mprpc.readthedocs.org/.
Keywords: rpc,msgpack,messagepack,msgpackrpc,messagepackrpc,messagepack rpc,gevent
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mprpc-0.1.17.tar.gz
(116.0 kB
view details)
File details
Details for the file mprpc-0.1.17.tar.gz
.
File metadata
- Download URL: mprpc-0.1.17.tar.gz
- Upload date:
- Size: 116.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3589fd127482e291b1ec314d6f0e55cc13311c12932ace356d6178ea1ca28f6a |
|
MD5 | 8d97961051422f3de315613434982d3b |
|
BLAKE2b-256 | 08dd87e7e3290c00e28423e46b483d288f13ddcc88bf71fd0677b619bdee32d3 |