Skip to content

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.

volume server: rename readBufferSize to readBufferSizeMB

chrislu10d5b4b32bb6
diff --git a/weed/command/server.go b/weed/command/server.go
index 78b52ea4ba..f92feb11da 100644
--- a/weed/command/server.go
+++ b/weed/command/server.go
@@ -132,7 +132,7 @@ func init() {
serverOptions.v.idxFolder = cmdServer.Flag.String("volume.dir.idx", "", "directory to store .idx files")
serverOptions.v.inflightUploadDataTimeout = cmdServer.Flag.Duration("volume.inflightUploadDataTimeout", 60*time.Second, "inflight upload data wait timeout of volume servers")
serverOptions.v.hasSlowRead = cmdServer.Flag.Bool("volume.hasSlowRead", false, "<experimental> if true, this prevents slow reads from blocking other requests, but large file read P99 latency will increase.")
- serverOptions.v.readBufferSize = cmdServer.Flag.Int("volume.readBufferSize", 1024 * 1024, "<experimental> larger values can optimize query performance but will increase some memory usage,Use with hasSlowRead normally")
+ serverOptions.v.readBufferSizeMB = cmdServer.Flag.Int("volume.readBufferSizeMB", 4, "<experimental> larger values can optimize query performance but will increase some memory usage,Use with hasSlowRead normally")
s3Options.port = cmdServer.Flag.Int("s3.port", 8333, "s3 server http listen port")
s3Options.portGrpc = cmdServer.Flag.Int("s3.port.grpc", 0, "s3 server grpc listen port")
diff --git a/weed/command/volume.go b/weed/command/volume.go
index 5b62a48442..24945d0e31 100644
--- a/weed/command/volume.go
+++ b/weed/command/volume.go
@@ -67,7 +67,7 @@ type VolumeServerOptions struct {
// pulseSeconds *int
inflightUploadDataTimeout *time.Duration
hasSlowRead *bool
- readBufferSize *int
+ readBufferSizeMB *int
}
func init() {
@@ -99,7 +99,7 @@ func init() {
v.idxFolder = cmdVolume.Flag.String("dir.idx", "", "directory to store .idx files")
v.inflightUploadDataTimeout = cmdVolume.Flag.Duration("inflightUploadDataTimeout", 60*time.Second, "inflight upload data wait timeout of volume servers")
v.hasSlowRead = cmdVolume.Flag.Bool("hasSlowRead", false, "<experimental> if true, this prevents slow reads from blocking other requests, but large file read P99 latency will increase.")
- v.readBufferSize = cmdVolume.Flag.Int("readBufferSize", 1024 * 1024, "<experimental> larger values can optimize query performance but will increase some memory usage,Use with hasSlowRead normally.")
+ v.readBufferSizeMB = cmdVolume.Flag.Int("readBufferSizeMB", 4, "<experimental> larger values can optimize query performance but will increase some memory usage,Use with hasSlowRead normally.")
}
var cmdVolume = &Command{
@@ -248,7 +248,7 @@ func (v VolumeServerOptions) startVolumeServer(volumeFolders, maxVolumeCounts, v
int64(*v.concurrentDownloadLimitMB)*1024*1024,
*v.inflightUploadDataTimeout,
*v.hasSlowRead,
- *v.readBufferSize,
+ *v.readBufferSizeMB,
)
// starting grpc server
grpcS := v.startGrpcService(volumeServer)
diff --git a/weed/server/volume_server.go b/weed/server/volume_server.go
index 07bb0b9ee0..8e20b0846d 100644
--- a/weed/server/volume_server.go
+++ b/weed/server/volume_server.go
@@ -29,7 +29,7 @@ type VolumeServer struct {
inFlightDownloadDataLimitCond *sync.Cond
inflightUploadDataTimeout time.Duration
hasSlowRead bool
- readBufferSize int
+ readBufferSizeMB int
SeedMasterNodes []pb.ServerAddress
currentMaster pb.ServerAddress
@@ -67,7 +67,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
concurrentDownloadLimit int64,
inflightUploadDataTimeout time.Duration,
hasSlowRead bool,
- readBufferSize int,
+ readBufferSizeMB int,
) *VolumeServer {
v := util.GetViper()
@@ -98,7 +98,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
concurrentDownloadLimit: concurrentDownloadLimit,
inflightUploadDataTimeout: inflightUploadDataTimeout,
hasSlowRead: hasSlowRead,
- readBufferSize: readBufferSize,
+ readBufferSizeMB: readBufferSizeMB,
}
vs.SeedMasterNodes = masterNodes
diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.go
index facdf25566..8ad526d59e 100644
--- a/weed/server/volume_server_handlers_read.go
+++ b/weed/server/volume_server_handlers_read.go
@@ -118,7 +118,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
readOption := &storage.ReadOption{
ReadDeleted: r.FormValue("readDeleted") == "true",
HasSlowRead: vs.hasSlowRead,
- ReadBufferSize: vs.readBufferSize,
+ ReadBufferSize: vs.readBufferSizeMB * 1024 * 1024,
}
var count int