aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/s3concurrent/main.go
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-09-19 12:37:25 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-09-19 12:37:25 +0200
commit1ea2244c8c207a195d95a2c0f85b8a9a4e5ee9b1 (patch)
tree1308b1ab7d3774abf92ee44d39dcdae02446157b /benchmarks/s3concurrent/main.go
parent12764a020a4171eee738b1e2a8a3d5340f4da7a1 (diff)
downloadmknet-1ea2244c8c207a195d95a2c0f85b8a9a4e5ee9b1.tar.gz
mknet-1ea2244c8c207a195d95a2c0f85b8a9a4e5ee9b1.zip
Update s3concurrent
Diffstat (limited to 'benchmarks/s3concurrent/main.go')
-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")
}