From 336742e5d1cd21af3a3521ce9505b588222dcee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristo=20Kuusk=C3=BCll?= Date: Fri, 19 Sep 2025 09:53:30 +0300 Subject: [PATCH 1/2] Tweaking max triggers in memory defaults. --- CHANGELOG.md | 6 +++++- build.libraries.gradle | 5 +++-- gradle.properties | 2 +- tw-tasks-core-spring-boot-starter/build.gradle | 1 + .../autoconfigure/TwTasksEnvironmentPostProcessor.java | 9 +++++++++ .../java/com/transferwise/tasks/TasksProperties.java | 2 +- 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7c8c7c8..7148f492 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -# 1.51.2 - 2025/08/15 +# 1.51.3 - 2025/09/19 + +### Changed + +- Reducing default maxTriggersInMemory to 10_000, but leaving it the same for production environment. ### Changed diff --git a/build.libraries.gradle b/build.libraries.gradle index aae2cb34..3bea341b 100644 --- a/build.libraries.gradle +++ b/build.libraries.gradle @@ -10,6 +10,8 @@ ext { guava : "com.google.guava:guava:33.3.1-jre", jakartaValidationApi : 'jakarta.validation:jakarta.validation-api:3.0.2', javaxValidationApi : "javax.validation:validation-api:2.0.1.Final", + lubenZstd : 'com.github.luben:zstd-jni:1.5.6-7', + lz4Java : 'org.lz4:lz4-java:1.8.0', semver4j : "com.vdurmont:semver4j:3.1.0", spotbugsAnnotations : "com.github.spotbugs:spotbugs-annotations:${spotbugs.toolVersion.get()}", springBootDependencies : "org.springframework.boot:spring-boot-dependencies:$springBootVersion", @@ -23,8 +25,7 @@ ext { twBaseUtils : "com.transferwise.common:tw-base-utils:1.13.0", twEntryPointsStarter : 'com.transferwise.common:tw-entrypoints-starter:2.16.0', twSpyqlStarter : 'com.transferwise.common:tw-spyql-starter:1.6.2', - lubenZstd : 'com.github.luben:zstd-jni:1.5.6-7', - lz4Java : 'org.lz4:lz4-java:1.8.0', + wiseEnvironmentStarter : "com.transferwise.common:wise-environment-starter:0.1.4", // versions managed by spring-boot-dependencies platform flywayCore : "org.flywaydb:flyway-core", diff --git a/gradle.properties b/gradle.properties index 83671c03..502efd49 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version=1.51.2 +version=1.51.3 org.gradle.internal.http.socketTimeout=120000 diff --git a/tw-tasks-core-spring-boot-starter/build.gradle b/tw-tasks-core-spring-boot-starter/build.gradle index dfa9ff75..fda20c16 100644 --- a/tw-tasks-core-spring-boot-starter/build.gradle +++ b/tw-tasks-core-spring-boot-starter/build.gradle @@ -9,6 +9,7 @@ dependencies { implementation libraries.apacheCuratorRecipies implementation libraries.micrometerCore + implementation libraries.wiseEnvironmentStarter runtimeOnly libraries.twGracefulShutdown runtimeOnly libraries.twContextStarter diff --git a/tw-tasks-core-spring-boot-starter/src/main/java/com/transferwise/tasks/core/autoconfigure/TwTasksEnvironmentPostProcessor.java b/tw-tasks-core-spring-boot-starter/src/main/java/com/transferwise/tasks/core/autoconfigure/TwTasksEnvironmentPostProcessor.java index 5a8a1e2a..5c7ccc39 100644 --- a/tw-tasks-core-spring-boot-starter/src/main/java/com/transferwise/tasks/core/autoconfigure/TwTasksEnvironmentPostProcessor.java +++ b/tw-tasks-core-spring-boot-starter/src/main/java/com/transferwise/tasks/core/autoconfigure/TwTasksEnvironmentPostProcessor.java @@ -1,6 +1,8 @@ package com.transferwise.tasks.core.autoconfigure; import com.transferwise.tasks.helpers.CoreMetricsTemplate; +import com.wise.common.environment.WiseEnvironment; +import com.wise.common.environment.WiseProfile; import java.util.HashMap; import java.util.HashSet; import java.util.Set; @@ -34,6 +36,13 @@ public void postProcessEnvironment(ConfigurableEnvironment environment, SpringAp MapPropertySource mapPropertySource = new MapPropertySource(PROPERTY_SOURCE_KEY, map); environment.getPropertySources().addLast(mapPropertySource); + + WiseEnvironment.setDefaultProperties(dsl -> dsl + .source("tw-tasks-executor") + .profile(WiseProfile.PRODUCTION) + .keyPrefix("tw-tasks.core.") + .set("max-triggers-in-memory", 100_000) + ); } } } diff --git a/tw-tasks-core/src/main/java/com/transferwise/tasks/TasksProperties.java b/tw-tasks-core/src/main/java/com/transferwise/tasks/TasksProperties.java index edaa13ad..c4073f36 100644 --- a/tw-tasks-core/src/main/java/com/transferwise/tasks/TasksProperties.java +++ b/tw-tasks-core/src/main/java/com/transferwise/tasks/TasksProperties.java @@ -84,7 +84,7 @@ public class TasksProperties { */ @Min(1L) @jakarta.validation.constraints.Min(1L) - private int maxTriggersInMemory = 100000; + private int maxTriggersInMemory = 10_000; /** * How many triggers maximum do we retrieve from Kafka with one polling loop. */ From b69a9f6f3f469065f97d499cae57f29cd9dacd14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristo=20Kuusk=C3=BCll?= Date: Fri, 19 Sep 2025 09:54:28 +0300 Subject: [PATCH 2/2] Fix. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7148f492..a22372d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ### Changed - Reducing default maxTriggersInMemory to 10_000, but leaving it the same for production environment. + It allows to reduce the reserve heap size in non-production environments. ### Changed