Merge "To simulate the real workloads, the objects to be uploaded could be created in the random sizes, which are bounded (lower_object_size and upper_object_size) by the user inputs."

This commit is contained in:
Jenkins 2012-08-17 23:47:32 +00:00 committed by Gerrit Code Review
commit ba9158886e
2 changed files with 7 additions and 0 deletions

View File

@ -35,6 +35,8 @@ CONF_DEFAULTS = {
'del_concurrency': '10',
'concurrency': '',
'object_size': '1',
'lower_object_size': '10',
'upper_object_size': '10',
'num_objects': '1000',
'num_gets': '10000',
'delete': 'yes',

View File

@ -66,6 +66,8 @@ class Bench(object):
self.object_size = int(conf.object_size)
self.object_sources = conf.object_sources
self.lower_object_size = int(conf.lower_object_size)
self.upper_object_size = int(conf.upper_object_size)
self.files = []
if self.object_sources:
self.object_sources = self.object_sources.split()
@ -228,6 +230,9 @@ class BenchPUT(Bench):
name = uuid.uuid4().hex
if self.object_sources:
source = random.choice(self.files)
elif self.upper_object_size > self.lower_object_size:
source = '0' * random.randint(self.lower_object_size,
self.upper_object_size)
else:
source = '0' * self.object_size
device = random.choice(self.devices)