Skip to content

Commit 6023213

Browse files
kfswainnirrozenbaum
authored andcommitted
Small updates to logging and adding gorouting for high lock contention work, that doesnt need to block the request goroutine (#1523)
1 parent 5c3284a commit 6023213

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

pkg/epp/scheduling/framework/plugins/multi/prefix/plugin.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,12 @@ func (p *Plugin) PreRequest(ctx context.Context, request *types.LLMRequest, sche
216216
return
217217
}
218218

219-
p.indexer.Add(state.PrefixHashes, ServerID(targetPod.NamespacedName))
219+
// This function is just adding data, it does not need to block other operations.
220+
// TODO: look into making this entire function async, none of this needs to be done in-band
221+
// The PR that introduces this change is meant as a cherrypick, so it was minimally invasive.
222+
go func() {
223+
p.indexer.Add(state.PrefixHashes, ServerID(targetPod.NamespacedName))
224+
}()
220225

221226
total := len(state.PrefixHashes)
222227
matchLen := state.PrefixCacheServers[ServerID(targetPod.NamespacedName)]

pkg/epp/scheduling/framework/plugins/picker/max_score_picker.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ func (p *MaxScorePicker) TypedName() plugins.TypedName {
8282

8383
// Pick selects the pod with the maximum score from the list of candidates.
8484
func (p *MaxScorePicker) Pick(ctx context.Context, cycleState *types.CycleState, scoredPods []*types.ScoredPod) *types.ProfileRunResult {
85-
log.FromContext(ctx).V(logutil.DEBUG).Info(fmt.Sprintf("Selecting maximum '%d' pods from %d candidates sorted by max score: %+v", p.maxNumOfEndpoints,
86-
len(scoredPods), scoredPods))
85+
log.FromContext(ctx).V(logutil.DEBUG).Info("Selecting pods from candidates sorted by max score: ", "NumberOfPods", p.maxNumOfEndpoints,
86+
"scoredPodsLength", len(scoredPods), "scoredPods", scoredPods)
8787

8888
// TODO: merge this with the logic in RandomPicker
8989
// Rand package is not safe for concurrent use, so we create a new instance.

pkg/epp/scheduling/framework/scheduler_profile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func (p *SchedulerProfile) runPickerPlugin(ctx context.Context, cycleState *type
181181
i++
182182
}
183183

184-
loggerDebug.Info("Running picker plugin", "plugin", p.picker.TypedName(), "pods-weighted-score", fmt.Sprint(weightedScorePerPod))
184+
loggerDebug.Info("Running picker plugin", "plugin", p.picker.TypedName(), "pods-weighted-score", weightedScorePerPod)
185185
before := time.Now()
186186
result := p.picker.Pick(ctx, cycleState, scoredPods)
187187
metrics.RecordPluginProcessingLatency(PickerExtensionPoint, p.picker.TypedName().Type, p.picker.TypedName().Name, time.Since(before))

0 commit comments

Comments
 (0)