Commit 7b4ed155 authored by Julien Muchembled's avatar Julien Muchembled

matrix: increase again the default size of ZODB to import

1000 transactions is so small that reports showed significant higher values than
with 10000 transactions.

Repeat 2 times instead of 3, so that tests don't take too much time.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2792 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0a9070d8
...@@ -12,6 +12,7 @@ from ZODB.FileStorage import FileStorage ...@@ -12,6 +12,7 @@ from ZODB.FileStorage import FileStorage
class MatrixImportBenchmark(BenchmarkRunner): class MatrixImportBenchmark(BenchmarkRunner):
error_log = '' error_log = ''
_size = None
def add_options(self, parser): def add_options(self, parser):
parser.add_option('-d', '--datafs') parser.add_option('-d', '--datafs')
...@@ -54,7 +55,7 @@ class MatrixImportBenchmark(BenchmarkRunner): ...@@ -54,7 +55,7 @@ class MatrixImportBenchmark(BenchmarkRunner):
if r < s: if r < s:
x = [x[s][r] for x in result_list if x[s][r] is not None] x = [x[s][r] for x in result_list if x[s][r] is not None]
if x: if x:
z[r] = max(x) z[r] = min(x)
else: else:
z[r] = None z[r] = None
return self.buildReport(storages, replicas, results) return self.buildReport(storages, replicas, results)
...@@ -76,7 +77,7 @@ class MatrixImportBenchmark(BenchmarkRunner): ...@@ -76,7 +77,7 @@ class MatrixImportBenchmark(BenchmarkRunner):
datafs = 'PROD1' datafs = 'PROD1'
import random, neo.tests.stat_zodb import random, neo.tests.stat_zodb
dfs_storage = getattr(neo.tests.stat_zodb, datafs)( dfs_storage = getattr(neo.tests.stat_zodb, datafs)(
random.Random(0)).as_storage(1000) random.Random(0)).as_storage(5000)
print "Import of %s with m=%s, s=%s, r=%s, p=%s" % ( print "Import of %s with m=%s, s=%s, r=%s, p=%s" % (
datafs, masters, storages, replicas, partitions) datafs, masters, storages, replicas, partitions)
if self._config.threaded: if self._config.threaded:
...@@ -102,7 +103,12 @@ class MatrixImportBenchmark(BenchmarkRunner): ...@@ -102,7 +103,12 @@ class MatrixImportBenchmark(BenchmarkRunner):
try: try:
neo_storage.copyTransactionsFrom(dfs_storage) neo_storage.copyTransactionsFrom(dfs_storage)
end = time() end = time()
return dfs_storage.getSize() / ((end - start) * 1e3) size = dfs_storage.getSize()
if self._size is None:
self._size = size
else:
assert self._size == size
return end - start
except: except:
traceback.print_exc() traceback.print_exc()
self.error_log += "Import with m=%s, s=%s, r=%s, p=%s:" % ( self.error_log += "Import with m=%s, s=%s, r=%s, p=%s:" % (
...@@ -113,12 +119,10 @@ class MatrixImportBenchmark(BenchmarkRunner): ...@@ -113,12 +119,10 @@ class MatrixImportBenchmark(BenchmarkRunner):
neo.stop() neo.stop()
def buildReport(self, storages, replicas, results): def buildReport(self, storages, replicas, results):
config = self._config
self.add_status('Min storages', config.min_s)
self.add_status('Max storages', config.max_s)
self.add_status('Min replicas', config.min_r)
self.add_status('Max replicas', config.max_r)
# draw an array with results # draw an array with results
dfs_size = self._size
self.add_status('Input size',
dfs_size and '%-.1f MB' % (dfs_size / 1e6) or 'N/A')
fmt = '|' + '|'.join([' %8s '] * (len(replicas) + 1)) + '|\n' fmt = '|' + '|'.join([' %8s '] * (len(replicas) + 1)) + '|\n'
sep = '+' + '+'.join(['-' * 12] * (len(replicas) + 1)) + '+\n' sep = '+' + '+'.join(['-' * 12] * (len(replicas) + 1)) + '+\n'
report = sep report = sep
...@@ -131,12 +135,14 @@ class MatrixImportBenchmark(BenchmarkRunner): ...@@ -131,12 +135,14 @@ class MatrixImportBenchmark(BenchmarkRunner):
assert s in results assert s in results
for r in replicas: for r in replicas:
if r in results[s]: if r in results[s]:
if results[s][r] is None: result = results[s][r]
if result is None:
values.append('FAIL') values.append('FAIL')
failures += 1 failures += 1
else: else:
values.append('%8.1f' % results[s][r]) result = dfs_size / (result * 1e3)
speedlist.append(results[s][r]) values.append('%8.1f' % result)
speedlist.append(result)
else: else:
values.append('N/A') values.append('N/A')
report += fmt % (tuple([s] + values)) report += fmt % (tuple([s] + values))
......
...@@ -57,7 +57,7 @@ def main(): ...@@ -57,7 +57,7 @@ def main():
] + sys.argv[1:arg_count]) ] + sys.argv[1:arg_count])
if 'm' in tasks: if 'm' in tasks:
subprocess.call([os.path.join(bin, 'python'), subprocess.call([os.path.join(bin, 'python'),
'tools/matrix', '--repeat=3', 'tools/matrix', '--repeat=2',
'--min-storages=1', '--max-storages=24', '--min-storages=1', '--max-storages=24',
'--min-replicas=0', '--max-replicas=3', '--min-replicas=0', '--max-replicas=3',
'--title', 'Matrix ' + title, '--title', 'Matrix ' + title,
......
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