Merge branch 'master' of github.com:chrislusf/weed-fs

This commit is contained in:
Chris Lu 2015-07-11 01:07:12 -07:00
commit 9bf10975bd
4 changed files with 38 additions and 34 deletions

View file

@ -301,58 +301,55 @@ POSIX support
## Benchmark ## Benchmark
My Own Unscientific Single Machine Results on Mac Book with Solid State Disk, CPU: 1 Intel Core i7 2.2GHz. My Own Unscientific Single Machine Results on Mac Book with Solid State Disk, CPU: 1 Intel Core i7 2.6GHz.
Write 1 million 1KB file: Write 1 million 1KB file:
``` ```
Concurrency Level: 64 Concurrency Level: 16
Time taken for tests: 182.456 seconds Time taken for tests: 88.796 seconds
Complete requests: 1048576 Complete requests: 1048576
Failed requests: 0 Failed requests: 0
Total transferred: 1073741824 bytes Total transferred: 1106764659 bytes
Requests per second: 5747.01 [#/sec] Requests per second: 11808.87 [#/sec]
Transfer rate: 5747.01 [Kbytes/sec] Transfer rate: 12172.05 [Kbytes/sec]
Connection Times (ms) Connection Times (ms)
min avg max std min avg max std
Total: 0.3 10.9 430.9 5.7 Total: 0.2 1.3 44.8 0.9
Percentage of the requests served within a certain time (ms) Percentage of the requests served within a certain time (ms)
50% 10.2 ms 50% 1.1 ms
66% 12.0 ms 66% 1.3 ms
75% 12.6 ms 75% 1.5 ms
80% 12.9 ms 80% 1.7 ms
90% 14.0 ms 90% 2.1 ms
95% 14.9 ms 95% 2.6 ms
98% 16.2 ms 98% 3.7 ms
99% 17.3 ms 99% 4.6 ms
100% 430.9 ms 100% 44.8 ms
``` ```
Randomly read 1 million files: Randomly read 1 million files:
``` ```
Concurrency Level: 64 Concurrency Level: 16
Time taken for tests: 80.732 seconds Time taken for tests: 34.263 seconds
Complete requests: 1048576 Complete requests: 1048576
Failed requests: 0 Failed requests: 0
Total transferred: 1073741824 bytes Total transferred: 1106762945 bytes
Requests per second: 12988.37 [#/sec] Requests per second: 30603.34 [#/sec]
Transfer rate: 12988.37 [Kbytes/sec] Transfer rate: 31544.49 [Kbytes/sec]
Connection Times (ms) Connection Times (ms)
min avg max std min avg max std
Total: 0.0 4.7 254.3 6.3 Total: 0.0 0.5 20.7 0.7
Percentage of the requests served within a certain time (ms) Percentage of the requests served within a certain time (ms)
50% 2.6 ms 50% 0.4 ms
66% 2.9 ms 75% 0.5 ms
75% 3.7 ms 95% 0.6 ms
80% 4.7 ms 98% 0.8 ms
90% 10.3 ms 99% 1.2 ms
95% 16.6 ms 100% 20.7 ms
98% 26.3 ms
99% 34.8 ms
100% 254.3 ms
``` ```

View file

@ -120,7 +120,7 @@ func (n *Needle) Append(w io.Writer, version Version) (size uint32, err error) {
return return
} }
} }
if n.HasTtl() { if n.HasTtl() && n.Ttl != nil {
n.Ttl.ToBytes(header[0:TtlBytesLength]) n.Ttl.ToBytes(header[0:TtlBytesLength])
if _, err = w.Write(header[0:TtlBytesLength]); err != nil { if _, err = w.Write(header[0:TtlBytesLength]); err != nil {
return return

View file

@ -152,6 +152,9 @@ func (v *Volume) NeedToReplicate() bool {
// isFileUnchanged checks whether this needle to write is same as last one. // isFileUnchanged checks whether this needle to write is same as last one.
// It requires serialized access in the same volume. // It requires serialized access in the same volume.
func (v *Volume) isFileUnchanged(n *Needle) bool { func (v *Volume) isFileUnchanged(n *Needle) bool {
if v.Ttl == EMPTY_TTL || v.Ttl.String() == "" {
return true
}
nv, ok := v.nm.Get(n.Id) nv, ok := v.nm.Get(n.Id)
if ok && nv.Offset > 0 { if ok && nv.Offset > 0 {
oldNeedle := new(Needle) oldNeedle := new(Needle)

View file

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"os" "os"
"path" "path"
"path/filepath"
"strconv" "strconv"
"strings" "strings"
"text/template" "text/template"
@ -49,7 +50,7 @@ func init() {
var ( var (
output = cmdExport.Flag.String("o", "", "output tar file name, must ends with .tar, or just a \"-\" for stdout") output = cmdExport.Flag.String("o", "", "output tar file name, must ends with .tar, or just a \"-\" for stdout")
format = cmdExport.Flag.String("fileNameFormat", defaultFnFormat, "filename format, default to {{.Mime}}/{{.Id}}:{{.Name}}") format = cmdExport.Flag.String("fileNameFormat", defaultFnFormat, "filename formatted with {{.Mime}} {{.Id}} {{.Name}} {{.Ext}}")
newer = cmdExport.Flag.String("newer", "", "export only files newer than this time, default is all files. Must be specified in RFC3339 without timezone") newer = cmdExport.Flag.String("newer", "", "export only files newer than this time, default is all files. Must be specified in RFC3339 without timezone")
tarOutputFile *tar.Writer tarOutputFile *tar.Writer
@ -159,6 +160,7 @@ type nameParams struct {
Id uint64 Id uint64
Mime string Mime string
Key string Key string
Ext string
} }
func walker(vid storage.VolumeId, n *storage.Needle, version storage.Version) (err error) { func walker(vid storage.VolumeId, n *storage.Needle, version storage.Version) (err error) {
@ -166,10 +168,12 @@ func walker(vid storage.VolumeId, n *storage.Needle, version storage.Version) (e
if tarOutputFile != nil { if tarOutputFile != nil {
fileNameTemplateBuffer.Reset() fileNameTemplateBuffer.Reset()
if err = fileNameTemplate.Execute(fileNameTemplateBuffer, if err = fileNameTemplate.Execute(fileNameTemplateBuffer,
nameParams{Name: string(n.Name), nameParams{
Name: string(n.Name),
Id: n.Id, Id: n.Id,
Mime: string(n.Mime), Mime: string(n.Mime),
Key: key, Key: key,
Ext: filepath.Ext(string(n.Name)),
}, },
); err != nil { ); err != nil {
return err return err