Commit 2c4cc6cc authored by Grégory Wisniewski's avatar Grégory Wisniewski

Include cluster configuration in performance report.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1760 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent a937e3aa
...@@ -62,14 +62,18 @@ def runImport(neo, datafs): ...@@ -62,14 +62,18 @@ def runImport(neo, datafs):
return (dfs_size, elapsed, stats) return (dfs_size, elapsed, stats)
def buildReport(dfs_size, elapsed, stats): def buildReport(config, dfs_size, elapsed, stats):
""" build a report for the given import data """ """ build a report for the given import data """
pat = '%19s | %8s | %5s | %5s | %5s \n' pat = '%19s | %8s | %5s | %5s | %5s \n'
sep = '%19s+%8s+%5s+%5s+%5s\n' sep = '%19s+%8s+%5s+%5s+%5s\n'
sep %= ('-' * 20, '-' * 10) + ('-' * 7, ) * 3 sep %= ('-' * 20, '-' * 10) + ('-' * 7, ) * 3
# system informations dfs_size /= 1024
size = dfs_size / 1024
speed = dfs_size / elapsed
# system
report = ' ' * 20 + ' NEO PERF REPORT\n\n' report = ' ' * 20 + ' NEO PERF REPORT\n\n'
report += "\tDate : %s\n" % datetime.date.today().isoformat() report += "\tDate : %s\n" % datetime.date.today().isoformat()
report += "\tNode : %s\n" % platform.node() report += "\tNode : %s\n" % platform.node()
...@@ -77,6 +81,17 @@ def buildReport(dfs_size, elapsed, stats): ...@@ -77,6 +81,17 @@ def buildReport(dfs_size, elapsed, stats):
platform.architecture()[0]) platform.architecture()[0])
report += "\tSystem : %s (%s)\n" % (platform.system(), report += "\tSystem : %s (%s)\n" % (platform.system(),
platform.release()) platform.release())
report += '\n'
# configuration
report += "\tMasters : %s\n" % (config['masters'], )
report += "\tStorages : %s\n" % (config['storages'], )
report += "\tReplicas : %s\n" % (config['replicas'], )
report += "\tPartitions : %s\n" % (config['partitions'], )
report += '\n'
# results
report += '\n%19s: %6.1f MB' % ('Input size', size)
report += '\n%19s: %6d sec' % ('Import duration', elapsed)
report += '\n%19s: %6.1f KB/s\n' % ('Average speed', speed)
report += '\n\n' report += '\n\n'
# stats on objects and transactions # stats on objects and transactions
...@@ -87,14 +102,6 @@ def buildReport(dfs_size, elapsed, stats): ...@@ -87,14 +102,6 @@ def buildReport(dfs_size, elapsed, stats):
report += pat % (k, s, min(v), s / len(v), max(v)) report += pat % (k, s, min(v), s / len(v), max(v))
report += sep report += sep
# global results
dfs_size /= 1024
size = dfs_size / 1024
speed = dfs_size / elapsed
report += '\n%19s: %6.1f MB' % ('Input size', size)
report += '\n%19s: %6d sec' % ('Import duration', elapsed)
report += '\n%19s: %6.1f KB/s\n' % ('Average speed', speed)
# build summary # build summary
summary = 'Neo : %6.1f KB/s (%6.1f MB)' % (speed, size) summary = 'Neo : %6.1f KB/s (%6.1f MB)' % (speed, size)
...@@ -147,12 +154,14 @@ if __name__ == "__main__": ...@@ -147,12 +154,14 @@ if __name__ == "__main__":
sys.exit('Need a sender and recipients to mail report') sys.exit('Need a sender and recipients to mail report')
# load options or defaults # load options or defaults
masters = int(options.master_count or 1) config = dict(
storages = int(options.storage_count or 1) masters = int(options.master_count or 1),
partitions = int(options.partition_count or 10) storages = int(options.storage_count or 1),
replicas = int(options.replica_count or 0) partitions = int(options.partition_count or 10),
datafs = options.datafs replicas = int(options.replica_count or 0),
)
datafs = options.datafs
mail_server = options.server or '127.0.0.1:25' mail_server = options.server or '127.0.0.1:25'
mail_server = mail_server.split(':') mail_server = mail_server.split(':')
sender = options.sender sender = options.sender
...@@ -160,17 +169,17 @@ if __name__ == "__main__": ...@@ -160,17 +169,17 @@ if __name__ == "__main__":
# start neo # start neo
neo = NEOCluster( neo = NEOCluster(
db_list=['test_import_%d' % i for i in xrange(storages)], db_list=['test_import_%d' % i for i in xrange(config['storages'])],
clear_databases=True, clear_databases=True,
partitions=partitions, partitions=config['partitions'],
replicas=replicas, replicas=config['replicas'],
master_node_count=masters, master_node_count=config['masters'],
verbose=False, verbose=False,
) )
# import datafs # import datafs
neo.start() neo.start()
summary, report = buildReport(*runImport(neo, datafs)) summary, report = buildReport(config, *runImport(neo, datafs))
neo.stop() neo.stop()
# display and/or send the report # display and/or send the report
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment