update benchmark script
This commit is contained in:
parent
801d3637b9
commit
ddd9dd4b09
|
@ -18,16 +18,17 @@ import random
|
|||
# for the AIO branch to measure improvements over the
|
||||
# classic thread based disk I/O
|
||||
|
||||
# to set up the test, build the example directoryin release
|
||||
# to set up the test, build the example directory in release
|
||||
# with statistics=on and copy fragmentation_test, client_test
|
||||
# and connection_tester to the current directory.
|
||||
# and connection_tester to a directory called 'stage' (or make
|
||||
# a symbolic link to the bjam output directory).
|
||||
# make sure gnuplot is installed.
|
||||
|
||||
# the following lists define the space tests will be run in
|
||||
|
||||
# variables to test. All these are run on the first
|
||||
# entry in the filesystem list.
|
||||
cache_sizes = [0, 256, 512, 1024, 2048, 4096, 8192]
|
||||
cache_sizes = [0, 512, 1024, 2048, 4096, 8192, 16384]
|
||||
peers = [10, 100, 500, 1000, 2000]
|
||||
|
||||
# the drives are assumed to be mounted under ./<name>
|
||||
|
@ -41,13 +42,13 @@ filesystem = ['ext4', 'ext3', 'reiser', 'xfs']
|
|||
filesystem_peers = 200
|
||||
|
||||
# the amount of cache for the filesystem test
|
||||
filesystem_cache = 2096
|
||||
filesystem_cache = 8192
|
||||
|
||||
# the number of seconds to run each test. It's important that
|
||||
# this is shorter than what it takes to finish downloading
|
||||
# the test torrent, since then the average rate will not
|
||||
# be representative of the peak anymore
|
||||
test_duration = 300
|
||||
test_duration = 100
|
||||
|
||||
|
||||
|
||||
|
@ -57,7 +58,7 @@ if resource.getrlimit(resource.RLIMIT_NOFILE)[0] < 4000:
|
|||
sys.exit(1)
|
||||
|
||||
# make sure we have all the binaries available
|
||||
binaries = ['client_test', 'connection_tester', 'fragmentation_test']
|
||||
binaries = ['stage/client_test', 'stage/connection_tester', 'stage/fragmentation_test']
|
||||
for i in binaries:
|
||||
if not os.path.exists(i):
|
||||
print 'make sure "%s" is available in current working directory' % i
|
||||
|
@ -73,7 +74,7 @@ for i in filesystem:
|
|||
# make sure we have a test torrent
|
||||
if not os.path.exists('test.torrent'):
|
||||
print 'generating test torrent'
|
||||
os.system('./connection_tester gen-torrent test.torrent')
|
||||
os.system('./stage/connection_tester gen-torrent test.torrent')
|
||||
|
||||
# use a new port for each test to make sure they keep working
|
||||
# this port is incremented for each test run
|
||||
|
@ -87,12 +88,13 @@ def build_commandline(config, port):
|
|||
no_read_ahead = ''
|
||||
if config['read-ahead'] == False:
|
||||
no_read_ahead = '-j'
|
||||
allocation_mode = config['allocation-mode']
|
||||
|
||||
global test_duration
|
||||
|
||||
return './client_test -k -z -N -h -H -M -B %d -l %d -S %d -T %d -c %d -C %d -s "%s" %s %s -q %d -p %d -f session_stats/alerts_log.txt test.torrent' \
|
||||
return './stage/client_test -k -z -N -h -H -M -B %d -l %d -S %d -T %d -c %d -C %d -s "%s" %s %s -q %d -p %d -f session_stats/alerts_log.txt -a %s test.torrent' \
|
||||
% (test_duration, num_peers, num_peers, num_peers, num_peers, config['cache-size'], config['save-path'] \
|
||||
, no_disk_reorder, no_read_ahead, test_duration, port)
|
||||
, no_disk_reorder, no_read_ahead, test_duration, port, config['allocation-mode'])
|
||||
|
||||
def delete_files(files):
|
||||
for i in files:
|
||||
|
@ -101,8 +103,11 @@ def delete_files(files):
|
|||
try: shutil.rmtree(i)
|
||||
except: pass
|
||||
|
||||
def build_test_config(fs, num_peers, cache_size, readahead=True, reorder=True):
|
||||
def build_test_config(fs, num_peers, cache_size, readahead=True, reorder=True, preallocate=False):
|
||||
config = {'test': 'dual', 'save-path': os.path.join('./', fs), 'num-peers': num_peers, 'allow-disk-reorder': reorder, 'cache-size': cache_size, 'read-ahead': readahead}
|
||||
if preallocate: config['allocation-mode'] = 'allocate'
|
||||
else: config['allocation-mode'] = 'sparse'
|
||||
|
||||
return config
|
||||
|
||||
def build_target_folder(config):
|
||||
|
@ -111,7 +116,7 @@ def build_target_folder(config):
|
|||
readahead = 'readahead'
|
||||
if config['read-ahead'] == False: readahead = 'no-readahead'
|
||||
|
||||
return 'results_%d_%d_%s_%s_%s_%s' % (config['num-peers'], config['cache-size'], os.path.split(config['save-path'])[1], config['test'], reorder, readahead)
|
||||
return 'results_%d_%d_%s_%s_%s_%s_%s' % (config['num-peers'], config['cache-size'], os.path.split(config['save-path'])[1], config['test'], reorder, readahead, config['allocation-mode'])
|
||||
|
||||
def run_test(config):
|
||||
|
||||
|
@ -136,21 +141,30 @@ def run_test(config):
|
|||
print >>f, config
|
||||
f.close()
|
||||
|
||||
f = open('session_stats/client.output', 'w+')
|
||||
print 'launching: %s' % cmdline
|
||||
client = subprocess.Popen(shlex.split(cmdline), stdout=f)
|
||||
time.sleep(1)
|
||||
print '\n\n*********************************'
|
||||
print '* RUNNING TEST *'
|
||||
print '*********************************\n\n'
|
||||
print 'launching connection tester'
|
||||
os.system('./connection_tester %s %d 127.0.0.1 %d test.torrent >session_stats/tester.output' % (config['test'], config['num-peers'], port))
|
||||
client_output = open('session_stats/client.output', 'w+')
|
||||
print 'launching: %s' % cmdline
|
||||
client = subprocess.Popen(shlex.split(cmdline), stdout=client_output, stdin=subprocess.PIPE)
|
||||
# enable disk stats printing
|
||||
print >>client.stdin, 'x',
|
||||
time.sleep(1)
|
||||
cmdline = './stage/connection_tester %s %d 127.0.0.1 %d test.torrent' % (config['test'], config['num-peers'], port)
|
||||
print 'launching: %s' % cmdline
|
||||
tester_output = open('session_stats/tester.output', 'w+')
|
||||
tester = subprocess.Popen(shlex.split(cmdline), stdout=tester_output)
|
||||
|
||||
f.close()
|
||||
tester.wait()
|
||||
client.wait()
|
||||
tester_output.close()
|
||||
client_output.close()
|
||||
if tester.returncode != 0: sys.exit(tester.returncode)
|
||||
if client.returncode != 0: sys.exit(client.returncode)
|
||||
|
||||
# run fragmentation test
|
||||
print 'analyzing fragmentation'
|
||||
os.system('./fragmentation_test test.torrent %s' % config['save-path'])
|
||||
os.system('./stage/fragmentation_test test.torrent %s' % config['save-path'])
|
||||
shutil.copy('fragmentation.log', 'session_stats/')
|
||||
shutil.copy('fragmentation.png', 'session_stats/')
|
||||
shutil.copy('fragmentation.gnuplot', 'session_stats/')
|
||||
|
@ -174,13 +188,16 @@ def run_test(config):
|
|||
port += 1
|
||||
|
||||
for fs in filesystem:
|
||||
config = build_test_config(fs, filesystem_peers, filesystem_cache)
|
||||
run_test(config)
|
||||
for preallocate in [True, False]:
|
||||
config = build_test_config(fs, filesystem_peers, filesystem_cache, preallocate)
|
||||
run_test(config)
|
||||
|
||||
for c in cache_sizes:
|
||||
for p in peers:
|
||||
for rdahead in [True, False]:
|
||||
for reorder in [True, False]:
|
||||
config = build_test_config(filesystem[0], p, c, rdahead, reorder)
|
||||
# for reorder in [True, False]:
|
||||
reorder = True
|
||||
for preallocate in [True, False]:
|
||||
config = build_test_config(filesystem[0], p, c, rdahead, reorder, preallocate)
|
||||
run_test(config)
|
||||
|
||||
|
|
Loading…
Reference in New Issue