From 89bf1a232f102a658e568652f9cfd6f102aaabef Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Thu, 2 Oct 2025 11:18:42 +0200 Subject: [PATCH] Remove excessive logging from GET a_c The exceeds_capacity check is a hot spot during get GET allocation_candidates query with multiple request groups. So logging in that function is not practical as it slows down the query and creates such amount of logs that can kill the service itself. Closes-Bug: #2126438 Signed-off-by: Balazs Gibizer Change-Id: I2ac9b587a38e6c8e5b9af705c1e524c131b83214 Signed-off-by: Balazs Gibizer --- placement/objects/research_context.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/placement/objects/research_context.py b/placement/objects/research_context.py index c731a73e9..9ff016e01 100644 --- a/placement/objects/research_context.py +++ b/placement/objects/research_context.py @@ -354,22 +354,16 @@ class RequestWideSearchContext(object): `_consolidate_allocation_requests` method. :return: True if areq exceeds capacity; False otherwise. """ + # This is a hot spot, called potentially a million times during a + # GET allocation_candidates query. Please do not add logging in this + # function permanently as it will cause excessive logging. + for arr in areq.resource_requests: key = (arr.resource_provider.id, arr.resource_class) psum_res = self.psum_res_by_rp_rc[key] if psum_res.used + arr.amount > psum_res.capacity: - LOG.debug('Excluding the following AllocationRequest because ' - 'used (%d) + amount (%d) > capacity (%d) for ' - 'resource class %s: %s', - psum_res.used, arr.amount, psum_res.capacity, - arr.resource_class, str(areq)) return True if arr.amount > psum_res.max_unit: - LOG.debug('Excluding the following AllocationRequest because ' - 'amount (%d) > max_unit (%d) for resource class ' - '%s: %s', - arr.amount, psum_res.max_unit, arr.resource_class, - str(areq)) return True return False