From b628cd6111884b9f14c888cccef7c4802d8fecd4 Mon Sep 17 00:00:00 2001 From: Francesco Cesareo Date: Thu, 11 Apr 2024 10:18:27 +0200 Subject: [PATCH] fix heap size, added alert log --- helm/values-prod.yaml | 7 ++- infra/.terraform.lock.hcl | 62 +++++++++++++++++++ .../service/ApiConfigCacheEhConsumer.java | 6 +- .../service/ApiConfigCacheService.java | 2 +- .../service/StandInManagerEhConsumer.java | 6 +- .../service/StandInManagerService.java | 2 +- 6 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 infra/.terraform.lock.hcl diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index d88fe08..1d441b1 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -10,14 +10,14 @@ microservice-chart: httpGet: path: /actuator/health/liveness port: 8080 - initialDelaySeconds: 90 + initialDelaySeconds: 60 failureThreshold: 6 periodSeconds: 10 readinessProbe: httpGet: path: /actuator/health/readiness port: 8080 - initialDelaySeconds: 90 + initialDelaySeconds: 60 failureThreshold: 6 periodSeconds: 10 deployment: @@ -47,7 +47,7 @@ microservice-chart: memory: "512Mi" cpu: "0.25" limits: - memory: "1G" + memory: "4G" cpu: "1.0" autoscaling: enable: true @@ -67,6 +67,7 @@ microservice-chart: APP_LOGGING_LEVEL: 'INFO' HIKARI_LOGGING_LEVEL: 'INFO' DEFAULT_LOGGING_LEVEL: 'INFO' + JAVA_OPTS: "-XX:MaxHeapSize=2g" CORS_CONFIGURATION: '{"origins": ["*"], "methods": ["*"]}' DB_NEXI_POSTGRES_URL: "jdbc:postgresql://db-postgres-ndp.p.db-nodo-pagamenti.com:5444/ndpspcp?prepareThreshold=0¤tSchema=NODO4_CFG" DB_NEXI_POSTGRES_USER: "pp_nodo4_cfg" diff --git a/infra/.terraform.lock.hcl b/infra/.terraform.lock.hcl new file mode 100644 index 0000000..3ee45ee --- /dev/null +++ b/infra/.terraform.lock.hcl @@ -0,0 +1,62 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/azure/azapi" { + version = "1.3.0" + constraints = "1.3.0" + hashes = [ + "h1:h/ZVYAapVQ+W0R4P5IK/Mvsi84jiYTggmgJHZgfVbfg=", + "zh:0923b297c5b71ed584e5f3a0b2393e80244076e85102a90438159833353274b0", + "zh:11fa2922aa98ca55beaf7cc33c7edbde81bbd405fdfea2955276c7f5a8537240", + "zh:14af830fb6091d084bfc2711c8e9c7bf05aa3c56fe8fd8e2fb4eddeb345be88d", + "zh:25258425ecbffbdf09b0c8131d2c680cddd19b504e0036ee5f83972dcae7df0a", + "zh:2922b535fe4d4f0963189548f2f8360a0aaf951fd411354f2269a111d8a0c1ad", + "zh:32c9360305e00c25d0f9d0a84dfbdbad8da2465be769a9c1f11f132c0225358e", + "zh:4ddd3ee23c340d5000839d8d30ba7f94e695476d63075f95cfb041e67d8f6ef6", + "zh:5c1514392a5c3dd51084aa70cb6c4dcc8b027c4508b5e4eb9f8c3990fd403213", + "zh:6b3ecac7099ab86c007b5ad636bd029f5e5f3e9bd06b0f74c82f0451a7995ecc", + "zh:6cb7081745b378e910e0cf09fb5717a2ad35e629ce3e07415d6682c1c1407872", + "zh:7107eda5125c1b983380f1f6418c592fb7fb2eb5b589ad0e08f6c47341f36318", + "zh:c6fa7af32a7a47d23a85e0eea4d4cbb065378ae75aed8c9c628fb625b04bc619", + ] +} + +provider "registry.terraform.io/hashicorp/azuread" { + version = "2.30.0" + constraints = "2.30.0" + hashes = [ + "h1:WnSPiREAFwnBUKREokMdHQ8Cjs47MzvS9pG8VS1ktec=", + "zh:1c3e89cf19118fc07d7b04257251fc9897e722c16e0a0df7b07fcd261f8c12e7", + "zh:2e62c193030e04ebb10cc0526119cf69824bf2d7e4ea5a2f45bd5d5fb7221d36", + "zh:2f3c7a35257332d68b778cefc5201a5f044e4914dd03794a4da662ddfe756483", + "zh:35d0d3a1b58fdb8b8c4462d6b7e7016042da43ea9cc734ce897f52a73407d9b0", + "zh:47ede0cd0206ec953d40bf4a80aa6e59af64e26cbbd877614ac424533dbb693b", + "zh:48c190307d4d42ea67c9b8cc544025024753f46cef6ea64db84735e7055a72da", + "zh:6fff9b2c6a962252a70a15b400147789ab369b35a781e9d21cce3804b04d29af", + "zh:7646980cf3438bff29c91ffedb74458febbb00a996638751fbd204ab1c628c9b", + "zh:77aa2fa7ca6d5446afa71d4ff83cb87b70a2f3b72110fc442c339e8e710b2928", + "zh:e20b2b2c37175b89dd0db058a096544d448032e28e3b56e2db368343533a9684", + "zh:eab175b1dfe9865ad9404dccb6d5542899f8c435095aa7c679314b811c717ce7", + "zh:efc862bd78c55d2ff089729e2a34c1831ab4b0644fc11b36ee4ebed00a4797ba", + ] +} + +provider "registry.terraform.io/hashicorp/azurerm" { + version = "3.53.0" + constraints = ">= 3.30.0, <= 3.53.0" + hashes = [ + "h1:ocOIwGJG+K9hb22GdXhTdDiewSdeo9YO3BZ8cm8fUiE=", + "zh:078ece8318ad7d6c1cd2e5f2044188e74af63921b93223c7f8d477539fa91888", + "zh:1bdc98ff8c2d3f3e81a746762e03d39794b2f5c90dc478cdb23dcc3d3f9947b6", + "zh:20b51cfc0ffc4ff368e6eb2eaece0b6bb99ade09e4b91b3444b50e94fc54c119", + "zh:233eed91279a9473825ba02d66487388d66dfc719b7249112d085dece0c2b594", + "zh:397ac8194ecc2f8d34d42600d6bf9e20399b222170dc1443b5800db3135ebc99", + "zh:3af3a2d8485d6c1ffcd26848af9ab087dfcb6cb045cc624e51f4db5144b53a9c", + "zh:5d0b9a346b57cccc369e2076556274225ec7f1c9044a2503dcfd8c117cdc2f79", + "zh:6e762dcef4ba14985f93af5f3fd195c9ee7d27de8de3bebdeefe761e53e79bb9", + "zh:73f9be719aa867985b1744c1f4fab834d01eb2069ec7a78b3a1bfa87c8256a40", + "zh:756deed30c20ffc9b4756c239e1675d3693f7175851e5ef946948a8bfb0b7935", + "zh:c279f99902a45a5b88d25d609a73709d101af3ce71222efbab9d4706c8a538b4", + "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", + ] +} diff --git a/src/main/java/it/gov/pagopa/node/cfgsync/service/ApiConfigCacheEhConsumer.java b/src/main/java/it/gov/pagopa/node/cfgsync/service/ApiConfigCacheEhConsumer.java index 8e20ebd..dda2032 100644 --- a/src/main/java/it/gov/pagopa/node/cfgsync/service/ApiConfigCacheEhConsumer.java +++ b/src/main/java/it/gov/pagopa/node/cfgsync/service/ApiConfigCacheEhConsumer.java @@ -54,7 +54,11 @@ public void processEvent(EventContext eventContext) { TargetRefreshEnum.cache.label, eventContext.getPartitionContext().getPartitionId(), eventContext.getEventData().getSequenceNumber(), eventContext.getEventData().getBodyAsString()); - apiConfigCacheService.syncCache(); + try { + apiConfigCacheService.syncCache(); + } catch (Exception ex) { + log.error("[{}][ALERT] Generic Error on consumer: {}", TargetRefreshEnum.cache.label, ex.getMessage(), ex); + } } public void processError(ErrorContext errorContext) { diff --git a/src/main/java/it/gov/pagopa/node/cfgsync/service/ApiConfigCacheService.java b/src/main/java/it/gov/pagopa/node/cfgsync/service/ApiConfigCacheService.java index bb9578b..89be66f 100644 --- a/src/main/java/it/gov/pagopa/node/cfgsync/service/ApiConfigCacheService.java +++ b/src/main/java/it/gov/pagopa/node/cfgsync/service/ApiConfigCacheService.java @@ -107,7 +107,7 @@ public Map syncCache() { } catch(AppException appException) { throw appException; } catch (Exception ex) { - log.error("[{}] error: {}", TargetRefreshEnum.cache.label, ex.getMessage(), ex); + log.error("[{}][ALERT] Generic Error: {}", TargetRefreshEnum.cache.label, ex.getMessage(), ex); throw new AppException(AppError.INTERNAL_SERVER_ERROR); } } diff --git a/src/main/java/it/gov/pagopa/node/cfgsync/service/StandInManagerEhConsumer.java b/src/main/java/it/gov/pagopa/node/cfgsync/service/StandInManagerEhConsumer.java index 8ad353a..af1d543 100644 --- a/src/main/java/it/gov/pagopa/node/cfgsync/service/StandInManagerEhConsumer.java +++ b/src/main/java/it/gov/pagopa/node/cfgsync/service/StandInManagerEhConsumer.java @@ -52,7 +52,11 @@ public void processEvent(EventContext eventContext) { TargetRefreshEnum.standin.label, eventContext.getPartitionContext().getPartitionId(), eventContext.getEventData().getSequenceNumber(), eventContext.getEventData().getBodyAsString()); - standInManagerService.syncStandIn(); + try { + standInManagerService.syncStandIn(); + } catch (Exception ex) { + log.error("[{}][ALERT] Generic Error on consumer: {}", TargetRefreshEnum.standin.label, ex.getMessage(), ex); + } } public void processError(ErrorContext errorContext) { diff --git a/src/main/java/it/gov/pagopa/node/cfgsync/service/StandInManagerService.java b/src/main/java/it/gov/pagopa/node/cfgsync/service/StandInManagerService.java index 5583b8c..8bb91c6 100644 --- a/src/main/java/it/gov/pagopa/node/cfgsync/service/StandInManagerService.java +++ b/src/main/java/it/gov/pagopa/node/cfgsync/service/StandInManagerService.java @@ -100,7 +100,7 @@ public Map syncStandIn() { } catch(AppException appException) { throw appException; } catch (Exception ex) { - log.error("[{}] error: {}", TargetRefreshEnum.standin.label, ex.getMessage(), ex); + log.error("[{}][ALERT] Generic Error: {}", TargetRefreshEnum.standin.label, ex.getMessage(), ex); throw new AppException(AppError.INTERNAL_SERVER_ERROR); } }