Fix Instance type during benchmarks. (#3147)

- The benchmark initialization function was not taking into account the
  instance type (FS/XL), was using XL ObjectLayer even for FS
  benchmarks.
- This was leading to incorrect benchmark results for FS related
  benchmarks.
- The fix takes into account the instance type (FS/XL) and correctly
  returns FS backend for FS benchmarks.
This commit is contained in:
Karthic Rao
2016-11-01 22:51:16 +05:30
committed by Harshavardhana
parent 4b302173ae
commit 8bffa78f7f
2 changed files with 23 additions and 12 deletions

View File

@@ -30,7 +30,18 @@ import (
// Prepare benchmark backend
func prepareBenchmarkBackend(instanceType string) (ObjectLayer, []string, error) {
nDisks := 16
var nDisks int
switch instanceType {
// Total number of disks for FS backend is set to 1.
case FSTestStr:
nDisks = 1
// Total number of disks for FS backend is set to 16.
case XLTestStr:
nDisks = 16
default:
nDisks = 1
}
// get `nDisks` random disks.
disks, err := getRandomDisks(nDisks)
if err != nil {
return nil, nil, err
@@ -39,11 +50,11 @@ func prepareBenchmarkBackend(instanceType string) (ObjectLayer, []string, error)
if err != nil {
return nil, nil, err
}
// initialize object layer.
obj, _, err := initObjectLayer(endpoints, nil)
if err != nil {
return nil, nil, err
}
return obj, disks, nil
}