Browse files

concur ping pong test

  • Loading branch information...
1 parent 8abcd39 commit 5586c789d5378a24cf79061167d1f73cd7c3cdd2 @buzztroll buzztroll committed Dec 20, 2011
Showing with 69 additions and 9 deletions.
  1. +10 −8 scale_scripts/concur_pingpong.py
  2. +2 −1 scale_scripts/ping.yml
  3. +57 −0 scale_scripts/run_concur_pingpong.sh
View
18 scale_scripts/concur_pingpong.py
@@ -6,7 +6,7 @@
import datetime
import simplejson as json
-class DashiScalePonger(object):
+class DashiConcurScalePonger(object):
def __init__(self, CFG):
self.CFG = CFG
@@ -16,6 +16,7 @@ def __init__(self, CFG):
self.dashi.handle(self.final_msg, "final_msg")
def ping(self, from_name=None):
+ print "ponging to %s" % (from_name)
self.dashi.fire(from_name, "pong")
def final_msg(self):
@@ -31,11 +32,11 @@ def go(self):
pass
-class DashiScalePinger(Thread):
+class DashiConcurScalePinger(Thread):
def __init__(self, CFG, cnt):
Thread.__init__(self)
- self._myname = self.CFG.test.pinger_name + "_" + str(cnt)
+ self._myname = CFG.test.pinger_name + "_" + str(cnt)
self.CFG = CFG
self.dashi = bootstrap.dashi_connect(self._myname, CFG)
self.done = False
@@ -50,13 +51,13 @@ def run(self):
def go(self):
self.timer.start()
- print "sending first ping"
+ print "sending first ping to %s" % (self.CFG.test.ponger_name)
+ self.dashi.fire(self.CFG.test.ponger_name, "ping", from_name=self._myname)
while not self.done:
try:
- self.dashi.fire(self.CFG.test.ponger_name, "ping")
+ self.dashi.consume(count=1, timeout=10)
except socket.timeout, ex:
pass
- print "sending final message"
def timeout(self):
self.end_time = datetime.datetime.now()
@@ -72,10 +73,11 @@ def main(argv):
if CFG.test.type == "ping":
sender_count = int(CFG.test.concur)
+ print "sender count %d" % (sender_count)
thrs = []
start_time = datetime.datetime.now()
for i in range(0, sender_count):
- sender = DashiScalePinger(CFG)
+ sender = DashiConcurScalePinger(CFG, i)
thrs.append(sender)
sender.start()
@@ -96,7 +98,7 @@ def main(argv):
res['process_type'] = "pinger"
print "JSON: %s" % (json.dumps(res))
else:
- receiver = DashiScalePonger(CFG)
+ receiver = DashiConcurScalePonger(CFG)
receiver.go()
View
3 scale_scripts/ping.yml
@@ -14,9 +14,10 @@ loggers:
level: WARN
test:
+ concur: 64
name: ping
pinger_name: ping
ponger_name: pong
consume_timeout: 5
consume_count: 1
- runtime: 15
+ runtime: 60
View
57 scale_scripts/run_concur_pingpong.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+pinger_host=$1
+ponger_host=$2
+amqp_host=$3
+
+exchange=`uuidgen`
+
+out_dir="concur_pingpong".`date +%s`
+mkdir $out_dir
+out_file=$out_dir/pingpong.data
+l_conf_file=`pwd`/ping.yml
+r_conf_file=/tmp/conf.yml
+py=/home/bresnaha/DASHITESTS/bin/python
+
+l_pgm_file=`pwd`/concur_pingpong.py
+r_pgm_file=/tmp/concur_pingpong.py
+
+scp $l_conf_file $pinger_host:$r_conf_file
+scp $l_conf_file $ponger_host:$r_conf_file
+
+scp $l_pgm_file $pinger_host:$r_pgm_file
+scp $l_pgm_file $ponger_host:$r_pgm_file
+
+trials=1
+
+touch $out_file
+date >> $out_file
+
+for i in `seq $trials`
+do
+ echo "running: $i"
+
+ cpu_file=$out_file.pong.$i
+ ssh $ponger_host top -b -d 1 > $cpu_file&
+ kill_pid1=$!
+ cpu_file=$out_file.$i.$cnt.$sz.sendcpu
+ ssh $pinger_host top -b -d 1 > $cpu_file&
+ kill_pid2=$!
+
+ cmd_line_args="--server.amqp.host=$amqp_host --dashi.exchange=$exchange"
+
+ ssh $ponger_host $py $r_pgm_file --test.type=pong $cmd_line_args $r_conf_file &
+ recv_pid=$!
+ sleep 2
+ ssh $pinger_host $py $r_pgm_file --test.type=ping $cmd_line_args $r_conf_file | tee $out_file
+
+ echo "pinger finished, waiting for ponger"
+ kill $recv_pid
+ echo "ponger finished"
+ kill $kill_pid1
+ kill $kill_pid2
+ echo "kill sent, wiating"
+ wait
+ sleep 2
+
+done

0 comments on commit 5586c78

Please sign in to comment.