From de6117f7f73f03d2bf60ac8741893162a2dfe441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20J=C3=A4derberg?= Date: Tue, 17 Jun 2025 07:12:44 +0000 Subject: [PATCH] Merged in fix/redis-adjust-batch-settings (pull request #2374) fix: adjust batch size and remove timeout between delete-calls * fix: adjust batch size and remove timeout between delete-calls * chore: adjust scaling Approved-by: Linus Flood --- apps/redis-api/ci/bicep/app/containerApp.bicep | 10 +++++----- apps/redis-api/src/routes/api/cache.ts | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/apps/redis-api/ci/bicep/app/containerApp.bicep b/apps/redis-api/ci/bicep/app/containerApp.bicep index 211264b82..a0d75426c 100644 --- a/apps/redis-api/ci/bicep/app/containerApp.bicep +++ b/apps/redis-api/ci/bicep/app/containerApp.bicep @@ -5,8 +5,8 @@ param location string param containerAppName string param containerImage string param containerPort int -param minReplicas int = environment == 'prod' ? 2 : 1 -param maxReplicas int = 15 +param minReplicas int = environment == 'prod' ? 5 : 1 +param maxReplicas int = 40 param pollingInterval int = 5 param envVars EnvironmentVar[] = [] param userAssignedIdentityId string @@ -76,7 +76,7 @@ resource containerApp 'Microsoft.App/containerApps@2024-10-02-preview' = { name: 'http-rule' http: { metadata: { - concurrentRequests: '100' + concurrentRequests: '500' } } } @@ -86,7 +86,7 @@ resource containerApp 'Microsoft.App/containerApps@2024-10-02-preview' = { type: 'cpu' metadata: { type: 'Utilization' - value: '70' // Trigger scaling if CPU > 70% + value: '65' // Trigger scaling if CPU > X% } } } @@ -96,7 +96,7 @@ resource containerApp 'Microsoft.App/containerApps@2024-10-02-preview' = { type: 'memory' metadata: { type: 'Utilization' - value: '75' // Scale up if memory usage > 75% + value: '70' // Scale up if memory usage > X% } } } diff --git a/apps/redis-api/src/routes/api/cache.ts b/apps/redis-api/src/routes/api/cache.ts index 6f88ffbc3..c1966a636 100644 --- a/apps/redis-api/src/routes/api/cache.ts +++ b/apps/redis-api/src/routes/api/cache.ts @@ -112,7 +112,7 @@ function validateKey(key: string) { async function deleteWithPattern(pattern: string) { let cursor = "0"; - const SCAN_SIZE = 500; + const SCAN_SIZE = 1000; let totalDeleteCount = 0; @@ -134,8 +134,6 @@ async function deleteWithPattern(pattern: string) { cacheRouteLogger.info(`Deleted ${deleteCount} keys in this batch.`); totalDeleteCount += deleteCount; - - await timeout(10); } while (cursor !== "0"); return totalDeleteCount;