SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
Volume range read use sync.pool (#4422)
zemulf352616b7da0
diff --git a/weed/server/common.go b/weed/server/common.goindex ee11227263..d88298402c 100644--- a/weed/server/common.go+++ b/weed/server/common.go@@ -15,6 +15,7 @@ import ("path/filepath""strconv""strings"+ "sync""time""google.golang.org/grpc"@@ -30,6 +31,10 @@ import (var serverStats *stats.ServerStatsvar startTime = time.Now()+var writePool = sync.Pool{New: func() interface{} {+ return bufio.NewWriterSize(nil, 128*1024)+},+}func init() {serverStats = stats.NewServerStats()@@ -279,8 +284,12 @@ func adjustHeaderContentDisposition(w http.ResponseWriter, r *http.Request, filefunc processRangeRequest(r *http.Request, w http.ResponseWriter, totalSize int64, mimeType string, writeFn func(writer io.Writer, offset int64, size int64) error) error {rangeReq := r.Header.Get("Range")- bufferedWriter := bufio.NewWriterSize(w, 128*1024)- defer bufferedWriter.Flush()+ bufferedWriter := writePool.Get().(*bufio.Writer)+ bufferedWriter.Reset(w)+ defer func() {+ bufferedWriter.Flush()+ writePool.Put(bufferedWriter)+ }()if rangeReq == "" {w.Header().Set("Content-Length", strconv.FormatInt(totalSize, 10))