Permalink
Browse files

adding the perf testing scripts to the repo

  • Loading branch information...
BuzzTroll
BuzzTroll committed Sep 10, 2010
1 parent 40d7d4d commit 7c3d9d0dd17ca33d79f61ac236702bc1753d4e1b
View
@@ -8,7 +8,7 @@ create table requests(
port INTEGER NOT NULL DEFAULT 2893,
state INTEGER DEFAULT 0,
message TEXT,
- entry_time DATETIME,
+ entry_time TIMESTAMP,
attempt_count INTEGER DEFAULT 0,
UNIQUE(hostname, port, dst_filename)
);
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+
+
+import sys
+import string
+import random
+import os
+import sys
+import sys
+import ConfigParser
+from ConfigParser import SafeConfigParser
+import time
+import tempfile
+import traceback
+import filecmp
+import logging
+import shlex
+from optparse import SUPPRESS_HELP
+import boto
+from boto.s3.connection import OrdinaryCallingFormat
+from boto.s3.connection import VHostCallingFormat
+from boto.s3.connection import SubdomainCallingFormat
+from boto.s3.connection import S3Connection
+from boto.ec2.connection import EC2Connection
+
+
+def main(argv=sys.argv[1:]):
+
+ host = argv[0]
+ imagename = argv[1]
+ count = int(argv[2])
+
+ print "setting up ec2 connection"
+ ec2conn = EC2Connection(s3id, pw, host=host, port=8444, debug=2)
+ ec2conn.host = host
+
+ print "getting a reference to the remote image"
+ image = ec2conn.get_image(imagename)
+ print "running %d instances" % (count)
+ res = image.run(min_count=count, max_count=count)
+ print "stoping all instances"
+ res.stop_all()
+
+ return 0
+
+if __name__ == "__main__":
+ rc = main()
+ sys.exit(rc)
+
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+histdir=`mktemp -d`
+cmd="/home/bresnaha/nimbus-cloud-client-016/bin/cloud-client.sh --name lenny-vm.raw --hours .1 --run --history-dir $histdir"
+$cmd
+rm -rf $histdir
+
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+tm_file=$1
+cnts="4 8 16 32 64"
+trials=4
+
+touch $tm_file
+for c in $cnts
+do
+ for i in `seq 1 $trials`
+ do
+ echo $i
+ /usr/bin/time --append -o $tm_file --format "$c %e" ./timer.sh $c
+ sleep 90
+ rm -rf /home/bresnaha/nimbus-cloud-client-016/history/*
+ sleep 90
+ done
+done
+
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+cmd="./cmd.sh"
+max=$1
+pid_list=""
+for i in `seq 1 $max`
+do
+ touch run.log
+ $cmd | tee -a run.log &
+ pid_list="$pid_list $!"
+done
+
+wait
+
@@ -14,7 +14,7 @@
def getrows(con):
c = con.cursor()
- tm = datetime.datetime.now() - datetime.timedelta(0, 5)
+ tm = datetime.datetime.now() - datetime.timedelta(0, 10)
s = "select distinct src_filename from requests where state = 0 and attempt_count < 3 and entry_time < ? order by entry_time limit 1"
data = (tm, )
c.execute(s, data)
@@ -26,19 +26,22 @@ def getrows(con):
# from the db. better to grab any that came in since the initial
# select
con.commit()
-
- s = "select max(entry_time) from requests where src_filename = ? and state = 0 and attempt_count < 3"
- data = (src_file, )
- done = False
- while not done:
- c.execute(s, data)
- row = c.fetchone()
- con.commit()
- td = datetime.datetime.now() - datetime.timedelta(0, 2)
- if row[0] < td:
- done = True
- else:
- time.sleep(0.1)
+ pylantorrent.log(logging.INFO, "selected rows with fname %s" % (src_file))
+
+ # need to find a way to determine that nothing new has been added for this
+ # file recently
+ #s = 'select max(entry_time) as "e [timestamp]" from requests where src_filename = ? and state = 0 and attempt_count < 3'
+ #data = (src_file, )
+ #done = False
+ #while not done:
+ # c.execute(s, data)
+ # row = c.fetchone()
+ # con.commit()
+ # td = datetime.datetime.now() - datetime.timedelta(0, 2)
+ # if row[0] < td:
+ # done = True
+ # else:
+ # time.sleep(0.1)
s = "select hostname,port,src_filename,dst_filename,rid from requests where src_filename = ? and state = 0 and attempt_count < 3 order by hostname,port"
data = (src_file, )
@@ -148,7 +151,7 @@ def main(argv=sys.argv[1:]):
con_str = pylantorrent.config.dbfile
now = datetime.datetime.now()
#con = sqlite3.connect(con_str, isolation_level="EXCLUSIVE")
- con = sqlite3.connect(con_str)
+ con = sqlite3.connect(con_str, detect_types=sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
done = False
while not done:

0 comments on commit 7c3d9d0

Please sign in to comment.