mprpc Documentation Release Studio Ousia

Similar documents
picrawler Documentation

msgpack Documentation

maya-cmds-help Documentation

Concurrent Python. Cody Soyland Austin Web Python User Group - Feb 28, Thursday, February 28, 13

streamio Documentation

tolerance Documentation

prompt Documentation Release Stefan Fischer

txzmq Documentation Release Andrey Smirnov

cursesmenu Documentation

RawSocketPy Documentation

bottle-rest Release 0.5.0

django-redis-cache Documentation

Django on Gevent. asynchronous i/o in a synchronous world. Tuesday, September 4, 12

Torndb Release 0.3 Aug 30, 2017

pescador Documentation

Queries Documentation

Tissu for Fabric Documentation

pymemcache Documentation

python-docker-machine Documentation

GridMap Documentation

Condoor Documentation

solrq Documentation Release Michał Jaworski

Gearthonic Documentation

Sherlock Documentation

Pizco Documentation. Release 0.1. Hernan E. Grecco

Wifiphisher Documentation

YouTube API Wrapper Documentation

Connexion Documentation

Django-Select2 Documentation. Nirupam Biswas

Python Utils Documentation

json2xls Documentation

WordEmbeddingLoader Documentation

MongoTor Documentation

Lazarus Documentation

edeposit.amqp.calibre Release 1.1.4

pydrill Documentation

PyZabbixObj Documentation

python-aspectlib Release 0.4.1

yardstick Documentation

petfinder-api Documentation

goose3 Documentation Release maintainers

lala Documentation Release 0.5.dev103+gfd01df0 Wieland Hoffmann

DevKitchen 2018 Python in Cinema 4D R20

1999 Stackless Python 2004 Greenlet 2006 Eventlet 2009 Gevent 0.x (libevent) 2011 Gevent 1.0dev (libev, c-ares)

bzz Documentation Release Rafael Floriano and Bernardo Heynemann

python-aspectlib Release 0.5.0

databuild Documentation

Release Manu Phatak

Scrapy-Redis Documentation

Flask-Twilio Documentation

NiFpga Example Documentation

Netmiko Documentation

obfuscator Documentation

FIQL Parser. Release 0.15

Facebook SDK for Python Documentation

pybtsync Documentation

tapi Documentation Release 0.1 Jimmy John

Piexif Documentation. Release 1.0.X. hmatoba

Kuyruk Documentation. Release 0. Cenk Altı

redis-lua Documentation

pymodbustcp Documentation

Python Utils Documentation

Netmiko Documentation

Release Clearcode < and associates (see AUTHORS)

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI

Facebook SDK for Python Documentation

Tornado-Babel Documentation

dota2api Documentation

spnav Documentation Release 0.9 Stanley Seibert

Piexif Documentation. Release 1.0.X. hmatoba

Release Ralph Offinger

gevent-tools Documentation

ØMQ and PyØMQ. Simple and Fast Messaging. Brian Granger SciPy 2010

pyatomiadns Documentation

ProxySQL Tools Documentation

Manticore Documentation

edeposit.amqp.antivirus Release 1.0.1

Threat Stack Python Client Documentation

Watson - Events. Release 1.0.3

doto Documentation Release 0.2 Benjamin Zaitlen

API Wrapper Documentation

django-subdomains Documentation

pysharedutils Documentation

Making Dynamic Instrumentation Great Again

PyCPUID Documentation

gpib-ctypes Documentation

optlang Documentation

University of Pittsburgh Computer Science Department

django-dynamic-db-router Documentation

transliteration Documentation

Quick housekeeping Last Two Homeworks Extra Credit for demoing project prototypes Reminder about Project Deadlines/specifics Class on April 12th Resul

APNs client Documentation

All Yarns Are Beautiful Documentation

BPMonline On-Site Setup Guide

Unicum Documentation. Release alpha. Deutsche Postbank AG

PyDREAM Documentation

python-hologram-api Documentation

Scout Documentation. Release Charles Leifer

Distributed Systems COMP 212. Lecture 8 Othon Michail

Facebook SDK for Python Documentation

Transcription:

mprpc Documentation Release 0.1.13 Studio Ousia Apr 05, 2017

Contents 1 Introduction 3 1.1 Installation................................................ 3 1.2 Examples................................................. 3 2 Performance 5 2.1 Results.................................................. 5 2.2 Environment............................................... 6 3 API Reference 7 4 Indices and tables 9 i

ii

mprpc Documentation, Release 0.1.13 mprpc is a lightweight MessagePack 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 and MessagePack. Contents: Contents 1

mprpc Documentation, Release 0.1.13 2 Contents

CHAPTER 1 Introduction Installation To install mprpc, simply: $ pip install mprpc Alternatively, $ easy_install mprpc Examples RPC server 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 from mprpc import RPCClient 3

mprpc Documentation, Release 0.1.13 client = RPCClient('127.0.0.1', 6000) print client.call('sum', 1, 2) RPC client with connection pooling using gsocketpool 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) 4 Chapter 1. Introduction

CHAPTER 2 Performance mprpc significantly outperforms the official MessagePack RPC (1.8x faster), which is built using Facebook s Tornado and MessagePack, and ZeroRPC (14x faster), which is built using ZeroMQ and MessagePack. Results mprpc % python benchmarks/benchmark.py call: 9508 qps call_using_connection_pool: 10172 qps Official MesssagePack RPC % pip install msgpack-rpc-python % python benchmarks/benchmark_msgpackrpc_official.py call: 4976 qps 5

mprpc Documentation, Release 0.1.13 ZeroRPC % pip install zerorpc % python benchmarks/benchmark_zerorpc.py call: 655 qps Environment OS: Mac OS X 10.8.5 CPU: Intel Core i7 2GHz Memory: 8GB Python: 2.7.3 6 Chapter 2. Performance

CHAPTER 3 API Reference class mprpc.rpcclient RPC client. Usage: >>> from mprpc import RPCClient >>> client = RPCClient('127.0.0.1', 6000) >>> print client.call('sum', 1, 2) 3 Parameters host (str) Hostname. port (int) Port number. timeout (int) (optional) Socket timeout. lazy (bool) (optional) If set to True, the socket connection is not established until you specifically call open() pack_encoding (str) (optional) Character encoding used to pack data using Messagepack. unpack_encoding (str) (optional) Character encoding used to unpack data using Messagepack. pack_params (dict) (optional) Parameters to pass to Messagepack Packer unpack_params (dict) (optional) Parameters to pass to Messagepack :param tcp_no_delay (optional) If set to True, use TCP_NODELAY. :param keep_alive (optional) If set to True, use socket keep alive. Unpacker call() Calls a RPC method. 7

mprpc Documentation, Release 0.1.13 Parameters close() Closes the connection. method (str) Method name. args Method arguments. getpeername() Return the address of the remote endpoint. is_connected() Returns whether the connection has already been established. Return type bool open() Opens a connection. class mprpc.rpcserver RPC server. This class is assumed to be used with gevent StreamServer. Usage: Parameters pack_encoding (str) (optional) Character encoding used to pack data using Messagepack. unpack_encoding (str) (optional) Character encoding used to unpack data using Messagepack pack_params (dict) (optional) Parameters to pass to Messagepack Packer unpack_params (dict) (optional) Parameters to pass to Messagepack Unpacker >>> from gevent.server import StreamServer >>> import mprpc >>> >>> class SumServer(mprpc.RPCServer):... def sum(self, x, y):... return x + y... >>> >>> server = StreamServer(('127.0.0.1', 6000), SumServer()) >>> server.serve_forever() 8 Chapter 3. API Reference

CHAPTER 4 Indices and tables genindex modindex search 9

mprpc Documentation, Release 0.1.13 10 Chapter 4. Indices and tables

Index C call() (mprpc.rpcclient method), 7 close() (mprpc.rpcclient method), 8 G getpeername() (mprpc.rpcclient method), 8 I is_connected() (mprpc.rpcclient method), 8 O open() (mprpc.rpcclient method), 8 R RPCClient (class in mprpc), 7 RPCServer (class in mprpc), 8 11