• sunjiapeng's avatar
    Fix sync.Pool leak · 4a0e6eb5
    sunjiapeng authored
    There is a sync.Pool leak in server.go, which triggers in case of
    multi-threaded loads.
    
    Benchmarks:
    
    env: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz (8core 16procs)
    go test -bench="BenchmarkGoFuseRead" -benchmem
    
    old:
    
    2       10992 92501 ns/op 22671.71 MB/s 536981 B/op 196 allocs/op
    4       19068 57959 ns/op 36183.44 MB/s 151877 B/op 170 allocs/op
    8       27729 43796 ns/op 47884.39 MB/s 29068 B/op 162 allocs/op
    16      28674 41403 ns/op 50651.65 MB/s 6704 B/op 160 allocs/op
    
    fixed:
    
    2       23667 46589 ns/op 45014.20 MB/s 5357 B/op 167 allocs/op
    4       27753 42327 ns/op 49546.77 MB/s 4999 B/op 161 allocs/op
    8       29648 40806 ns/op 51392.81 MB/s 4904 B/op 160 allocs/op
    16      29389 40763 ns/op 51447.07 MB/s 4848 B/op 160 allocs/op
    
    Change-Id: I062928203df5603ebca04c08c4d428d385f99c2c
    4a0e6eb5
server.go 23.6 KB