@@ -0,0 +1,2144 @@
+#!/usr/bin/env python%0A%0Afrom pyon.net.endpoint import RPCClient%0A#from interface.services.idatastore_service import IDatastoreService%0Afrom interface.services.ihello_service import IHelloService%0Afrom pyon.net.messaging import make_node%0Aimport gevent%0Aimport time%0Aimport base64%0Aimport os%0Aimport argparse%0Aimport msgpack%0A%0Aparser = argparse.ArgumentParser()%0Aparser.add_argument('-d', '--datasize', type=int, help='Maximum size of data in bytes')%0Aparser.add_argument('-m', '--msgpack', action='store_true', help='Encode data with msgpack')%0Aparser.set_defaults(datasize=1024*1024, parallel=1)%0Aopts = parser.parse_args()%0A%0A%0Anode,iowat=make_node()%0A#dsclient = RPCClient(node=node, name=%22datastore%22, iface=IDatastoreService)%0Ahsclient = RPCClient(node=node, name=%22hello%22, iface=IHelloService)%0A%0Adef notif(*args, **kwargs):%0A    print %22GOT A BACKPRESSURE NOTICE%22, str(args), str(kwargs)%0A%0A#node.client.add_backpressure_callback(notif)%0A%0A# make data (bytes)%0ADATA_SIZE = opts.datasize%0A# base64 encoding wastes a lot of space, truncate it at the exact data size we requested%0Adata = base64.urlsafe_b64encode(os.urandom(DATA_SIZE))%5B:DATA_SIZE%5D%0Aif opts.msgpack:%0A    data = msgpack.dumps(data)%0A%0Acounter = 0%0Ast = 0%0A%0Adef tick():%0A    global counter, st%0A    while True:%0A        time.sleep(2)%0A        ct = time.time()%0A        elapsed_s = ct - st%0A        sc = sum(counter)%0A%0A        mps = sc / elapsed_s%0A%0A        print counter, sc, %22requests, per sec:%22, mps%0A%0Adef work(ds):%0A    curdata = data%5B:ds%5D%0A    global counter%0A    global st%0A    counter = 0%0A    st = time.time()%0A%0A    while counter %3C 1000:%0A        hsclient.noop(curdata)%0A        #hsclient.hello(str(counter%5Bwid%5D))%0A        counter += 1%0A%0A    et = time.time()%0A    return et - st%0A%0A#_gt = gevent.spawn(tick)%0A%0Aresults = %7B%7D%0A%0Afor size in %5B1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144%5D:%0A    _gl = gevent.spawn(work, size)%0A    try:%0A        rs = _gl.get(timeout=10)%0A    except gevent.Timeout:%0A        print %2210s elapsed, cutting it%22%0A        rs = time.time() - st%0A    results%5Bsize%5D = %7B %22elapsed%22: rs, %22count%22: counter, %22ps%22:counter/rs %7D%0A    print %22Size:%22, size, str(results%5Bsize%5D) %0A%0Aimport pprint%0Apprint.pprint(results)%0A%0A

Add more direct RPC size tests