diff options
author | ning_zhang <ning@zmanda.com> | 2012-08-03 11:47:28 -0700 |
---|---|---|
committer | ning_zhang <ning@zmanda.com> | 2012-08-03 11:47:28 -0700 |
commit | b4aab01ddd850343e1283c768b3e887e5df9cf17 (patch) | |
tree | bd0106fdc0cbe10638e6893530fe5486ce1c03dc | |
parent | 577185db28154c5fc3cb0e5e7e83f6942285aa10 (diff) | |
download | swift-bench-b4aab01ddd850343e1283c768b3e887e5df9cf17.tar.gz |
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
-rwxr-xr-x | bin/swift-bench | 2 | ||||
-rw-r--r-- | swift/common/bench.py | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/bin/swift-bench b/bin/swift-bench index 120f2a5..df0e404 100755 --- a/bin/swift-bench +++ b/bin/swift-bench @@ -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', diff --git a/swift/common/bench.py b/swift/common/bench.py index 097b6fd..6a0af88 100644 --- a/swift/common/bench.py +++ b/swift/common/bench.py @@ -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) |