mirror of
https://github.com/ceph/s3-tests.git
synced 2024-12-25 23:43:50 +00:00
Log readwrite test results in yaml.
This temporarily removes the statistics calculation; that belongs somewhere else anyway, so it can be run on aggregated results etc.
This commit is contained in:
parent
ed966af0a7
commit
648ddbb761
1 changed files with 23 additions and 85 deletions
|
@ -5,48 +5,16 @@ import gevent.pool
|
||||||
import gevent.queue
|
import gevent.queue
|
||||||
import gevent.monkey; gevent.monkey.patch_all()
|
import gevent.monkey; gevent.monkey.patch_all()
|
||||||
import optparse
|
import optparse
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
import yaml
|
||||||
|
|
||||||
import generate_objects
|
import generate_objects
|
||||||
import realistic
|
import realistic
|
||||||
import common
|
import common
|
||||||
|
|
||||||
class Result:
|
NANOSECOND = int(1e9)
|
||||||
TYPE_NONE = 0
|
|
||||||
TYPE_READER = 1
|
|
||||||
TYPE_WRITER = 2
|
|
||||||
|
|
||||||
def __init__(self, name, type=TYPE_NONE, time=0, success=True, size=0, details=''):
|
|
||||||
self.name = name
|
|
||||||
self.type = type
|
|
||||||
self.time = time
|
|
||||||
self.success = success
|
|
||||||
self.size = size
|
|
||||||
self.details = details
|
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
type_dict = {Result.TYPE_NONE: 'None', Result.TYPE_READER: 'Reader', Result.TYPE_WRITER: 'Writer'}
|
|
||||||
type_s = type_dict[self.type]
|
|
||||||
if self.success:
|
|
||||||
status = 'Success'
|
|
||||||
else:
|
|
||||||
status = 'FAILURE'
|
|
||||||
|
|
||||||
if (self.time == 0):
|
|
||||||
mbps = '?'
|
|
||||||
else:
|
|
||||||
mbps = self.size / self.time / 1024.0
|
|
||||||
|
|
||||||
return "<Result: [{success}] {type}{name} -- {size} KB in {time}s = {mbps} MB/s {details}>".format(
|
|
||||||
success=status,
|
|
||||||
type=type_s,
|
|
||||||
name=self.name,
|
|
||||||
size=self.size,
|
|
||||||
time=self.time,
|
|
||||||
mbps=mbps,
|
|
||||||
details=self.details,
|
|
||||||
)
|
|
||||||
|
|
||||||
def reader(bucket, name, queue):
|
def reader(bucket, name, queue):
|
||||||
while True:
|
while True:
|
||||||
|
@ -58,12 +26,15 @@ def reader(bucket, name, queue):
|
||||||
end = time.time()
|
end = time.time()
|
||||||
elapsed = end - start
|
elapsed = end - start
|
||||||
queue.put(
|
queue.put(
|
||||||
Result(
|
dict(
|
||||||
name,
|
type='r',
|
||||||
type=Result.TYPE_READER,
|
bucket=bucket.name,
|
||||||
time=elapsed,
|
key=key.name,
|
||||||
success=fp.valid(),
|
#TODO chunks
|
||||||
size=fp.size / 1024,
|
start=start,
|
||||||
|
duration=int(round(elapsed * NANOSECOND)),
|
||||||
|
#TODO error, fp.valid()
|
||||||
|
#TODO name
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
count += 1
|
count += 1
|
||||||
|
@ -89,12 +60,17 @@ def writer(bucket, name, queue, quantity=1, file_size=1, file_stddev=0, file_nam
|
||||||
end = time.time()
|
end = time.time()
|
||||||
elapsed = end - start
|
elapsed = end - start
|
||||||
|
|
||||||
queue.put(Result(name,
|
queue.put(
|
||||||
type=Result.TYPE_WRITER,
|
dict(
|
||||||
time=elapsed,
|
type='w',
|
||||||
size=sum(f.size/1024 for f in files),
|
bucket=bucket.name,
|
||||||
|
#TODO this current combines stats for multiple files? key=key.name,
|
||||||
|
#TODO chunks
|
||||||
|
start=start,
|
||||||
|
duration=int(round(elapsed * NANOSECOND)),
|
||||||
|
#TODO error
|
||||||
|
),
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
|
||||||
def parse_options():
|
def parse_options():
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
|
@ -154,45 +130,7 @@ def main():
|
||||||
q.put(StopIteration)
|
q.put(StopIteration)
|
||||||
gevent.spawn_later(options.duration, stop)
|
gevent.spawn_later(options.duration, stop)
|
||||||
|
|
||||||
total_read = 0
|
yaml.safe_dump_all(q, stream=sys.stdout, default_flow_style=False)
|
||||||
total_write = 0
|
|
||||||
read_success = 0
|
|
||||||
read_failure = 0
|
|
||||||
write_success = 0
|
|
||||||
write_failure = 0
|
|
||||||
for item in q:
|
|
||||||
print item
|
|
||||||
if item.type == Result.TYPE_READER:
|
|
||||||
if item.success:
|
|
||||||
read_success += 1
|
|
||||||
total_read += item.size
|
|
||||||
else:
|
|
||||||
read_failure += 1
|
|
||||||
elif item.type == Result.TYPE_WRITER:
|
|
||||||
if item.success:
|
|
||||||
write_success += 1
|
|
||||||
total_write += item.size
|
|
||||||
else:
|
|
||||||
write_failure += 1
|
|
||||||
|
|
||||||
# overall stats
|
|
||||||
print "--- Stats ---"
|
|
||||||
print "Total Read: {read} MB ({mbps} MB/s)".format(
|
|
||||||
read=(total_read/1024.0),
|
|
||||||
mbps=(total_read/1024.0/options.duration),
|
|
||||||
)
|
|
||||||
print "Total Write: {write} MB ({mbps} MB/s)".format(
|
|
||||||
write=(total_write/1024.0),
|
|
||||||
mbps=(total_write/1024.0/options.duration),
|
|
||||||
)
|
|
||||||
print "Read filures: {num} ({percent}%)".format(
|
|
||||||
num=read_failure,
|
|
||||||
percent=(100.0*read_failure/max(read_failure+read_success, 1)),
|
|
||||||
)
|
|
||||||
print "Write failures: {num} ({percent}%)".format(
|
|
||||||
num=write_failure,
|
|
||||||
percent=(100.0*write_failure/max(write_failure+write_success, 1)),
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print e
|
print e
|
||||||
|
|
Loading…
Reference in a new issue