diff options
| author | Chris Lu <chris.lu@uber.com> | 2021-03-30 02:10:50 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@uber.com> | 2021-03-30 02:10:53 -0700 |
| commit | ac875976c0731597ae3df324e71b7ec2b8b4b83d (patch) | |
| tree | 44b9f8513d46b9748a4d810b957d27621b9da004 /weed/server/volume_server.go | |
| parent | a1e18a1384fa9bb6223471a7ac843884056392e2 (diff) | |
| download | seaweedfs-ac875976c0731597ae3df324e71b7ec2b8b4b83d.tar.xz seaweedfs-ac875976c0731597ae3df324e71b7ec2b8b4b83d.zip | |
filer, volume: add concurrent upload size limit to avoid OOM
add some back pressure when writes are slow
Diffstat (limited to 'weed/server/volume_server.go')
| -rw-r--r-- | weed/server/volume_server.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/weed/server/volume_server.go b/weed/server/volume_server.go index e496b1ce2..e11d607a4 100644 --- a/weed/server/volume_server.go +++ b/weed/server/volume_server.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/chrislusf/seaweedfs/weed/storage/types" "net/http" + "sync" "google.golang.org/grpc" @@ -34,6 +35,10 @@ type VolumeServer struct { fileSizeLimitBytes int64 isHeartbeating bool stopChan chan bool + + inFlightDataSize int64 + inFlightDataLimitCond *sync.Cond + concurrentUploadLimit int64 } func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string, @@ -48,6 +53,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string, readRedirect bool, compactionMBPerSecond int, fileSizeLimitMB int, + concurrentUploadLimit int64, ) *VolumeServer { v := util.GetViper() @@ -72,6 +78,8 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string, fileSizeLimitBytes: int64(fileSizeLimitMB) * 1024 * 1024, isHeartbeating: true, stopChan: make(chan bool), + inFlightDataLimitCond: sync.NewCond(new(sync.Mutex)), + concurrentUploadLimit: concurrentUploadLimit, } vs.SeedMasterNodes = masterNodes |
