Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update cpu check log #587

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions pkg/stats/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,24 +300,27 @@ func (m *Monitor) canAcceptRequestLocked(req *rpc.StartEgressRequest) bool {
available = total - used - (total * (1 - m.cpuCostConfig.MaxCpuUtilization))
}

logger.Debugw("cpu check",
"total", total,
"available", available,
"active_requests", m.requests,
)

var required float64
switch req.Request.(type) {
case *rpc.StartEgressRequest_RoomComposite:
accept = available >= m.cpuCostConfig.RoomCompositeCpuCost
required = m.cpuCostConfig.RoomCompositeCpuCost
case *rpc.StartEgressRequest_Web:
accept = available >= m.cpuCostConfig.WebCpuCost
required = m.cpuCostConfig.WebCpuCost
case *rpc.StartEgressRequest_Participant:
accept = available >= m.cpuCostConfig.ParticipantCpuCost
required = m.cpuCostConfig.ParticipantCpuCost
case *rpc.StartEgressRequest_TrackComposite:
accept = available >= m.cpuCostConfig.TrackCompositeCpuCost
required = m.cpuCostConfig.TrackCompositeCpuCost
case *rpc.StartEgressRequest_Track:
accept = available >= m.cpuCostConfig.TrackCpuCost
required = m.cpuCostConfig.TrackCpuCost
}
accept = available >= required

logger.Debugw("cpu check",
"available", available,
"required", required,
"activeRequests", m.requests,
"canAccept", accept,
)

return accept
}
Expand Down