mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(blobnode): qos limit read io concurrence overload
@formatter:off Signed-off-by: mawei029 <mawei2@oppo.com>
This commit is contained in:
parent
0ef70c8d48
commit
b7c1606fa2
@ -36,6 +36,8 @@ type Qos interface {
|
||||
Reader(context.Context, bnapi.IOType, io.Reader) io.Reader
|
||||
TryAllow(rwType IOTypeRW) bool
|
||||
Release(rwType IOTypeRW)
|
||||
TryAcquireIO(ctx context.Context, chunkId uint64, rwType IOTypeRW) bool
|
||||
ReleaseIO(chunkId uint64, rwType IOTypeRW)
|
||||
ResetQosLimit(Config)
|
||||
GetConfig() Config
|
||||
Close()
|
||||
|
||||
@ -415,11 +415,6 @@ func (cd *datafile) Read(ctx context.Context, shard *core.Shard, from, to uint32
|
||||
return nil, bloberr.ErrInvalidParam
|
||||
}
|
||||
|
||||
if !cd.qosAllow(ctx, qos.IOTypeRead) { // If there is too much io, it will discard some low-priority io
|
||||
return nil, bloberr.ErrOverload
|
||||
}
|
||||
defer cd.qosRelease(qos.IOTypeRead)
|
||||
|
||||
// skip header
|
||||
pos := shard.Offset + core.GetShardHeaderSize()
|
||||
|
||||
|
||||
@ -104,6 +104,13 @@ func (s *Service) ShardGet(c *rpc.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
qosLmt := ds.GetIoQos()
|
||||
if !qosLmt.TryAcquireIO(ctx, uint64(args.Vuid), qos.IOTypeRead) {
|
||||
c.RespondError(bloberr.ErrOverload)
|
||||
return
|
||||
}
|
||||
defer qosLmt.ReleaseIO(uint64(args.Vuid), qos.IOTypeRead)
|
||||
|
||||
// build shard reader
|
||||
shard := core.NewShardReader(args.Bid, args.Vuid, from, to, w)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user