Skip to content

Commit

Permalink
wip - write amp accounting
Browse files Browse the repository at this point in the history
  • Loading branch information
aadityasondhi committed Aug 16, 2024
1 parent a5b8e0c commit efbd816
Show file tree
Hide file tree
Showing 12 changed files with 283 additions and 551 deletions.
9 changes: 9 additions & 0 deletions pkg/kv/kvserver/kvadmission/kvadmission.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,15 @@ var ProvisionedBandwidth = settings.RegisterByteSizeSetting(
0,
settings.WithPublic)

// ElasticBandwidthMaxUtil sets the max utilization for disk bandwidth for elastic traffic.
var ElasticBandwidthMaxUtil = settings.RegisterFloatSetting(
settings.SystemOnly, "kvadmission.store.elastic_disk_bandwidth_max_util",
"sets the max utilization for disk bandwidth for elastic traffic",
0.9,
settings.NonNegativeFloatWithMaximum(1.0),
settings.FloatWithMinimum(0.05),
)

// FlowTokenDropInterval determines the frequency at which we check for pending
// flow token dispatches to nodes we're no longer connected to, in order to drop
// them.
Expand Down
11 changes: 7 additions & 4 deletions pkg/util/admission/admission.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,14 @@ type granterWithIOTokens interface {
setAvailableTokens(
ioTokens int64, elasticIOTokens int64, elasticDiskBandwidthTokens int64,
ioTokensCapacity int64, elasticIOTokenCapacity int64, elasticDiskBandwidthTokensCapacity int64,
lastTick bool,
estimatedWriteAmp float64, lastTick bool,
) (tokensUsed int64, tokensUsedByElasticWork int64)
// getDiskTokensUsedAndReset returns the disk bandwidth tokens used
// since the last such call.
getDiskTokensUsedAndReset() [admissionpb.NumWorkClasses]int64
// getDiskTokensUsedAndReset returns the disk bandwidth tokens actually used
// and the tokens requested since the last such call.
getDiskTokensUsedAndReset() (
requestedTokens [admissionpb.NumWorkClasses]diskTokens,
usedTokens [admissionpb.NumWorkClasses]diskTokens,
)
// setLinearModels supplies the models to use when storeWriteDone or
// storeReplicatedWorkAdmittedLocked is called, to adjust token consumption.
// Note that these models are not used for token adjustment at admission
Expand Down
Loading

0 comments on commit efbd816

Please sign in to comment.