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.

Change-Id: I64647c5d613a0794f0807886a4833cd5c31c0c5e
This commit is contained in:
ning_zhang 2012-08-03 11:47:28 -07:00
parent 577185db28
commit b4aab01ddd
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)