Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
bugs in redirector
Browse files Browse the repository at this point in the history
n # Please enter the commit message for your changes. Lines starting
  • Loading branch information
John Bresnahan authored and BuzzTroll committed Oct 19, 2010
1 parent 749329f commit 627aaac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions cumulus/cb/pycb/cbRedirector.py
Expand Up @@ -28,15 +28,14 @@ def end_connection(self, request):
class cbBasicRedirector(object): class cbBasicRedirector(object):


def __init__(self, parser): def __init__(self, parser):
self.max = max_connections
self.connection_count = 0 self.connection_count = 0
self.host_file = parser.get("load_balanced", "hostfile") self.host_file = parser.get("load_balanced", "hostfile")
self.max = int(parser.get("load_balanced", "max")) self.max = int(parser.get("load_balanced", "max"))


def new_connection(self, request): def new_connection(self, request):
h = None h = None
self.connection_count = self.connection_count + 1 self.connection_count = self.connection_count + 1
if g_connection_count >= self.max: if self.connection_count >= self.max:
h = self.get_next_host() h = self.get_next_host()
return h return h


Expand Down
20 changes: 10 additions & 10 deletions cumulus/perf/scale1.py
Expand Up @@ -20,7 +20,7 @@
g_lock = threading.Lock() g_lock = threading.Lock()
g_ctr = 0 g_ctr = 0
g_bucket = "ScaleTest" g_bucket = "ScaleTest"
g_key_name = "tst" g_key_name = "100MB"
g_times = [] g_times = []
g_hostname = "c1.uc.futuregrid.org" g_hostname = "c1.uc.futuregrid.org"
g_port = 8888 g_port = 8888
Expand Down Expand Up @@ -56,7 +56,7 @@ def time_upload(file):
try: try:
my_char = threading.current_thread().getName() my_char = threading.current_thread().getName()
start_tm = datetime.now() start_tm = datetime.now()
key = upload_file(file) key = upload_file(file+"."+my_char)
end_tm = datetime.now() end_tm = datetime.now()


delt = end_tm - start_tm delt = end_tm - start_tm
Expand All @@ -79,13 +79,11 @@ def main():


its = int(sys.argv[1]) its = int(sys.argv[1])
file = sys.argv[2] file = sys.argv[2]
size = os.path.getsize(file)
print "file %s of %d bytes" % (file, size)


start_tm = datetime.now() start_tm = datetime.now()


t_a = [] t_a = []
char = "abcdefghijklmnopqrstuvvxyz" char = "abcdefghijklmnopqrstuvvxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(0, its): for i in range(0, its):
t = threading.Thread(target=time_upload, args=(file,), name=char[i%len(char)]) t = threading.Thread(target=time_upload, args=(file,), name=char[i%len(char)])
t_a.append(t) t_a.append(t)
Expand All @@ -105,11 +103,11 @@ def main():
conn = cb_get_conn(g_hostname, g_port) conn = cb_get_conn(g_hostname, g_port)
bucket = conn.get_bucket(g_bucket) bucket = conn.get_bucket(g_bucket)
rs = bucket.list() rs = bucket.list()
for k in rs: # for k in rs:
try: # try:
k.delete() # k.delete()
except: # except:
pass # pass


max = -1.0 max = -1.0
min = 99999999.0 min = 99999999.0
Expand All @@ -119,6 +117,8 @@ def main():
if tm < min: if tm < min:
min = tm min = tm


size = os.path.getsize(file)
print "file %s of %d bytes" % (file, size)
sizeMB = size * 1024*1024 sizeMB = size * 1024*1024
total_bytes = size * its total_bytes = size * its
total_bw = float(total_bytes) / float(tm) total_bw = float(total_bytes) / float(tm)
Expand Down

0 comments on commit 627aaac

Please sign in to comment.