Skip to content

Commit 74d1652

Browse files
committed
[FAB-4764] Rearrange Ledger test parameter setup
Increase LTE tool usability by rearranging the Ledger performance test parameter setup so that the parameter file has more control on the test run. Also, make the test driver take the parameter file as a (required) option instead of being hardcoded. Modifies the README.md and the python test wrapper to reflect these changes. Change-Id: I2cbdb0d082b3b8f9f143d2f346742c84556e3c3a Signed-off-by: Adnan Choudhury <[email protected]>
1 parent a5b1ed3 commit 74d1652

File tree

4 files changed

+111
-43
lines changed

4 files changed

+111
-43
lines changed

test/regression/daily/ledger_lte.py

+18-16
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import unittest
77
import subprocess
88

9+
tool_directory = '../../tools/LTE/scripts'
10+
911
class perf_goleveldb(unittest.TestCase):
1012

1113
def test_FAB_3790_VaryNumParallelTxPerChain(self):
@@ -20,9 +22,9 @@ def test_FAB_3790_VaryNumParallelTxPerChain(self):
2022
'''
2123
logfile = open("output_VaryNumParallelTxPerChain.log", "w")
2224
returncode = subprocess.call(
23-
"./runbenchmarks.sh varyNumParallelTxPerChain",
25+
"./runbenchmarks.sh -f parameters_daily_CI.sh varyNumParallelTxPerChain",
2426
shell=True, stderr=subprocess.STDOUT, stdout=logfile,
25-
cwd='../../tools/LTE/scripts')
27+
cwd=tool_directory)
2628
logfile.close()
2729
self.assertEqual(returncode, 0, msg="VaryNumParallelTxPerChain "
2830
"performance test failed. \nPlease check the logfile "
@@ -40,9 +42,9 @@ def test_FAB_3795_VaryNumChains(self):
4042
'''
4143
logfile = open("output_VaryNumChains.log", "w")
4244
returncode = subprocess.call(
43-
"./runbenchmarks.sh varyNumChains",
45+
"./runbenchmarks.sh -f parameters_daily_CI.sh varyNumChains",
4446
shell=True, stderr=subprocess.STDOUT, stdout=logfile,
45-
cwd='../../tools/LTE/scripts')
47+
cwd=tool_directory)
4648
logfile.close()
4749
self.assertEqual(returncode, 0, msg="VaryNumChains performance test"
4850
" failed. \nPlease check the logfile "+logfile.name+" for more "
@@ -60,9 +62,9 @@ def test_FAB_3798_VaryNumParallelTxWithSingleChain(self):
6062
'''
6163
logfile = open("output_VaryNumParallelTxWithSingleChain.log", "w")
6264
returncode = subprocess.call(
63-
"./runbenchmarks.sh varyNumParallelTxWithSingleChain",
65+
"./runbenchmarks.sh -f parameters_daily_CI.sh varyNumParallelTxWithSingleChain",
6466
shell=True, stderr=subprocess.STDOUT, stdout=logfile,
65-
cwd='../../tools/LTE/scripts')
67+
cwd=tool_directory)
6668
logfile.close()
6769
self.assertEqual(returncode, 0, msg="VaryNumParallelTxWithSingleChain "
6870
"performance test failed. \nPlease check the logfile "
@@ -80,9 +82,9 @@ def test_FAB_3799_VaryNumChainsWithNoParallelism(self):
8082
'''
8183
logfile = open("output_VaryNumChainsWithNoParallelism.log", "w")
8284
returncode = subprocess.call(
83-
"./runbenchmarks.sh varyNumChainsWithNoParallelism",
85+
"./runbenchmarks.sh -f parameters_daily_CI.sh varyNumChainsWithNoParallelism",
8486
shell=True, stderr=subprocess.STDOUT, stdout=logfile,
85-
cwd='../../tools/LTE/scripts')
87+
cwd=tool_directory)
8688
logfile.close()
8789
self.assertEqual(returncode, 0, msg="varyNumChainsWithNoParallelism "
8890
"performance test failed. \nPlease check the logfile "
@@ -99,9 +101,9 @@ def test_FAB_3801_VaryKVSize(self):
99101
'''
100102
logfile = open("output_VaryKVSize.log", "w")
101103
returncode = subprocess.call(
102-
"./runbenchmarks.sh varyKVSize",
104+
"./runbenchmarks.sh -f parameters_daily_CI.sh varyKVSize",
103105
shell=True, stderr=subprocess.STDOUT, stdout=logfile,
104-
cwd='../../tools/LTE/scripts')
106+
cwd=tool_directory)
105107
logfile.close()
106108
self.assertEqual(returncode, 0, msg="varyKVSize performance test"
107109
" failed. \nPlease check the logfile "+logfile.name+" for more "
@@ -119,9 +121,9 @@ def test_FAB_3802_VaryBatchSize(self):
119121
'''
120122
logfile = open("output_VaryBatchSize.log", "w")
121123
returncode = subprocess.call(
122-
"./runbenchmarks.sh varyBatchSize",
124+
"./runbenchmarks.sh -f parameters_daily_CI.sh varyBatchSize",
123125
shell=True, stderr=subprocess.STDOUT, stdout=logfile,
124-
cwd='../../tools/LTE/scripts')
126+
cwd=tool_directory)
125127
logfile.close()
126128
self.assertEqual(returncode, 0, msg="varyBatchSize performance test"
127129
" failed. \nPlease check the logfile "+logfile.name+" for more "
@@ -139,9 +141,9 @@ def test_FAB_3800_VaryNumKeysInEachTx(self):
139141
'''
140142
logfile = open("output_VaryNumKeysInEachTx.log", "w")
141143
returncode = subprocess.call(
142-
"./runbenchmarks.sh varyNumKeysInEachTx",
144+
"./runbenchmarks.sh -f parameters_daily_CI.sh varyNumKeysInEachTx",
143145
shell=True, stderr=subprocess.STDOUT, stdout=logfile,
144-
cwd='../../tools/LTE/scripts')
146+
cwd=tool_directory)
145147
logfile.close()
146148
self.assertEqual(returncode, 0, msg="varyNumKeysInEachTx performance "
147149
"test failed. \nPlease check the logfile "+logfile.name
@@ -159,9 +161,9 @@ def test_FAB_3803_VaryNumTxs(self):
159161
'''
160162
logfile = open("output_VaryNumTxs.log", "w")
161163
returncode = subprocess.call(
162-
"./runbenchmarks.sh varyNumTxs",
164+
"./runbenchmarks.sh -f parameters_daily_CI.sh varyNumTxs",
163165
shell=True, stderr=subprocess.STDOUT, stdout=logfile,
164-
cwd='../../tools/LTE/scripts')
166+
cwd=tool_directory)
165167
logfile.close()
166168
self.assertEqual(returncode, 0, msg="varyNumTxs performance test"
167169
" failed. \nPlease check the logfile "+logfile.name+" for more "

test/tools/LTE/README.md

+15-5
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ considered to constitute a single test-run.
2121

2222
## How to Run The tests
2323

24-
To run all the available tests with default parameters, run:
24+
To run all the available tests, run:
2525
```
2626
cd fabric/test/tools/LTE/scripts
27-
./runbenchmark.sh all
27+
./runbenchmark.sh -f parameters_daily_CI.sh all
2828
```
29-
you can run individual tests without running all the available tests by giving
29+
where the file `parameters_daily_CI.sh` has all the necessary test parameters.
30+
31+
32+
You can run individual tests without running all the available tests by giving
3033
the name of the test as parameter, instead of `all`. You can get the available
3134
test names by:
3235
```
@@ -35,7 +38,7 @@ test names by:
3538

3639
### What the Tests Do
3740

38-
Each test reads test parameters from the file `parameters_daily_CI.sh` and
41+
Each test reads test parameters from the provided parameter file and
3942
conducts several test-runs by varying one or two of the parameters. The
4043
parameters are:
4144
* number of chains (ledger),
@@ -95,8 +98,15 @@ transactions on chain_2 in parallel In each of the transactions executed by any
9598
client, the transaction expects and modifies any key(s) between Key_1 to key_50
9699
(because, total keys are to be 100 across two chains).
97100

101+
### Running with Custom Parameters
102+
103+
The tests can be run with user-defined parameters by creating a new file that
104+
has all the necessary parameters to run and using that file as the input (see
105+
the section on how to run the tests) . The names of necessary parameters can be
106+
found in the file `parameters_daily_CI.sh`.
107+
98108
## How to View the Test Results
99109

100110
The test results can be viewed as in the stdout where it shows how long each
101111
single operation took to complete in a test. These results are also saved in a
102-
.csv file in the following directory: `/tmp/fabric/test/tools/LTE/results`
112+
.csv file in the following directory: `/tmp/experiments`

test/tools/LTE/scripts/parameters_daily_CI.sh

+24-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,30 @@
77
DataDir="/tmp/fabric/test/tools/LTE/data"
88
NumChains=10
99
NumParallelTxPerChain=10
10-
NumKVs=1000000
11-
NumTotalTx=1000000
10+
NumKVs=100000
11+
NumTotalTx=100000
1212
NumKeysInEachTx=4
1313
BatchSize=50
1414
KVSize=200
15+
16+
# Each test consists of several test-runs, where one single parameter is varied
17+
# between the test-runs and rest of the parameters remain same. Each array below
18+
# holds the values of that parameter for each corresponding test. For example,
19+
# the "ArrayNumChains" will be used in the test titled "varyNumChains", and the
20+
# 8 test-runs that exist for testing the varying number of chains will use these
21+
# values:
22+
# NumChains = (1 5 10 20 50 100 500 2000)
23+
# NumParallelTxPerChain=10
24+
# NumKVs=100000
25+
# NumTotalTx=100000
26+
# NumKeysInEachTx=4
27+
# BatchSize=50
28+
# KVSize=200
29+
ArrayNumParallelTxPerChain=(1 5 10 20 50 100 500 2000)
30+
ArrayNumChains=(1 5 10 20 50 100 500 2000)
31+
ArrayNumKeysInEachTx=(1 2 5 10 20)
32+
ArrayKVSize=(100 200 500 1000 2000)
33+
ArrayBatchSize=(10 20 100 500)
34+
ArrayNumParallelTxWithSingleChain=(1 5 10 20 50 100 500 2000)
35+
ArrayNumChainsWithNoParallelism=(1 5 10 20 50 100 500 2000)
36+
ArrayNumTxs=(100000 200000 500000 1000000)

test/tools/LTE/scripts/runbenchmarks.sh

+54-20
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,72 @@
66
#
77

88
source ./benchmarks.sh
9-
source ./parameters_daily_CI.sh
109

1110
########################################################################################################
1211
# This shell script contains a series of benchmark tests
13-
# The test parameters are imported from "parameters_daily_CI.sh"
1412
########################################################################################################
1513

1614
function varyNumParallelTxPerChain {
17-
for v in 1 5 10 20 50 100 500 2000; do
15+
for v in "${ArrayNumParallelTxPerChain[@]}"
16+
do
1817
NumParallelTxPerChain=$v
1918
rm -rf $DataDir;runInsertTxs;runReadWriteTxs
2019
done
2120
}
2221

2322
function varyNumChains {
24-
for v in 1 5 10 20 50 100 500 2000; do
23+
for v in "${ArrayNumChains[@]}"
24+
do
2525
NumChains=$v
2626
rm -rf $DataDir;runInsertTxs;runReadWriteTxs
2727
done
2828
}
2929

3030
function varyNumKeysInEachTx {
31-
for v in 1 2 5 10 20; do
31+
for v in "${ArrayNumKeysInEachTx[@]}"
32+
do
3233
NumKeysInEachTx=$v
3334
rm -rf $DataDir;runInsertTxs;runReadWriteTxs
3435
done
3536
}
3637

3738
function varyKVSize {
38-
for v in 100 200 500 1000 2000; do
39+
for v in "${ArrayKVSize[@]}"
40+
do
3941
KVSize=$v
4042
rm -rf $DataDir;runInsertTxs;runReadWriteTxs
4143
done
4244
}
4345

4446
function varyBatchSize {
45-
for v in 10 20 100 500; do
47+
for v in "${ArrayBatchSize[@]}"
48+
do
4649
BatchSize=$v
4750
rm -rf $DataDir;runInsertTxs;runReadWriteTxs
4851
done
4952
}
5053

5154
function varyNumParallelTxWithSingleChain {
5255
NumChains=1
53-
for v in 1 5 10 20 50 100 500 2000; do
56+
for v in "${ArrayNumParallelTxWithSingleChain[@]}"
57+
do
5458
NumParallelTxPerChain=$v
5559
rm -rf $DataDir;runInsertTxs;runReadWriteTxs
5660
done
5761
}
5862

5963
function varyNumChainsWithNoParallelism {
6064
NumParallelTxPerChain=1
61-
for v in 1 5 10 20 50 100 500 2000; do
65+
for v in "${ArrayNumChainsWithNoParallelism[@]}"
66+
do
6267
NumChains=$v
6368
rm -rf $DataDir;runInsertTxs;runReadWriteTxs
6469
done
6570
}
6671

6772
function varyNumTxs {
68-
for v in 1000000 2000000 5000000 10000000; do
73+
for v in "${ArrayNumTxs[@]}"
74+
do
6975
NumTotalTx=$v
7076
rm -rf $DataDir;runInsertTxs;runReadWriteTxs
7177
done
@@ -77,6 +83,42 @@ function runLargeDataExperiment {
7783
rm -rf $DataDir;runInsertTxs;runReadWriteTxs
7884
}
7985

86+
function usage () {
87+
printf "Usage: ./runbenchmarks.sh [-f parameter_file_name] [test_name]\nAvailable tests (use \"all\" to run all tests):
88+
varyNumParallelTxPerChain
89+
varyNumChains
90+
varyNumParallelTxWithSingleChain
91+
varyNumChainsWithNoParallelism
92+
varyNumKeysInEachTx
93+
varyKVSize
94+
varyBatchSize
95+
varyNumTxs
96+
runLargeDataExperiment\n"
97+
}
98+
99+
PARAM_FILE=""
100+
101+
while getopts ":f:" opt; do
102+
case $opt in
103+
f)
104+
printf "Parameter file: $OPTARG"
105+
PARAM_FILE=$OPTARG;;
106+
\?)
107+
printf "Error: invalid parameter -$OPTARG!" >> /dev/stderr
108+
usage
109+
exit 1;;
110+
esac
111+
done
112+
113+
if [ ! $PARAM_FILE ]
114+
then
115+
printf "Error: No Parameter file given!" >> /dev/stderr
116+
usage
117+
exit 1
118+
else
119+
source $PARAM_FILE
120+
fi
121+
80122
shift $(expr $OPTIND - 1 )
81123

82124
case $1 in
@@ -99,16 +141,7 @@ case $1 in
99141
runLargeDataExperiment)
100142
runLargeDataExperiment ;;
101143
help)
102-
printf "Usage: ./runbenchmarks.sh [test_name]\nAvailable tests (use \"all\" to run all tests):
103-
varyNumParallelTxPerChain
104-
varyNumChains
105-
varyNumParallelTxWithSingleChain
106-
varyNumChainsWithNoParallelism
107-
varyNumKeysInEachTx
108-
varyKVSize
109-
varyBatchSize
110-
varyNumTxs
111-
runLargeDataExperiment\n"
144+
usage
112145
;;
113146
all)
114147
varyNumParallelTxPerChain
@@ -122,5 +155,6 @@ runLargeDataExperiment\n"
122155
runLargeDataExperiment ;;
123156
*)
124157
printf "Error: test name empty/incorrect!\n" >> /dev/stderr
158+
usage
125159
exit 1 ;;
126160
esac

0 commit comments

Comments
 (0)