From 79f45131baf81d7ae8fc061ced3cf98b975f0399 Mon Sep 17 00:00:00 2001 From: David Colburn Date: Thu, 19 Dec 2024 12:33:25 -0800 Subject: [PATCH] change max_memory to float (#830) --- pkg/config/service.go | 2 +- pkg/stats/monitor.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/config/service.go b/pkg/config/service.go index 0982202d..c4521bfe 100644 --- a/pkg/config/service.go +++ b/pkg/config/service.go @@ -58,7 +58,7 @@ type ServiceConfig struct { type CPUCostConfig struct { MaxCpuUtilization float64 `yaml:"max_cpu_utilization"` // maximum allowed CPU utilization when deciding to accept a request. Default to 80% - MaxMemory int `yaml:"max_memory"` // maximum allowed memory usage in GB. 0 to disable + MaxMemory float64 `yaml:"max_memory"` // maximum allowed memory usage in GB. 0 to disable MaxConcurrentWeb int32 `yaml:"max_concurrent_web"` // maximum allowed chrome/x/pulse instances RoomCompositeCpuCost float64 `yaml:"room_composite_cpu_cost"` AudioRoomCompositeCpuCost float64 `yaml:"audio_room_composite_cpu_cost"` diff --git a/pkg/stats/monitor.go b/pkg/stats/monitor.go index 41fc1ef9..6088f780 100644 --- a/pkg/stats/monitor.go +++ b/pkg/stats/monitor.go @@ -446,7 +446,7 @@ func (m *Monitor) updateEgressStats(stats *hwstats.ProcStats) { } } - if m.cpuCostConfig.MaxMemory > 0 && totalMemory > m.cpuCostConfig.MaxMemory*gb { + if m.cpuCostConfig.MaxMemory > 0 && totalMemory > int(m.cpuCostConfig.MaxMemory*gb) { logger.Warnw("high memory usage", nil, "memory", float64(totalMemory)/gb, "requests", m.requests.Load(),