aboutsummaryrefslogtreecommitdiff
path: root/weed/server
diff options
context:
space:
mode:
authorfamosss <zzq09494@ly.com>2022-09-16 15:30:40 +0800
committerGitHub <noreply@github.com>2022-09-16 00:30:40 -0700
commitd949a238b83dc05fe79a1fb02a047a25355feb7b (patch)
tree11cfe94e1ee8c09bfe5f67716987e62e1edc3f39 /weed/server
parentcf90f76a35df8c8509ad3ccece566ecb0b74cf66 (diff)
downloadseaweedfs-d949a238b83dc05fe79a1fb02a047a25355feb7b.tar.xz
seaweedfs-d949a238b83dc05fe79a1fb02a047a25355feb7b.zip
volume: add "readBufSize" option to customize read optimization (#3702)
* simplify a bit * feat: volume: add "readBufSize" option to customize read optimization * refactor : redbufSIze -> readBufferSize * simplify a bit * simplify a bit
Diffstat (limited to 'weed/server')
-rw-r--r--weed/server/volume_server.go3
-rw-r--r--weed/server/volume_server_handlers_read.go5
2 files changed, 6 insertions, 2 deletions
diff --git a/weed/server/volume_server.go b/weed/server/volume_server.go
index 8bf50ce45..07bb0b9ee 100644
--- a/weed/server/volume_server.go
+++ b/weed/server/volume_server.go
@@ -29,6 +29,7 @@ type VolumeServer struct {
inFlightDownloadDataLimitCond *sync.Cond
inflightUploadDataTimeout time.Duration
hasSlowRead bool
+ readBufferSize int
SeedMasterNodes []pb.ServerAddress
currentMaster pb.ServerAddress
@@ -66,6 +67,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
concurrentDownloadLimit int64,
inflightUploadDataTimeout time.Duration,
hasSlowRead bool,
+ readBufferSize int,
) *VolumeServer {
v := util.GetViper()
@@ -96,6 +98,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
concurrentDownloadLimit: concurrentDownloadLimit,
inflightUploadDataTimeout: inflightUploadDataTimeout,
hasSlowRead: hasSlowRead,
+ readBufferSize: readBufferSize,
}
vs.SeedMasterNodes = masterNodes
diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.go
index b8f4120a6..facdf2556 100644
--- a/weed/server/volume_server_handlers_read.go
+++ b/weed/server/volume_server_handlers_read.go
@@ -116,8 +116,9 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
cookie := n.Cookie
readOption := &storage.ReadOption{
- ReadDeleted: r.FormValue("readDeleted") == "true",
- HasSlowRead: vs.hasSlowRead,
+ ReadDeleted: r.FormValue("readDeleted") == "true",
+ HasSlowRead: vs.hasSlowRead,
+ ReadBufferSize: vs.readBufferSize,
}
var count int