Skip to main content

A fast RPC library based on asyncio and MessagePack

Project description

aiorpc is a lightweight asynchronous 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 asyncio and MessagePack.

Note aiorpc is under development, should not be considered to have a stable API.


To install aiorpc, simply:

$ pip install aiorpc


RPC server

from aiorpc import RPCServer

import asyncio
import uvloop

def echo(msg):
    return msg

rpc_server = RPCServer()
loop = uvloop.new_event_loop()
rpc_server.register("echo", echo)
coro = asyncio.start_server(rpc_server.serve, '', 6000, loop=loop)
server = loop.run_until_complete(coro)

except KeyboardInterrupt:

RPC client

from aiorpc import RPCClient

import asyncio
import uvloop

async def do(cli):
    ret = await'echo', 'message')

loop = uvloop.new_event_loop()
client = RPCClient('', 6000)

aiorpc client can also be used as an async context manager:

async def do():
    async with RPCClient('', 6000) as client:
        ret = await'echo', 'message')


aiorpc with uvloop significantly outperforms ZeroRPC (6x faster), which is built using ZeroMQ and MessagePack and slightly underperforms official MessagePack RPC (0.7x slower), which is built using Facebook’s Tornado and MessagePack.

  • aiorpc
% python benchmarks/
call: 2236 qps
  • Official MesssagePack RPC
% pip install msgpack-rpc-python
% python benchmarks/
call: 3112 qps
  • ZeroRPC
% pip install zerorpc
% python benchmarks/
call: 351 qps


Documentation is available at

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for aiorpc, version 0.1.7
Filename, size File type Python version Upload date Hashes
Filename, size aiorpc-0.1.7-py3-none-any.whl (10.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aiorpc-0.1.7.tar.gz (7.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page