Write request id to first 8 bytes of a file, instead of whole file, for
better write performance.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VERSION = "0.64"
|
VERSION = "0.66"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ type BenchmarkOptions struct {
|
|||||||
sequentialRead *bool
|
sequentialRead *bool
|
||||||
collection *string
|
collection *string
|
||||||
cpuprofile *string
|
cpuprofile *string
|
||||||
|
maxCpu *int
|
||||||
vid2server map[string]string //cache for vid locations
|
vid2server map[string]string //cache for vid locations
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,7 +52,8 @@ func init() {
|
|||||||
b.read = cmdBenchmark.Flag.Bool("read", true, "enable read")
|
b.read = cmdBenchmark.Flag.Bool("read", true, "enable read")
|
||||||
b.sequentialRead = cmdBenchmark.Flag.Bool("readSequentially", false, "randomly read by ids from \"-list\" specified file")
|
b.sequentialRead = cmdBenchmark.Flag.Bool("readSequentially", false, "randomly read by ids from \"-list\" specified file")
|
||||||
b.collection = cmdBenchmark.Flag.String("collection", "benchmark", "write data to this collection")
|
b.collection = cmdBenchmark.Flag.String("collection", "benchmark", "write data to this collection")
|
||||||
b.cpuprofile = cmdBenchmark.Flag.String("cpuprofile", "", "write cpu profile to 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.vid2server = make(map[string]string)
|
b.vid2server = make(map[string]string)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +102,10 @@ func init() {
|
|||||||
|
|
||||||
func runbenchmark(cmd *Command, args []string) bool {
|
func runbenchmark(cmd *Command, args []string) bool {
|
||||||
fmt.Printf("This is Seaweed File System version %s %s %s\n", util.VERSION, runtime.GOOS, runtime.GOARCH)
|
fmt.Printf("This is Seaweed File System version %s %s %s\n", util.VERSION, runtime.GOOS, runtime.GOARCH)
|
||||||
|
if *b.maxCpu < 1 {
|
||||||
|
*b.maxCpu = runtime.NumCPU()
|
||||||
|
}
|
||||||
|
runtime.GOMAXPROCS(*b.maxCpu)
|
||||||
if *b.cpuprofile != "" {
|
if *b.cpuprofile != "" {
|
||||||
f, err := os.Create(*b.cpuprofile)
|
f, err := os.Create(*b.cpuprofile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -497,9 +503,9 @@ func (l *FakeReader) Read(p []byte) (n int, err error) {
|
|||||||
} else {
|
} else {
|
||||||
n = len(p)
|
n = len(p)
|
||||||
}
|
}
|
||||||
for i := 0; i < n-8; i += 8 {
|
if n >= 8 {
|
||||||
for s := uint(0); s < 8; s++ {
|
for i := 0; i < 8; i++ {
|
||||||
p[i] = byte(l.id >> (s * 8))
|
p[i] = byte(l.id >> uint(i*8))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l.size -= int64(n)
|
l.size -= int64(n)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
serverOptions.cpuprofile = cmdServer.Flag.String("cpuprofile", "", "write cpu profile to file")
|
serverOptions.cpuprofile = cmdServer.Flag.String("cpuprofile", "", "cpu profile output file")
|
||||||
filerOptions.master = cmdServer.Flag.String("filer.master", "", "default to current master server")
|
filerOptions.master = cmdServer.Flag.String("filer.master", "", "default to current master server")
|
||||||
filerOptions.collection = cmdServer.Flag.String("filer.collection", "", "all data will be stored in this collection")
|
filerOptions.collection = cmdServer.Flag.String("filer.collection", "", "all data will be stored in this collection")
|
||||||
filerOptions.port = cmdServer.Flag.Int("filer.port", 8888, "filer server http listen port")
|
filerOptions.port = cmdServer.Flag.Int("filer.port", 8888, "filer server http listen port")
|
||||||
|
|||||||
Reference in New Issue
Block a user