mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add fsync option for benchmark
This commit is contained in:
parent
ea809a45ab
commit
d819865fe7
|
@ -42,6 +42,7 @@ type BenchmarkOptions struct {
|
||||||
grpcDialOption grpc.DialOption
|
grpcDialOption grpc.DialOption
|
||||||
masterClient *wdclient.MasterClient
|
masterClient *wdclient.MasterClient
|
||||||
grpcRead *bool
|
grpcRead *bool
|
||||||
|
fsync *bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -67,6 +68,7 @@ func init() {
|
||||||
b.cpuprofile = cmdBenchmark.Flag.String("cpuprofile", "", "cpu profile output file")
|
b.cpuprofile = cmdBenchmark.Flag.String("cpuprofile", "", "cpu profile output file")
|
||||||
b.maxCpu = cmdBenchmark.Flag.Int("maxCpu", 0, "maximum number of CPUs. 0 means all available CPUs")
|
b.maxCpu = cmdBenchmark.Flag.Int("maxCpu", 0, "maximum number of CPUs. 0 means all available CPUs")
|
||||||
b.grpcRead = cmdBenchmark.Flag.Bool("grpcRead", false, "use grpc API to read")
|
b.grpcRead = cmdBenchmark.Flag.Bool("grpcRead", false, "use grpc API to read")
|
||||||
|
b.fsync = cmdBenchmark.Flag.Bool("fsync", false, "flush data to disk after write")
|
||||||
sharedBytes = make([]byte, 1024)
|
sharedBytes = make([]byte, 1024)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,6 +232,7 @@ func writeFiles(idChan chan int, fileIdLineChan chan string, s *stat) {
|
||||||
Reader: &FakeReader{id: uint64(id), size: fileSize, random: random},
|
Reader: &FakeReader{id: uint64(id), size: fileSize, random: random},
|
||||||
FileSize: fileSize,
|
FileSize: fileSize,
|
||||||
MimeType: "image/bench", // prevent gzip benchmark content
|
MimeType: "image/bench", // prevent gzip benchmark content
|
||||||
|
Fsync: *b.fsync,
|
||||||
}
|
}
|
||||||
ar := &operation.VolumeAssignRequest{
|
ar := &operation.VolumeAssignRequest{
|
||||||
Count: 1,
|
Count: 1,
|
||||||
|
|
|
@ -27,6 +27,7 @@ type FilePart struct {
|
||||||
Ttl string
|
Ttl string
|
||||||
Server string //this comes from assign result
|
Server string //this comes from assign result
|
||||||
Fid string //this comes from assign result, but customizable
|
Fid string //this comes from assign result, but customizable
|
||||||
|
Fsync bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type SubmitResult struct {
|
type SubmitResult struct {
|
||||||
|
@ -116,6 +117,9 @@ func (fi FilePart) Upload(maxMB int, master string, usePublicUrl bool, jwt secur
|
||||||
if fi.ModTime != 0 {
|
if fi.ModTime != 0 {
|
||||||
fileUrl += "?ts=" + strconv.Itoa(int(fi.ModTime))
|
fileUrl += "?ts=" + strconv.Itoa(int(fi.ModTime))
|
||||||
}
|
}
|
||||||
|
if fi.Fsync {
|
||||||
|
fileUrl += "?fsync=true"
|
||||||
|
}
|
||||||
if closer, ok := fi.Reader.(io.Closer); ok {
|
if closer, ok := fi.Reader.(io.Closer); ok {
|
||||||
defer closer.Close()
|
defer closer.Close()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue