aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/s3concurrent
diff options
context:
space:
mode:
Diffstat (limited to 'benchmarks/s3concurrent')
-rw-r--r--benchmarks/s3concurrent/main.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/benchmarks/s3concurrent/main.go b/benchmarks/s3concurrent/main.go
index 9f7f3af..55d7b3d 100644
--- a/benchmarks/s3concurrent/main.go
+++ b/benchmarks/s3concurrent/main.go
@@ -3,6 +3,8 @@ package main
import (
"context"
"crypto/tls"
+ "fmt"
+ "time"
"io"
"log"
"math/rand"
@@ -99,24 +101,32 @@ func main() {
}
log.Printf("created bucket %s\n", buck)
+ fmt.Println("sent,success,elapsed,elapsed_per_req")
+
// Send to bucket
for i := 1; i <= 16; i++ {
log.Printf("start concurrent loop with %d coroutines\n", i)
syn := make(chan error)
+
+ start := time.Now()
for j := 1; j <= i; j++ {
go func() {
syn <- putObj(buck, 1024*1024)
}()
}
+ errCount := 0
for j := 1; j <= i; j++ {
cerr := <-syn
if cerr != nil {
+ errCount += 1
log.Printf("%d/%d failed with %s\n", j, i, cerr)
}
}
+ elapsed := time.Since(start)
+ fmt.Printf("%d,%d,%v,%v\n", i, i - errCount, elapsed.Nanoseconds(), elapsed.Nanoseconds() / int64(i))
log.Printf("done, %d coroutines returned\n", i)
}
- log.Println("done")
+ log.Println("bench done")
}