[three]Bean

Live visualization of fedmsg activity

Mar 04, 2013 | categories: python, fedmsg, zeromq, fedora, gource View Comments

Another crazy idea -- piping ØMQ into gource!

If you have problems with the video, you can download it directly here in ogg or webm.

As before, I used gravatar.com to grab the avatar images, using the FAS_USERNAME@fedoraproject.org formula.

Props to decause for the idea.

View Comments

Fedmsg Reliability -- No More Dropped Messages?

Feb 28, 2013 | categories: fedmsg, zeromq, fedora View Comments

Quick Timeline:

  • February, 2012 - I started thinking about fedmsg.
  • March, 2012 - Development gets under way.
  • July, 2012 - Stuff gets working in staging.
  • August-September, 2012 - The first messages hit production. We notice that some messages are getting dropped. We chalk it up to programming/configuration oversights. We are correct about that in some cases.
  • October-November, 2012 - Some messages are still getting dropped. Theory develops that it is due to zeromq2's lack of TCP_KEEPALIVE. It takes time to package zeromq3 and test this, integrate it with Twisted bindings, and deploy. More message sources come online during this period. Other stuff like externally consuming messages [1] [2], datanommer [3] [4], and identica [5] happen too.
  • January, 2013 - I enabled the TCP_KEEPALIVE bits in production at FUDCon Lawrence.

I haven't noticed any dropped messages since then: a marked improvement. However, our volume of messages is so much higher now that it is difficult to eyeball. If you notice dropped messages, please let me know in #fedora-apps on freenode.

View Comments

Ømq and fedmsg DIY

Nov 16, 2012 | categories: python, fedmsg, zeromq, fedora View Comments

Bill Peck wanted to know if he could consume messages from the Fedora Infrastructure message bus without using the fedmsg libs and stack. The answer is yes.

I wrote up an example for him and turns out it was pretty simple, simple enough to warrant being added as its own new section in the docs.

The downshot here is that you don't get the configuration helpers of fedmsg.config, the message manipulation helpers of fedmsg.text and most importantly, the message validation of fedmsg.crypto. The upshot is that you get a quick connection without all those dependencies:

#!/usr/bin/env python
""" You'll need to install python-zmq (pyzmq) for this one.. """

import json
import pprint
import zmq


def listen_and_print():
    # You can listen to stg at "tcp://stg.fedoraproject.org:9940"
    endpoint = "tcp://hub.fedoraproject.org:9940"
    # Set this to something like org.fedoraproject.prod.compose
    topic = 'org.fedoraproject.prod.'

    ctx = zmq.Context()
    s = ctx.socket(zmq.SUB)
    s.connect(endpoint)

    s.setsockopt(zmq.SUBSCRIBE, topic)

    poller = zmq.Poller()
    poller.register(s, zmq.POLLIN)

    while True:
        evts = poller.poll()  # This blocks until a message arrives
        topic, msg = s.recv_multipart()
        print topic, pprint.pformat(json.loads(msg))

if __name__ == "__main__":
    listen_and_print()

p.s., in other news Amit Saha has a post up on collecting stats from the fedmsg bus. This is exciting to me.

View Comments

Fuzzing zeromq

Sep 18, 2012 | categories: python, zeromq, fedora View Comments

So, my project for Fedora Infrastructure (fedmsg) connects around with zeromq. Way back in the Spring of this year, skvidal suggested that I "fuzz" it and see what happens, "fuzz" meaning try to cram random bits down its tubes.

I have a little pair of python scripts that I carry around in my ~/scratch/ dir to debug various zeromq situations. One of the scripts is topics_pub.py; it binds to an endpoint and publishes messages on topics. The other is topics_sub.py which connects to an endpoint and prints messages it receives to stdout.

To fuzz the subscriber, I had it connect to a garbage source built with /dev/random and netcat. In one terminal, I ran:

$ cat /dev/random | nc -l 3005

and in the other, I ran:

$ python topics_sub.py "tcp://*:3005"

... and nothing happened.

To fuzz the publisher, I hooked /dev/random up to telnet:

$ python topics_pub.py "tcp://127.0.0.1:3005"
$ cat /dev/random | telnet 127.0.0.1 3005

... and it didn't fall over. Encouraging.

View Comments

Scheduling meetings for the Fedora Messaging SIG

Mar 05, 2012 | categories: zeromq, fedmsg, fedora, moksha View Comments

So I'm spinning up the Fedora Messaging SIG. It's been sitting idle for years; this time we're really going to do it. We're going to put 0mq messaging hooks into bodhi, koji, pkgdb, fas, you name it.

I'm building a python module called fedmsg to wrap it all and it comes with a proposal-in-development. And if you're not excited yet, we've already 0mq enabled the Moksha Hub and achieved a ~100 times speedup over AMQP/qpid.

The point of this post is to ask about times for an IRC meeting of the Messaging SIG. Right now I'm thinking Tuesdays at 16:00-17:00 UTC in #fedora-meeting. If you're interested in helping with the effort but that's a bad time for you, let me know and we'll work it out.

I'll be out at PyCon until next Wednesday; so the first meeting won't be until March 20th at the earliest.


http://threebean.org/blog/static/images/0mq-enable-all-the-things.jpg
View Comments