@@ -0,0 +1,2231 @@
+import collections%0Aimport datetime%0Aimport httplib%0Aimport random%0Aimport threading%0A%0ASERVER = 'localhost:5000'%0AHalt = False%0A%0A# Totally not threadsafe...%0Acounters = collections.defaultdict(int)%0A%0Aclass ClientBase(threading.Thread):%0A    def __init__(self):%0A        self.conn = httplib.HTTPConnection(SERVER)%0A        self.counter = 0%0A        threading.Thread.__init__(self)%0A%0A    def run(self):%0A        while not Halt:%0A            self.act()%0A            self.counter += 1%0A%0A    def act(self):%0A        raise NotImplementedError%0A%0Aclass Producer(ClientBase):%0A    def act(self):%0A        self.conn.request('POST', '/queue/foo/',%0A                          body='%7B%22do%22:%22something%22%7D',%0A                          headers=%7B'content-type': 'application/json',%0A                                   'x-httpqueue-priority': datetime.datetime.utcnow().isoformat(),%0A                                   %7D)%0A        resp = self.conn.getresponse()%0A        if resp.status not in (200, 204):%0A            print %22%25s failed with %25s%22 %25 (type(self).__name__, resp.status)%0A        else:%0A            counters%5B'produced'%5D += 1%0A%0Aclass Consumer(ClientBase):%0A    def act(self):%0A        self.conn.request('GET', '/queue/foo/')%0A        resp = self.conn.getresponse()%0A        id = resp.getheader('x-httpqueue-id')%0A        if resp.status in (200, 204):%0A            counters%5B'consumed'%5D += 1%0A        else:%0A            print %22%25s failed with %25s%22 %25 (type(self).__name__, resp.status)%0A            return%0A%0A        self.conn.request('DELETE', '/queue/foo/', headers=%7B'x-httpqueue-id':id%7D)%0A        resp = self.conn.getresponse()%0A        if resp.status in (200, 204):%0A            counters%5B'acked'%5D += 1%0A        else:%0A            print %22%25s failed with %25s%22 %25 (type(self).__name__, resp.status)%0A%0Astart = datetime.datetime.now()%0Aactors = set()%0Afor i in range(5):%0A    a = Producer()%0A    actors.add(a)%0A    a.start()%0A%0Afor i in range(10):%0A    a = Consumer()%0A    actors.add(a)%0A    a.start()%0A%0Atry:%0A    while True:%0A        pass%0Aexcept KeyboardInterrupt:%0A    Halt = True%0A%0Afor a in actors:%0A    a.join()%0A%0Aperiod = datetime.datetime.now() - start%0A%0Aprint '%5CnSpent %25s; %25s seconds' %25 (period, period.seconds)%0Afor k, v in counters.items():%0A    print '%25s = %25s; %25s per second' %25 (k, v, v/float(period.seconds))%0A

Add a benchmark script