From 0eaf6847775096a82d5e94a48541187df064e234 Mon Sep 17 00:00:00 2001 From: karthic rao Date: Thu, 21 Jul 2016 23:47:28 +0530 Subject: [PATCH] Remove consuming benchmarks, clean up closures, correct Get and PutObject Parallel benchmarks (#2258) --- benchmark-utils_test.go | 72 +++++------- object-api-getobject_test.go | 215 +++++++++++------------------------ object-api-multipart_test.go | 26 ++--- object-api-putobject_test.go | 151 ++++++------------------ 4 files changed, 136 insertions(+), 328 deletions(-) diff --git a/benchmark-utils_test.go b/benchmark-utils_test.go index faebffcec..7f8dd02fa 100644 --- a/benchmark-utils_test.go +++ b/benchmark-utils_test.go @@ -133,7 +133,7 @@ func runPutObjectPartBenchmark(b *testing.B, obj ObjectLayer, partSize int) { } // creates XL/FS backend setup, obtains the object layer and calls the runPutObjectPartBenchmark function. -func benchmarkPutObjectPart(b *testing.B, instanceType string, runBenchMark func(b *testing.B, obj ObjectLayer)) { +func benchmarkPutObjectPart(b *testing.B, instanceType string, objSize int) { // create a temp XL/FS backend. objLayer, disks, err := makeTestBackend(instanceType) if err != nil { @@ -141,20 +141,12 @@ func benchmarkPutObjectPart(b *testing.B, instanceType string, runBenchMark func } // cleaning up the backend by removing all the directories and files created on function return. defer removeRoots(disks) - // calling runPutObjectBenchmark which uses *testing.B and the object Layer to run the benchmark. - runBenchMark(b, objLayer) -} - -// closure for returning the put object benchmark executor for given object size in bytes. -func returnPutObjectPartBenchmark(objSize int) func(*testing.B, ObjectLayer) { - // FIXME: Avoid closure. - return func(b *testing.B, obj ObjectLayer) { - runPutObjectPartBenchmark(b, obj, objSize) - } + // uses *testing.B and the object Layer to run the benchmark. + runPutObjectPartBenchmark(b, objLayer, objSize) } // creates XL/FS backend setup, obtains the object layer and calls the runPutObjectBenchmark function. -func benchmarkPutObject(b *testing.B, instanceType string, runBenchMark func(b *testing.B, obj ObjectLayer)) { +func benchmarkPutObject(b *testing.B, instanceType string, objSize int) { // create a temp XL/FS backend. objLayer, disks, err := makeTestBackend(instanceType) if err != nil { @@ -162,16 +154,21 @@ func benchmarkPutObject(b *testing.B, instanceType string, runBenchMark func(b * } // cleaning up the backend by removing all the directories and files created on function return. defer removeRoots(disks) - // calling runPutObjectBenchmark which uses *testing.B and the object Layer to run the benchmark. - runBenchMark(b, objLayer) + // uses *testing.B and the object Layer to run the benchmark. + runPutObjectBenchmark(b, objLayer, objSize) } -// closure for returning the put object benchmark executor for given object size in bytes. -func returnPutObjectBenchmark(objSize int) func(*testing.B, ObjectLayer) { - // FIXME: Avoid closure. - return func(b *testing.B, obj ObjectLayer) { - runPutObjectBenchmark(b, obj, objSize) +// creates XL/FS backend setup, obtains the object layer and runs parallel benchmark for put object. +func benchmarkPutObjectParallel(b *testing.B, instanceType string, objSize int) { + // create a temp XL/FS backend. + objLayer, disks, err := makeTestBackend(instanceType) + if err != nil { + b.Fatalf("Failed obtaining Temp Backend: %s", err) } + // cleaning up the backend by removing all the directories and files created on function return. + defer removeRoots(disks) + // uses *testing.B and the object Layer to run the benchmark. + runPutObjectBenchmarkParallel(b, objLayer, objSize) } // Benchmark utility functions for ObjectLayer.GetObject(). @@ -243,7 +240,7 @@ func generateBytesData(size int) []byte { } // creates XL/FS backend setup, obtains the object layer and calls the runGetObjectBenchmark function. -func benchmarkGetObject(b *testing.B, instanceType string, runBenchMark func(b *testing.B, obj ObjectLayer)) { +func benchmarkGetObject(b *testing.B, instanceType string, objSize int) { // create a temp XL/FS backend. objLayer, disks, err := makeTestBackend(instanceType) if err != nil { @@ -251,16 +248,21 @@ func benchmarkGetObject(b *testing.B, instanceType string, runBenchMark func(b * } // cleaning up the backend by removing all the directories and files created. defer removeRoots(disks) - // calling runGetObjectBenchmark which uses *testing.B and the object Layer to run the benchmark. - runBenchMark(b, objLayer) + // uses *testing.B and the object Layer to run the benchmark. + runGetObjectBenchmark(b, objLayer, objSize) } -// closure for returning the get object benchmark executor for given object size in bytes. -// FIXME: Avoid closure. -func returnGetObjectBenchmark(objSize int) func(*testing.B, ObjectLayer) { - return func(b *testing.B, obj ObjectLayer) { - runGetObjectBenchmark(b, obj, objSize) +// creates XL/FS backend setup, obtains the object layer and runs parallel benchmark for ObjectLayer.GetObject() . +func benchmarkGetObjectParallel(b *testing.B, instanceType string, objSize int) { + // create a temp XL/FS backend. + objLayer, disks, err := makeTestBackend(instanceType) + if err != nil { + b.Fatalf("Failed obtaining Temp Backend: %s", err) } + // cleaning up the backend by removing all the directories and files created. + defer removeRoots(disks) + // uses *testing.B and the object Layer to run the benchmark. + runGetObjectBenchmarkParallel(b, objLayer, objSize) } // Parallel benchmark utility functions for ObjectLayer.PutObject(). @@ -310,14 +312,6 @@ func runPutObjectBenchmarkParallel(b *testing.B, obj ObjectLayer, objSize int) { b.StopTimer() } -// closure for returning the put object benchmark executor for given object size in bytes. -func returnPutObjectBenchmarkParallel(objSize int) func(*testing.B, ObjectLayer) { - // FIXME: Avoid closure. - return func(b *testing.B, obj ObjectLayer) { - runPutObjectBenchmarkParallel(b, obj, objSize) - } -} - // Parallel benchmark utility functions for ObjectLayer.GetObject(). // Creates Object layer setup ( MakeBucket, PutObject) and then runs the benchmark. func runGetObjectBenchmarkParallel(b *testing.B, obj ObjectLayer, objSize int) { @@ -374,11 +368,3 @@ func runGetObjectBenchmarkParallel(b *testing.B, obj ObjectLayer, objSize int) { b.StopTimer() } - -// closure for returning the get object benchmark executor for given object size in bytes. -// FIXME: Avoid closure. -func returnGetObjectBenchmarkParallel(objSize int) func(*testing.B, ObjectLayer) { - return func(b *testing.B, obj ObjectLayer) { - runGetObjectBenchmarkParallel(b, obj, objSize) - } -} diff --git a/object-api-getobject_test.go b/object-api-getobject_test.go index c84e20394..2d0e19bb8 100644 --- a/object-api-getobject_test.go +++ b/object-api-getobject_test.go @@ -175,250 +175,169 @@ func testGetObject(obj ObjectLayer, instanceType string, t TestErrHandler) { } // Benchmarks for ObjectLayer.GetObject(). -// The intent is to benchamrk GetObject for various sizes ranging from few bytes to 100MB. +// The intent is to benchmark GetObject for various sizes ranging from few bytes to 100MB. // Also each of these Benchmarks are run both XL and FS backends. // BenchmarkGetObjectVerySmallFS - Benchmark FS.GetObject() for object size of 10 bytes. func BenchmarkGetObjectVerySmallFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(10)) + benchmarkGetObject(b, "FS", 10) } // BenchmarkGetObjectVerySmallXL - Benchmark XL.GetObject() for object size of 10 bytes. func BenchmarkGetObjectVerySmallXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(10)) + benchmarkGetObject(b, "XL", 10) } // BenchmarkGetObject10KbFS - Benchmark FS.GetObject() for object size of 10KB. func BenchmarkGetObject10KbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(10*1024)) + benchmarkGetObject(b, "FS", 10*1024) } // BenchmarkGetObject10KbXL - Benchmark XL.GetObject() for object size of 10KB. func BenchmarkGetObject10KbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(10*1024)) + benchmarkGetObject(b, "XL", 10*1024) } // BenchmarkGetObject100KbFS - Benchmark FS.GetObject() for object size of 100KB. func BenchmarkGetObject100KbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(100*1024)) + benchmarkGetObject(b, "FS", 100*1024) } // BenchmarkGetObject100KbXL - Benchmark XL.GetObject() for object size of 100KB. func BenchmarkGetObject100KbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(100*1024)) + benchmarkGetObject(b, "XL", 100*1024) } // BenchmarkGetObject1MbFS - Benchmark FS.GetObject() for object size of 1MB. func BenchmarkGetObject1MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(1024*1024)) + benchmarkGetObject(b, "FS", 1024*1024) } // BenchmarkGetObject1MbXL - Benchmark XL.GetObject() for object size of 1MB. func BenchmarkGetObject1MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(1024*1024)) + benchmarkGetObject(b, "XL", 1024*1024) } // BenchmarkGetObject5MbFS - Benchmark FS.GetObject() for object size of 5MB. func BenchmarkGetObject5MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(5*1024*1024)) + benchmarkGetObject(b, "FS", 5*1024*1024) } // BenchmarkGetObject5MbXL - Benchmark XL.GetObject() for object size of 5MB. func BenchmarkGetObject5MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(5*1024*1024)) + benchmarkGetObject(b, "XL", 5*1024*1024) } // BenchmarkGetObject10MbFS - Benchmark FS.GetObject() for object size of 10MB. func BenchmarkGetObject10MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(10*1024*1024)) + benchmarkGetObject(b, "FS", 10*1024*1024) } // BenchmarkGetObject10MbXL - Benchmark XL.GetObject() for object size of 10MB. func BenchmarkGetObject10MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(10*1024*1024)) + benchmarkGetObject(b, "XL", 10*1024*1024) } // BenchmarkGetObject25MbFS - Benchmark FS.GetObject() for object size of 25MB. func BenchmarkGetObject25MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(25*1024*1024)) + benchmarkGetObject(b, "FS", 25*1024*1024) } // BenchmarkGetObject25MbXL - Benchmark XL.GetObject() for object size of 25MB. func BenchmarkGetObject25MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(25*1024*1024)) + benchmarkGetObject(b, "XL", 25*1024*1024) } // BenchmarkGetObject50MbFS - Benchmark FS.GetObject() for object size of 50MB. func BenchmarkGetObject50MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(50*1024*1024)) + benchmarkGetObject(b, "FS", 50*1024*1024) } // BenchmarkGetObject50MbXL - Benchmark XL.GetObject() for object size of 50MB. func BenchmarkGetObject50MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(50*1024*1024)) + benchmarkGetObject(b, "XL", 50*1024*1024) } -// BenchmarkGetObject100MbFS - Benchmark FS.GetObject() for object size of 100MB. -func BenchmarkGetObject100MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(100*1024*1024)) +// parallel benchmarks for ObjectLayer.GetObject() . + +// BenchmarkGetObjectParallelVerySmallFS - Benchmark FS.GetObject() for object size of 10 bytes. +func BenchmarkGetObjectParallelVerySmallFS(b *testing.B) { + benchmarkGetObjectParallel(b, "FS", 10) } -// BenchmarkGetObject100MbXL - Benchmark XL.GetObject() for object size of 100MB. -func BenchmarkGetObject100MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(100*1024*1024)) +// BenchmarkGetObjectParallelVerySmallXL - Benchmark XL.GetObject() for object size of 10 bytes. +func BenchmarkGetObjectParallelVerySmallXL(b *testing.B) { + benchmarkGetObjectParallel(b, "XL", 10) } -// BenchmarkGetObject200MbFS - Benchmark FS.GetObject() for object size of 200MB. -func BenchmarkGetObject200MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(200*1024*1024)) +// BenchmarkGetObjectParallel10KbFS - Benchmark FS.GetObject() for object size of 10KB. +func BenchmarkGetObjectParallel10KbFS(b *testing.B) { + benchmarkGetObjectParallel(b, "FS", 10*1024) } -// BenchmarkGetObject200MbXL - Benchmark XL.GetObject() for object size of 200MB. -func BenchmarkGetObject200MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(200*1024*1024)) +// BenchmarkGetObjectParallel10KbXL - Benchmark XL.GetObject() for object size of 10KB. +func BenchmarkGetObjectParallel10KbXL(b *testing.B) { + benchmarkGetObjectParallel(b, "XL", 10*1024) } -// BenchmarkGetObject500MbFS - Benchmark FS.GetObject() for object size of 500MB. -func BenchmarkGetObject500MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(500*1024*1024)) +// BenchmarkGetObjectParallel100KbFS - Benchmark FS.GetObject() for object size of 100KB. +func BenchmarkGetObjectParallel100KbFS(b *testing.B) { + benchmarkGetObjectParallel(b, "FS", 100*1024) } -// BenchmarkGetObject500MbXL - Benchmark XL.GetObject() for object size of 500MB. -func BenchmarkGetObject500MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(500*1024*1024)) +// BenchmarkGetObjectParallel100KbXL - Benchmark XL.GetObject() for object size of 100KB. +func BenchmarkGetObjectParallel100KbXL(b *testing.B) { + benchmarkGetObjectParallel(b, "XL", 100*1024) } -// BenchmarkGetObject1GbFS - Benchmark FS.GetObject() for object size of 1GB. -func BenchmarkGetObject1GbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmark(1024*1024*1024)) +// BenchmarkGetObjectParallel1MbFS - Benchmark FS.GetObject() for object size of 1MB. +func BenchmarkGetObjectParallel1MbFS(b *testing.B) { + benchmarkGetObjectParallel(b, "FS", 1024*1024) } -// BenchmarkGetObjectGbXL - Benchmark XL.GetObject() for object size of 1GB. -func BenchmarkGetObject1GbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmark(1024*1024*1024)) +// BenchmarkGetObjectParallel1MbXL - Benchmark XL.GetObject() for object size of 1MB. +func BenchmarkGetObjectParallel1MbXL(b *testing.B) { + benchmarkGetObjectParallel(b, "XL", 1024*1024) } -// The intent is to benchamrk GetObject for various sizes ranging from few bytes to 100MB. -// Also each of these BenchmarkParallels are run both XL and FS backends. - -// BenchmarkParallelGetObjectVerySmallFS - BenchmarkParallel FS.GetObject() for object size of 10 bytes. -func BenchmarkParallelGetObjectVerySmallFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(10)) +// BenchmarkGetObjectParallel5MbFS - Benchmark FS.GetObject() for object size of 5MB. +func BenchmarkGetObjectParallel5MbFS(b *testing.B) { + benchmarkGetObjectParallel(b, "FS", 5*1024*1024) } -// BenchmarkParallelGetObjectVerySmallXL - BenchmarkParallel XL.GetObject() for object size of 10 bytes. -func BenchmarkParallelGetObjectVerySmallXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(10)) +// BenchmarkGetObjectParallel5MbXL - Benchmark XL.GetObject() for object size of 5MB. +func BenchmarkGetObjectParallel5MbXL(b *testing.B) { + benchmarkGetObjectParallel(b, "XL", 5*1024*1024) } -// BenchmarkParallelGetObject10KbFS - BenchmarkParallel FS.GetObject() for object size of 10KB. -func BenchmarkParallelGetObject10KbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(10*1024)) +// BenchmarkGetObjectParallel10MbFS - Benchmark FS.GetObject() for object size of 10MB. +func BenchmarkGetObjectParallel10MbFS(b *testing.B) { + benchmarkGetObjectParallel(b, "FS", 10*1024*1024) } -// BenchmarkParallelGetObject10KbXL - BenchmarkParallel XL.GetObject() for object size of 10KB. -func BenchmarkParallelGetObject10KbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(10*1024)) +// BenchmarkGetObjectParallel10MbXL - Benchmark XL.GetObject() for object size of 10MB. +func BenchmarkGetObjectParallel10MbXL(b *testing.B) { + benchmarkGetObjectParallel(b, "XL", 10*1024*1024) } -// BenchmarkParallelGetObject100KbFS - BenchmarkParallel FS.GetObject() for object size of 100KB. -func BenchmarkParallelGetObject100KbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(100*1024)) -} - -// BenchmarkParallelGetObject100KbXL - BenchmarkParallel XL.GetObject() for object size of 100KB. -func BenchmarkParallelGetObject100KbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(100*1024)) -} - -// BenchmarkParallelGetObject1MbFS - BenchmarkParallel FS.GetObject() for object size of 1MB. -func BenchmarkParallelGetObject1MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(1024*1024)) -} - -// BenchmarkParallelGetObject1MbXL - BenchmarkParallel XL.GetObject() for object size of 1MB. -func BenchmarkParallelGetObject1MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(1024*1024)) -} - -// BenchmarkParallelGetObject5MbFS - BenchmarkParallel FS.GetObject() for object size of 5MB. -func BenchmarkParallelGetObject5MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(5*1024*1024)) -} - -// BenchmarkParallelGetObject5MbXL - BenchmarkParallel XL.GetObject() for object size of 5MB. -func BenchmarkParallelGetObject5MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(5*1024*1024)) -} - -// BenchmarkParallelGetObject10MbFS - BenchmarkParallel FS.GetObject() for object size of 10MB. -func BenchmarkParallelGetObject10MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(10*1024*1024)) -} - -// BenchmarkParallelGetObject10MbXL - BenchmarkParallel XL.GetObject() for object size of 10MB. -func BenchmarkParallelGetObject10MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(10*1024*1024)) -} - -// BenchmarkParallelGetObject25MbFS - BenchmarkParallel FS.GetObject() for object size of 25MB. -func BenchmarkParallelGetObject25MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(25*1024*1024)) +// BenchmarkGetObjectParallel25MbFS - Benchmark FS.GetObject() for object size of 25MB. +func BenchmarkGetObjectParallel25MbFS(b *testing.B) { + benchmarkGetObjectParallel(b, "FS", 25*1024*1024) } -// BenchmarkParallelGetObject25MbXL - BenchmarkParallel XL.GetObject() for object size of 25MB. -func BenchmarkParallelGetObject25MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(25*1024*1024)) +// BenchmarkGetObjectParallel25MbXL - Benchmark XL.GetObject() for object size of 25MB. +func BenchmarkGetObjectParallel25MbXL(b *testing.B) { + benchmarkGetObjectParallel(b, "XL", 25*1024*1024) } -// BenchmarkParallelGetObject50MbFS - BenchmarkParallel FS.GetObject() for object size of 50MB. -func BenchmarkParallelGetObject50MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(50*1024*1024)) +// BenchmarkGetObjectParallel50MbFS - Benchmark FS.GetObject() for object size of 50MB. +func BenchmarkGetObjectParallel50MbFS(b *testing.B) { + benchmarkGetObjectParallel(b, "FS", 50*1024*1024) } -// BenchmarkParallelGetObject50MbXL - BenchmarkParallel XL.GetObject() for object size of 50MB. -func BenchmarkParallelGetObject50MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(50*1024*1024)) -} - -// BenchmarkParallelGetObject100MbFS - BenchmarkParallel FS.GetObject() for object size of 100MB. -func BenchmarkParallelGetObject100MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(100*1024*1024)) -} - -// BenchmarkParallelGetObject100MbXL - BenchmarkParallel XL.GetObject() for object size of 100MB. -func BenchmarkParallelGetObject100MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(100*1024*1024)) -} - -// BenchmarkParallelGetObject200MbFS - BenchmarkParallel FS.GetObject() for object size of 200MB. -func BenchmarkParallelGetObject200MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(200*1024*1024)) -} - -// BenchmarkParallelGetObject200MbXL - BenchmarkParallel XL.GetObject() for object size of 200MB. -func BenchmarkParallelGetObject200MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(200*1024*1024)) -} - -// BenchmarkParallelGetObject500MbFS - BenchmarkParallel FS.GetObject() for object size of 500MB. -func BenchmarkParallelGetObject500MbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(500*1024*1024)) -} - -// BenchmarkParallelGetObject500MbXL - BenchmarkParallel XL.GetObject() for object size of 500MB. -func BenchmarkParallelGetObject500MbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(500*1024*1024)) -} - -// BenchmarkParallelGetObject1GbFS - BenchmarkParallel FS.GetObject() for object size of 1GB. -func BenchmarkParallelGetObject1GbFS(b *testing.B) { - benchmarkGetObject(b, "FS", returnGetObjectBenchmarkParallel(1024*1024*1024)) -} - -// BenchmarkParallelGetObjectGbXL - BenchmarkParallel XL.GetObject() for object size of 1GB. -func BenchmarkParallelGetObject1GbXL(b *testing.B) { - benchmarkGetObject(b, "XL", returnGetObjectBenchmarkParallel(1024*1024*1024)) +// BenchmarkGetObjectParallel50MbXL - Benchmark XL.GetObject() for object size of 50MB. +func BenchmarkGetObjectParallel50MbXL(b *testing.B) { + benchmarkGetObjectParallel(b, "XL", 50*1024*1024) } diff --git a/object-api-multipart_test.go b/object-api-multipart_test.go index 066c416dc..769885e78 100644 --- a/object-api-multipart_test.go +++ b/object-api-multipart_test.go @@ -1881,51 +1881,41 @@ func testObjectCompleteMultipartUpload(obj ObjectLayer, instanceType string, t T // BenchmarkPutObjectPart5MbFS - Benchmark FS.PutObjectPart() for object size of 5MB. func BenchmarkPutObjectPart5MbFS(b *testing.B) { - benchmarkPutObjectPart(b, "FS", returnPutObjectPartBenchmark(5*1024*1024)) + benchmarkPutObjectPart(b, "FS", 5*1024*1024) } // BenchmarkPutObjectPart5MbXL - Benchmark XL.PutObjectPart() for object size of 5MB. func BenchmarkPutObjectPart5MbXL(b *testing.B) { - benchmarkPutObjectPart(b, "XL", returnPutObjectPartBenchmark(5*1024*1024)) + benchmarkPutObjectPart(b, "XL", 5*1024*1024) } // BenchmarkPutObjectPart10MbFS - Benchmark FS.PutObjectPart() for object size of 10MB. func BenchmarkPutObjectPart10MbFS(b *testing.B) { - benchmarkPutObjectPart(b, "FS", returnPutObjectPartBenchmark(10*1024*1024)) + benchmarkPutObjectPart(b, "FS", 10*1024*1024) } // BenchmarkPutObjectPart10MbXL - Benchmark XL.PutObjectPart() for object size of 10MB. func BenchmarkPutObjectPart10MbXL(b *testing.B) { - benchmarkPutObjectPart(b, "XL", returnPutObjectPartBenchmark(10*1024*1024)) + benchmarkPutObjectPart(b, "XL", 10*1024*1024) } // BenchmarkPutObjectPart25MbFS - Benchmark FS.PutObjectPart() for object size of 25MB. func BenchmarkPutObjectPart25MbFS(b *testing.B) { - benchmarkPutObjectPart(b, "FS", returnPutObjectPartBenchmark(25*1024*1024)) + benchmarkPutObjectPart(b, "FS", 25*1024*1024) } // BenchmarkPutObjectPart25MbXL - Benchmark XL.PutObjectPart() for object size of 25MB. func BenchmarkPutObjectPart25MbXL(b *testing.B) { - benchmarkPutObjectPart(b, "XL", returnPutObjectPartBenchmark(25*1024*1024)) + benchmarkPutObjectPart(b, "XL", 25*1024*1024) } // BenchmarkPutObjectPart50MbFS - Benchmark FS.PutObjectPart() for object size of 50MB. func BenchmarkPutObjectPart50MbFS(b *testing.B) { - benchmarkPutObjectPart(b, "FS", returnPutObjectPartBenchmark(50*1024*1024)) + benchmarkPutObjectPart(b, "FS", 50*1024*1024) } // BenchmarkPutObjectPart50MbXL - Benchmark XL.PutObjectPart() for object size of 50MB. func BenchmarkPutObjectPart50MbXL(b *testing.B) { - benchmarkPutObjectPart(b, "XL", returnPutObjectPartBenchmark(50*1024*1024)) -} - -// BenchmarkPutObjectPart100MbFS - Benchmark FS.PutObjectPart() for object size of 100MB. -func BenchmarkPutObjectPart100MbFS(b *testing.B) { - benchmarkPutObjectPart(b, "FS", returnPutObjectPartBenchmark(100*1024*1024)) -} - -// BenchmarkPutObjectPart100MbXL - Benchmark XL.PutObjectPart() for object size of 100MB. -func BenchmarkPutObjectPart100MbXL(b *testing.B) { - benchmarkPutObjectPart(b, "XL", returnPutObjectPartBenchmark(100*1024*1024)) + benchmarkPutObjectPart(b, "XL", 50*1024*1024) } diff --git a/object-api-putobject_test.go b/object-api-putobject_test.go index b3e384aba..86332e991 100644 --- a/object-api-putobject_test.go +++ b/object-api-putobject_test.go @@ -351,241 +351,154 @@ func testObjectAPIMultipartPutObjectStaleFiles(obj ObjectLayer, instanceType str // BenchmarkPutObjectVerySmallFS - Benchmark FS.PutObject() for object size of 10 bytes. func BenchmarkPutObjectVerySmallFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(10)) + benchmarkPutObject(b, "FS", 10) } // BenchmarkPutObjectVerySmallXL - Benchmark XL.PutObject() for object size of 10 bytes. func BenchmarkPutObjectVerySmallXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(10)) + benchmarkPutObject(b, "XL", 10) } // BenchmarkPutObject10KbFS - Benchmark FS.PutObject() for object size of 10KB. func BenchmarkPutObject10KbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(10*1024)) + benchmarkPutObject(b, "FS", 10*1024) } // BenchmarkPutObject10KbXL - Benchmark XL.PutObject() for object size of 10KB. func BenchmarkPutObject10KbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(10*1024)) + benchmarkPutObject(b, "XL", 10*1024) } // BenchmarkPutObject100KbFS - Benchmark FS.PutObject() for object size of 100KB. func BenchmarkPutObject100KbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(100*1024)) + benchmarkPutObject(b, "FS", 100*1024) } // BenchmarkPutObject100KbXL - Benchmark XL.PutObject() for object size of 100KB. func BenchmarkPutObject100KbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(100*1024)) + benchmarkPutObject(b, "XL", 100*1024) } // BenchmarkPutObject1MbFS - Benchmark FS.PutObject() for object size of 1MB. func BenchmarkPutObject1MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(1024*1024)) + benchmarkPutObject(b, "FS", 1024*1024) } // BenchmarkPutObject1MbXL - Benchmark XL.PutObject() for object size of 1MB. func BenchmarkPutObject1MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(1024*1024)) + benchmarkPutObject(b, "XL", 1024*1024) } // BenchmarkPutObject5MbFS - Benchmark FS.PutObject() for object size of 5MB. func BenchmarkPutObject5MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(5*1024*1024)) + benchmarkPutObject(b, "FS", 5*1024*1024) } // BenchmarkPutObject5MbXL - Benchmark XL.PutObject() for object size of 5MB. func BenchmarkPutObject5MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(5*1024*1024)) + benchmarkPutObject(b, "XL", 5*1024*1024) } // BenchmarkPutObject10MbFS - Benchmark FS.PutObject() for object size of 10MB. func BenchmarkPutObject10MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(10*1024*1024)) + benchmarkPutObject(b, "FS", 10*1024*1024) } // BenchmarkPutObject10MbXL - Benchmark XL.PutObject() for object size of 10MB. func BenchmarkPutObject10MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(10*1024*1024)) + benchmarkPutObject(b, "XL", 10*1024*1024) } // BenchmarkPutObject25MbFS - Benchmark FS.PutObject() for object size of 25MB. func BenchmarkPutObject25MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(25*1024*1024)) + benchmarkPutObject(b, "FS", 25*1024*1024) } // BenchmarkPutObject25MbXL - Benchmark XL.PutObject() for object size of 25MB. func BenchmarkPutObject25MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(25*1024*1024)) + benchmarkPutObject(b, "XL", 25*1024*1024) } // BenchmarkPutObject50MbFS - Benchmark FS.PutObject() for object size of 50MB. func BenchmarkPutObject50MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(50*1024*1024)) + benchmarkPutObject(b, "FS", 50*1024*1024) } // BenchmarkPutObject50MbXL - Benchmark XL.PutObject() for object size of 50MB. func BenchmarkPutObject50MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(50*1024*1024)) + benchmarkPutObject(b, "XL", 50*1024*1024) } -// BenchmarkPutObject100MbFS - Benchmark FS.PutObject() for object size of 100MB. -func BenchmarkPutObject100MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(100*1024*1024)) -} - -// BenchmarkPutObject100MbXL - Benchmark XL.PutObject() for object size of 100MB. -func BenchmarkPutObject100MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(100*1024*1024)) -} - -// BenchmarkPutObject200MbFS - Benchmark FS.PutObject() for object size of 200MB. -func BenchmarkPutObject200MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(200*1024*1024)) -} - -// BenchmarkPutObject200MbXL - Benchmark XL.PutObject() for object size of 200MB. -func BenchmarkPutObject200MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(200*1024*1024)) -} - -// BenchmarkPutObject500MbFS - Benchmark FS.PutObject() for object size of 500MB. -func BenchmarkPutObject500MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(500*1024*1024)) -} - -// BenchmarkPutObject500MbXL - Benchmark XL.PutObject() for object size of 500MB. -func BenchmarkPutObject500MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(500*1024*1024)) -} - -// BenchmarkPutObject1GbFS - Benchmark FS.PutObject() for object size of 1GB. -func BenchmarkPutObject1GbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmark(1024*1024*1024)) -} - -// BenchmarkPutObjectGbXL - Benchmark XL.PutObject() for object size of 1GB. -func BenchmarkPutObject1GbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmark(1024*1024*1024)) -} +// parallel benchmarks for ObjectLayer.PutObject() . +// BenchmarkParallelPutObjectVerySmallFS - BenchmarkParallel FS.PutObject() for object size of 10 bytes. func BenchmarkParallelPutObjectVerySmallFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(10)) + benchmarkPutObjectParallel(b, "FS", 10) } // BenchmarkParallelPutObjectVerySmallXL - BenchmarkParallel XL.PutObject() for object size of 10 bytes. func BenchmarkParallelPutObjectVerySmallXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(10)) + benchmarkPutObjectParallel(b, "XL", 10) } // BenchmarkParallelPutObject10KbFS - BenchmarkParallel FS.PutObject() for object size of 10KB. func BenchmarkParallelPutObject10KbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(10*1024)) + benchmarkPutObjectParallel(b, "FS", 10*1024) } // BenchmarkParallelPutObject10KbXL - BenchmarkParallel XL.PutObject() for object size of 10KB. func BenchmarkParallelPutObject10KbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(10*1024)) + benchmarkPutObjectParallel(b, "XL", 10*1024) } // BenchmarkParallelPutObject100KbFS - BenchmarkParallel FS.PutObject() for object size of 100KB. func BenchmarkParallelPutObject100KbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(100*1024)) + benchmarkPutObjectParallel(b, "FS", 100*1024) } // BenchmarkParallelPutObject100KbXL - BenchmarkParallel XL.PutObject() for object size of 100KB. func BenchmarkParallelPutObject100KbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(100*1024)) + benchmarkPutObjectParallel(b, "XL", 100*1024) } // BenchmarkParallelPutObject1MbFS - BenchmarkParallel FS.PutObject() for object size of 1MB. func BenchmarkParallelPutObject1MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(1024*1024)) + benchmarkPutObjectParallel(b, "FS", 1024*1024) } // BenchmarkParallelPutObject1MbXL - BenchmarkParallel XL.PutObject() for object size of 1MB. func BenchmarkParallelPutObject1MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(1024*1024)) + benchmarkPutObjectParallel(b, "XL", 1024*1024) } // BenchmarkParallelPutObject5MbFS - BenchmarkParallel FS.PutObject() for object size of 5MB. func BenchmarkParallelPutObject5MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(5*1024*1024)) + benchmarkPutObjectParallel(b, "FS", 5*1024*1024) } // BenchmarkParallelPutObject5MbXL - BenchmarkParallel XL.PutObject() for object size of 5MB. func BenchmarkParallelPutObject5MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(5*1024*1024)) + benchmarkPutObjectParallel(b, "XL", 5*1024*1024) } // BenchmarkParallelPutObject10MbFS - BenchmarkParallel FS.PutObject() for object size of 10MB. func BenchmarkParallelPutObject10MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(10*1024*1024)) + benchmarkPutObjectParallel(b, "FS", 10*1024*1024) } // BenchmarkParallelPutObject10MbXL - BenchmarkParallel XL.PutObject() for object size of 10MB. func BenchmarkParallelPutObject10MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(10*1024*1024)) + benchmarkPutObjectParallel(b, "XL", 10*1024*1024) } // BenchmarkParallelPutObject25MbFS - BenchmarkParallel FS.PutObject() for object size of 25MB. func BenchmarkParallelPutObject25MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(25*1024*1024)) + benchmarkPutObjectParallel(b, "FS", 25*1024*1024) } // BenchmarkParallelPutObject25MbXL - BenchmarkParallel XL.PutObject() for object size of 25MB. func BenchmarkParallelPutObject25MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(25*1024*1024)) -} - -// BenchmarkParallelPutObject50MbFS - BenchmarkParallel FS.PutObject() for object size of 50MB. -func BenchmarkParallelPutObject50MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(50*1024*1024)) -} - -// BenchmarkParallelPutObject50MbXL - BenchmarkParallel XL.PutObject() for object size of 50MB. -func BenchmarkParallelPutObject50MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(50*1024*1024)) -} - -// BenchmarkParallelPutObject100MbFS - BenchmarkParallel FS.PutObject() for object size of 100MB. -func BenchmarkParallelPutObject100MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(100*1024*1024)) -} - -// BenchmarkParallelPutObject100MbXL - BenchmarkParallel XL.PutObject() for object size of 100MB. -func BenchmarkParallelPutObject100MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(100*1024*1024)) -} - -// BenchmarkParallelPutObject200MbFS - BenchmarkParallel FS.PutObject() for object size of 200MB. -func BenchmarkParallelPutObject200MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(200*1024*1024)) -} - -// BenchmarkParallelPutObject200MbXL - BenchmarkParallel XL.PutObject() for object size of 200MB. -func BenchmarkParallelPutObject200MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(200*1024*1024)) -} - -// BenchmarkParallelPutObject500MbFS - BenchmarkParallel FS.PutObject() for object size of 500MB. -func BenchmarkParallelPutObject500MbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(500*1024*1024)) -} - -// BenchmarkParallelPutObject500MbXL - BenchmarkParallel XL.PutObject() for object size of 500MB. -func BenchmarkParallelPutObject500MbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(500*1024*1024)) -} - -// BenchmarkParallelPutObject1GbFS - BenchmarkParallel FS.PutObject() for object size of 1GB. -func BenchmarkParallelPutObject1GbFS(b *testing.B) { - benchmarkPutObject(b, "FS", returnPutObjectBenchmarkParallel(1024*1024*1024)) -} - -// BenchmarkParallelPutObjectGbXL - BenchmarkParallel XL.PutObject() for object size of 1GB. -func BenchmarkParallelPutObject1GbXL(b *testing.B) { - benchmarkPutObject(b, "XL", returnPutObjectBenchmarkParallel(1024*1024*1024)) + benchmarkPutObjectParallel(b, "XL", 25*1024*1024) }