diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-10-30 21:22:20 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-10-30 21:22:20 -0700 |
| commit | 8826601be1a5fe563d955b57a51b15d917baa22b (patch) | |
| tree | def9ca688158ad773a3398b6c83d62157b7d9b8a /weed/filesys/wfs.go | |
| parent | be95f68ca744fb3caa5f7e48aff79bc2b233686e (diff) | |
| download | seaweedfs-8826601be1a5fe563d955b57a51b15d917baa22b.tar.xz seaweedfs-8826601be1a5fe563d955b57a51b15d917baa22b.zip | |
mount: optional limit for the number of concurrent writers
Diffstat (limited to 'weed/filesys/wfs.go')
| -rw-r--r-- | weed/filesys/wfs.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index d31579fce..cd14e8032 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -31,6 +31,7 @@ type Option struct { Replication string TtlSec int32 ChunkSizeLimit int64 + ConcurrentWriters int CacheDir string CacheSizeMB int64 DataCenter string @@ -68,6 +69,9 @@ type WFS struct { chunkCache *chunk_cache.TieredChunkCache metaCache *meta_cache.MetaCache signature int32 + + // throttle writers + concurrentWriters *util.LimitedConcurrentExecutor } type statsCache struct { filer_pb.StatisticsResponse @@ -110,6 +114,10 @@ func NewSeaweedFileSystem(option *Option) *WFS { wfs.root = &Dir{name: wfs.option.FilerMountRootPath, wfs: wfs, entry: entry} wfs.fsNodeCache = newFsCache(wfs.root) + if wfs.option.ConcurrentWriters > 0 { + wfs.concurrentWriters = util.NewLimitedConcurrentExecutor(wfs.option.ConcurrentWriters) + } + return wfs } |
