Need help with kaylee?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

122 Stars 7 Forks MIT License 24 Commits 1 Opened issues


MapReduce with ZeroMQ

Services available


Need anything else?

Contributors list

# 10,382
15 commits


Kaylee is a small MapReduce implementation mostly meant as a proof of concept to illustrate the power of ZeroMQ and for education purpose

My goal was not to write a Hadoop clone but to build a starting point that one could use to learn about MapReduce.

The main bottleneck in this implementation is that the Shuffle phase requires all data to be moved back to the

instance which is not generally a good idea for performance. But this lets us a implement a simple shuffler using a Python defaultdict in just a few lines of code which is easy to understand.


MapReduce can be thought of on a high level as being a list homomorphism that can be written as a composition of two functions ( Reduce . Map ) . It is parallelizable because of the associativity of the of map and reduce operations.

MapReduce :: [(k1, v1)] -> [(k3, v3)]
MapReduce = Reduce .  Map

MapReduce :: a -> [(k3, v3)] MapReduce = reducefn . shuffle . mapfn . datafn

The implementation provides two functions split ( datafn ) and shuffle.

shuffle :: [ (k2, v2) ] -> [(k2, [v2])]

The user provides map and reduce.

map :: (k1,v1) -> [ (k2, v2) ]
reduce :: (k2, [v2]) -> [ (k3, v3) ]


Install ZeroMQ:

For Arch Linux

$ pacman -S zeromq

For Ubuntu Linux

$ add-apt-repository ppa:chris-lea/zeromq
$ apt-get update
$ apt-get install zeromq-bin libzmq-dev libzmq0

For Macintosh:

$ brew install zeromq

Build your virtualenv:

$ cd kaylee
$ virtualenv --no-site-packages env
$ source env/bin/activative

Install necessary packages:

$ pip install -r requirements.txt 


Let's do the 'hello world' of Map-Reduce, taking a large corpus and counting the occurrences of words in parallel.

Grab a large dataset (Moby Dick):

$ wget
$ mv pg2701.txt mobydick.txt

Run server:

$ python

Run worker(s):

$ python -m kaylee.client


>>> from kaylee import Client
>>> c = Client()
>>> c.connect()
>>> c.start()


Released under a MIT License. Do with it what you please.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.