simple thrift queue

Toy in-memory queue server using Facebook's Thrift protocol/RPC generator

19
0
Python

simple-thrift-queue

Phillip Pearson
http://www.myelin.co.nz/post/2008/8/4/#200808043

This is a toy in-memory (very much non-durable) queue, with a client
and server in Python and a server in C++ – the results of an
evening’s hacking with Facebook’s Thrift protocol/RPC generator.

On my laptop it handles about 4000 RPCs per second, i.e. if you have
one producer and three consumers, the producer can push about 2000
messages per second, which are fairly evenly spread across the
consumers.

The throughput is almost identical with the C++ server. ‘top’ reports
~80% system time and ‘iftop’ reports ~300kB/s traffic.

Requirements

  • Thrift
  • Python

Building and running

cd src
make
python py/server.py
python py/timer.py
python py/consumer.py
python py/producer.py

Try starting the server and a few consumers, then a producer.

C++ server

cd src/cpp
make run