<div>I thought this might be of some interest to the zmq related IPython folks:</div><div><br></div>pyzmq has a basic multiple client-one kernel remote process example called 'kernel'. This morning, to explore zmq devices, I wrote a derived example that is multiple client - multiple kernel, and load balanced across kernels, and called it 'multikernel'. It took about an hour.<div>
<br></div><div>The code is trivial, and uses the zmq XREQ socket's round robin load balancing.</div><div>o The main addition is a relay process containing two zmq devices: a queue device for the XREQ/XREP connection, and a forwarder for PUB/SUB.</div>
<div>o kernel.py had to change a little, since two socket IDs are contained in each message instead of just one, and its sockets connect instead of bind.</div><div>o frontend.py and other code didn't have to change a letter.</div>
<div>o Exactly zero work is done in Python in the relay process after the creation of the <span class="Apple-style-span" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; ">Ø</span>MQ devices.</div>
<div><br></div><div>It does have some weird behavior, since even the tab-completion requests are load balanced, so if you have two kernels, and you do:</div><div>>>>a=5</div><div>>>>a='asdf'</div>
<div>>>>a.<tab></div><div>...</div><div>>>>a.<tab></div><div>...</div><div>each press of the tab key will produce different results - which is fun to watch, if not especially useful.</div><div>
<br></div><div>I even did a quick and dirty screencast to show 30 seconds of using it with 2 clients and 2 kernels.</div><div><a href="http://ptsg.berkeley.edu/~minrk/multikernel.m4v">http://ptsg.berkeley.edu/~minrk/multikernel.m4v</a></div>
<div><br></div><div><div>The example is pushed to my pyzmq fork on github, and depends on that fork for its implementation of <span class="Apple-style-span" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; ">Ø</span>MQ devices, not yet merged into Brian's trunk.</div>
<div><a href="http://github.com/minrk/pyzmq">http://github.com/minrk/pyzmq</a></div></div><div><br></div><meta charset="utf-8"><div><span class="Apple-style-span" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; ">Ø</span>MQ really is spiffy.</div>
<div>-MinRK</div>