projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
12416: Merge Put() into PutReader().
[arvados.git]
/
tools
/
keep-exercise
/
keep-exercise.go
diff --git
a/tools/keep-exercise/keep-exercise.go
b/tools/keep-exercise/keep-exercise.go
index 4131d752b85144d6ed95c1f5989ade92086f1c92..6c8a866291b10ca0efcff8e7d9f50ca6d727703b 100644
(file)
--- a/
tools/keep-exercise/keep-exercise.go
+++ b/
tools/keep-exercise/keep-exercise.go
@@
-1,3
+1,7
@@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
// Testing tool for Keep services.
//
// keepexercise helps measure throughput and test reliability under
// Testing tool for Keep services.
//
// keepexercise helps measure throughput and test reliability under
@@
-21,6
+25,7
@@
import (
"io"
"io/ioutil"
"log"
"io"
"io/ioutil"
"log"
+ "net/http"
"time"
"git.curoverse.com/arvados.git/sdk/go/arvadosclient"
"time"
"git.curoverse.com/arvados.git/sdk/go/arvadosclient"
@@
-52,15
+57,21
@@
func main() {
log.Fatal(err)
}
kc.Want_replicas = *Replicas
log.Fatal(err)
}
kc.Want_replicas = *Replicas
- kc.Client.Timeout = 10 * time.Minute
+
+ transport := *(http.DefaultTransport.(*http.Transport))
+ transport.TLSClientConfig = arvadosclient.MakeTLSConfig(arv.ApiInsecure)
+ kc.HTTPClient = &http.Client{
+ Timeout: 10 * time.Minute,
+ Transport: &transport,
+ }
overrideServices(kc)
overrideServices(kc)
- nextBuf := make(chan []byte, *WriteThreads)
nextLocator := make(chan string, *ReadThreads+*WriteThreads)
go countBeans(nextLocator)
for i := 0; i < *WriteThreads; i++ {
nextLocator := make(chan string, *ReadThreads+*WriteThreads)
go countBeans(nextLocator)
for i := 0; i < *WriteThreads; i++ {
+ nextBuf := make(chan []byte, 1)
go makeBufs(nextBuf, i)
go doWrites(kc, nextBuf, nextLocator)
}
go makeBufs(nextBuf, i)
go doWrites(kc, nextBuf, nextLocator)
}
@@
-106,23
+117,28
@@
func countBeans(nextLocator chan string) {
}
}
}
}
-func makeBufs(nextBuf chan []byte, threadID int) {
+func makeBufs(nextBuf chan
<-
[]byte, threadID int) {
buf := make([]byte, *BlockSize)
if *VaryThread {
binary.PutVarint(buf, int64(threadID))
}
buf := make([]byte, *BlockSize)
if *VaryThread {
binary.PutVarint(buf, int64(threadID))
}
+ randSize := 524288
+ if randSize > *BlockSize {
+ randSize = *BlockSize
+ }
for {
if *VaryRequest {
for {
if *VaryRequest {
-
buf = make([]byte, *Block
Size)
- if _, err := io.ReadFull(rand.Reader,
buf
); err != nil {
+
rnd := make([]byte, rand
Size)
+ if _, err := io.ReadFull(rand.Reader,
rnd
); err != nil {
log.Fatal(err)
}
log.Fatal(err)
}
+ buf = append(rnd, buf[randSize:]...)
}
nextBuf <- buf
}
}
}
nextBuf <- buf
}
}
-func doWrites(kc *keepclient.KeepClient, nextBuf
chan []byte, nextLocator chan
string) {
+func doWrites(kc *keepclient.KeepClient, nextBuf
<-chan []byte, nextLocator chan<-
string) {
for buf := range nextBuf {
locator, _, err := kc.PutB(buf)
if err != nil {
for buf := range nextBuf {
locator, _, err := kc.PutB(buf)
if err != nil {
@@
-139,7
+155,7
@@
func doWrites(kc *keepclient.KeepClient, nextBuf chan []byte, nextLocator chan s
}
}
}
}
-func doReads(kc *keepclient.KeepClient, nextLocator chan string) {
+func doReads(kc *keepclient.KeepClient, nextLocator
<-
chan string) {
for locator := range nextLocator {
rdr, size, url, err := kc.Get(locator)
if err != nil {
for locator := range nextLocator {
rdr, size, url, err := kc.Get(locator)
if err != nil {