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
exclude replication from the concurrentUploadLimitMB
liubaojiang1a41691b4c17
diff --git a/weed/server/volume_server.go b/weed/server/volume_server.goindex 477a3709cf..e557cf76bc 100644--- a/weed/server/volume_server.go+++ b/weed/server/volume_server.go@@ -24,6 +24,7 @@ type VolumeServer struct {inFlightDownloadDataSize int64concurrentUploadLimit int64concurrentDownloadLimit int64+ inFlightUploadDataLimitCond *sync.CondinFlightDownloadDataLimitCond *sync.CondSeedMasterNodes []pb.ServerAddress@@ -84,6 +85,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,fileSizeLimitBytes: int64(fileSizeLimitMB) * 1024 * 1024,isHeartbeating: true,stopChan: make(chan bool),+ inFlightUploadDataLimitCond: sync.NewCond(new(sync.Mutex)),inFlightDownloadDataLimitCond: sync.NewCond(new(sync.Mutex)),concurrentUploadLimit: concurrentUploadLimit,concurrentDownloadLimit: concurrentDownloadLimit,diff --git a/weed/server/volume_server_handlers.go b/weed/server/volume_server_handlers.goindex 49bc297fbb..afd32fed43 100644--- a/weed/server/volume_server_handlers.go+++ b/weed/server/volume_server_handlers.go@@ -1,7 +1,6 @@package weed_serverimport (- "fmt""net/http""strconv""strings"@@ -60,13 +59,15 @@ func (vs *VolumeServer) privateStoreHandler(w http.ResponseWriter, r *http.RequecontentLength := getContentLength(r)// exclude the replication from the concurrentUploadLimitMB- if vs.concurrentUploadLimit != 0 && r.URL.Query().Get("type") != "replicate" &&- atomic.LoadInt64(&vs.inFlightUploadDataSize) > vs.concurrentUploadLimit {- err := fmt.Errorf("reject because inflight upload data %d > %d", vs.inFlightUploadDataSize, vs.concurrentUploadLimit)- glog.V(1).Infof("too many requests: %v", err)- writeJsonError(w, r, http.StatusTooManyRequests, err)- return+ if r.URL.Query().Get("type") != "replicate" { //Non-Replication+ vs.inFlightUploadDataLimitCond.L.Lock()+ for vs.concurrentUploadLimit != 0 && atomic.LoadInt64(&vs.inFlightUploadDataSize) > vs.concurrentUploadLimit {+ glog.V(4).Infof("wait because inflight upload data %d > %d", vs.inFlightUploadDataSize, vs.concurrentUploadLimit)+ vs.inFlightUploadDataLimitCond.Wait()+ }+ vs.inFlightUploadDataLimitCond.L.Unlock()}+atomic.AddInt64(&vs.inFlightUploadDataSize, contentLength)defer func() {atomic.AddInt64(&vs.inFlightUploadDataSize, -contentLength)