Optimize FileInfo(Version) transfer (#10775)

File Info decoding, in particular, is showing up as a major 
allocator and time consumer for internode data transfers

Switch to message pack for cross-server transfers:

```
MSGP:

Size: 945 bytes

BenchmarkEncodeFileInfoMsgp-32    	 1558444	       866 ns/op	   1.16 MB/s	       0 B/op	       0 allocs/op
BenchmarkDecodeFileInfoMsgp-32    	  479968	      2487 ns/op	   0.40 MB/s	     848 B/op	      18 allocs/op

GOB:

Size: 1409 bytes

BenchmarkEncodeFileInfoGOB-32    	  333339	      3237 ns/op	   0.31 MB/s	     576 B/op	      19 allocs/op
BenchmarkDecodeFileInfoGOB-32    	   20869	     57837 ns/op	   0.02 MB/s	   16439 B/op	     428 allocs/op
```
This commit is contained in:
Klaus Post
2020-11-02 17:07:52 -08:00
committed by GitHub
parent 86e0d272f3
commit 37749f4623
8 changed files with 1777 additions and 41 deletions
+5 -2
View File
@@ -17,10 +17,11 @@
package cmd
import (
"os"
"time"
)
//go:generate msgp -file=$GOFILE
// VolInfo - represents volume stat information.
type VolInfo struct {
// Name of the volume.
@@ -74,6 +75,8 @@ func (f *FileInfoVersions) forwardPastVersion(v string) {
}
// FileInfo - represents file stat information.
//msgp:tuple FileInfo
// The above means that any added/deleted fields are incompatible.
type FileInfo struct {
// Name of the volume.
Volume string
@@ -105,7 +108,7 @@ type FileInfo struct {
Size int64
// File mode bits.
Mode os.FileMode
Mode uint32
// File metadata
Metadata map[string]string