From 1ea2244c8c207a195d95a2c0f85b8a9a4e5ee9b1 Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Mon, 19 Sep 2022 12:37:25 +0200 Subject: Update s3concurrent --- benchmarks/s3concurrent/main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'benchmarks') 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") } -- cgit v1.2.3