Skip to content

Commit

Permalink
koordlet: support blkio-cost rpct and wpct configuration (koordinator…
Browse files Browse the repository at this point in the history
…-sh#1931)

Signed-off-by: Wang Xiaoqiang <wangxiaoqiang@qiyi.com>
  • Loading branch information
wangxiaoq authored and ls-2018 committed Mar 25, 2024
1 parent ca3c3a9 commit 6369f69
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 5 deletions.
4 changes: 3 additions & 1 deletion apis/configuration/slo_controller_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,9 @@ data:
{
"ioCfg": {
"readLatency": 3000,
"writeLatency": 3000
"writeLatency": 3000,
"readLatencyPercent": 95,
"writeLatencyPercent": 95
},
"name": "ackdistro-pool",
"type": "volumegroup"
Expand Down
8 changes: 8 additions & 0 deletions apis/slo/v1alpha1/nodeslo_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ type IOCfg struct {
ReadLatency *int64 `json:"readLatency,omitempty"`
// the write latency threshold. Unit: microseconds.
WriteLatency *int64 `json:"writeLatency,omitempty"`
// the read latency percentile
// +kubebuilder:validation:Maximum=100
// +kubebuilder:validation:Minimum=0
ReadLatencyPercent *int64 `json:"readLatencyPercent,omitempty"`
// the write latency percentile
// +kubebuilder:validation:Maximum=100
// +kubebuilder:validation:Minimum=0
WriteLatencyPercent *int64 `json:"writeLatencyPercent,omitempty"`
}

type BlockCfg struct {
Expand Down
10 changes: 10 additions & 0 deletions apis/slo/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions config/crd/bases/slo.koordinator.sh_nodeslos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ spec:
Unit: microseconds.'
format: int64
type: integer
readLatencyPercent:
description: the read latency percentile
format: int64
maximum: 100
minimum: 0
type: integer
writeBPS:
format: int64
minimum: 0
Expand All @@ -163,6 +169,12 @@ spec:
microseconds.'
format: int64
type: integer
writeLatencyPercent:
description: the write latency percentile
format: int64
maximum: 100
minimum: 0
type: integer
type: object
name:
type: string
Expand Down Expand Up @@ -428,6 +440,12 @@ spec:
Unit: microseconds.'
format: int64
type: integer
readLatencyPercent:
description: the read latency percentile
format: int64
maximum: 100
minimum: 0
type: integer
writeBPS:
format: int64
minimum: 0
Expand All @@ -441,6 +459,12 @@ spec:
microseconds.'
format: int64
type: integer
writeLatencyPercent:
description: the write latency percentile
format: int64
maximum: 100
minimum: 0
type: integer
type: object
name:
type: string
Expand Down Expand Up @@ -706,6 +730,12 @@ spec:
Unit: microseconds.'
format: int64
type: integer
readLatencyPercent:
description: the read latency percentile
format: int64
maximum: 100
minimum: 0
type: integer
writeBPS:
format: int64
minimum: 0
Expand All @@ -719,6 +749,12 @@ spec:
microseconds.'
format: int64
type: integer
writeLatencyPercent:
description: the write latency percentile
format: int64
maximum: 100
minimum: 0
type: integer
type: object
name:
type: string
Expand Down Expand Up @@ -984,6 +1020,12 @@ spec:
Unit: microseconds.'
format: int64
type: integer
readLatencyPercent:
description: the read latency percentile
format: int64
maximum: 100
minimum: 0
type: integer
writeBPS:
format: int64
minimum: 0
Expand All @@ -997,6 +1039,12 @@ spec:
microseconds.'
format: int64
type: integer
writeLatencyPercent:
description: the write latency percentile
format: int64
maximum: 100
minimum: 0
type: integer
type: object
name:
type: string
Expand Down Expand Up @@ -1272,6 +1320,12 @@ spec:
Unit: microseconds.'
format: int64
type: integer
readLatencyPercent:
description: the read latency percentile
format: int64
maximum: 100
minimum: 0
type: integer
writeBPS:
format: int64
minimum: 0
Expand All @@ -1285,6 +1339,12 @@ spec:
microseconds.'
format: int64
type: integer
writeLatencyPercent:
description: the write latency percentile
format: int64
maximum: 100
minimum: 0
type: integer
type: object
name:
type: string
Expand Down
14 changes: 12 additions & 2 deletions pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const (
DefaultWriteBPS = 0
DefaultIOWeightPercentage = 100
DefaultIOLatency = 3000
DefaultLatencyPercent = 95
)

var _ framework.QOSStrategy = &blkIOReconcile{}
Expand Down Expand Up @@ -420,6 +421,7 @@ func (b *blkIOReconcile) getDiskNumberFromBlockCfg(block *slov1alpha1.BlockCfg,
// dynamicPath for root: ""
func getDiskConfigUpdaterFromBlockCfg(block *slov1alpha1.BlockCfg, diskNumber string, dynamicPath string) (resources []resourceexecutor.ResourceUpdater) {
var readlat, writelat int64 = DefaultIOLatency, DefaultIOLatency
var readlatPercent, writelatPercent int64 = DefaultLatencyPercent, DefaultLatencyPercent
// disk io weight latency
if value := block.IOCfg.ReadLatency; value != nil {
readlat = *value
Expand All @@ -428,11 +430,19 @@ func getDiskConfigUpdaterFromBlockCfg(block *slov1alpha1.BlockCfg, diskNumber st
writelat = *value
}

// disk io latency percent
if value := block.IOCfg.ReadLatencyPercent; value != nil {
readlatPercent = *value
}
if value := block.IOCfg.WriteLatencyPercent; value != nil {
writelatPercent = *value
}

ioQoSUpdater, _ := resourceexecutor.NewBlkIOResourceUpdater(
system.BlkioIOQoSName,
dynamicPath,
fmt.Sprintf("%s enable=1 ctrl=user rlat=%d wlat=%d", diskNumber, readlat, writelat),
audit.V(3).Group("blkio").Reason("UpdateBlkIO").Message("update %s/%s to %s", dynamicPath, system.BlkioIOQoSName, fmt.Sprintf("%s enable=1 ctrl=user rlat=%d wlat=%d", diskNumber, readlat, writelat)),
fmt.Sprintf("%s enable=1 ctrl=user rpct=%d rlat=%d wpct=%d wlat=%d", diskNumber, readlatPercent, readlat, writelatPercent, writelat),
audit.V(3).Group("blkio").Reason("UpdateBlkIO").Message("update %s/%s to %s", dynamicPath, system.BlkioIOQoSName, fmt.Sprintf("%s enable=1 ctrl=user rpct=%d rlat=%d wpct=%d wlat=%d", diskNumber, readlatPercent, readlat, writelatPercent, writelat)),
)

resources = append(resources, ioQoSUpdater)
Expand Down
6 changes: 4 additions & 2 deletions pkg/koordlet/qosmanager/plugins/blkio/blkio_reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,10 @@ func newNodeSLO() *slov1alpha1.NodeSLO {
Name: "/dev/vdb",
BlockType: slov1alpha1.BlockTypeDevice,
IOCfg: slov1alpha1.IOCfg{
ReadLatency: pointer.Int64(1000),
WriteLatency: pointer.Int64(1000),
ReadLatency: pointer.Int64(1000),
WriteLatency: pointer.Int64(1000),
ReadLatencyPercent: pointer.Int64(90),
WriteLatencyPercent: pointer.Int64(90),
},
},
},
Expand Down

0 comments on commit 6369f69

Please sign in to comment.