From 4cb3b87fce9a32371dc3e11884ddbe77e8c85ad9 Mon Sep 17 00:00:00 2001 From: Cedric Ong Date: Fri, 29 Mar 2024 22:09:33 +0800 Subject: [PATCH] configure agroal connection pool --- build.gradle | 2 ++ src/main/java/teammates/common/util/HibernateUtil.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/build.gradle b/build.gradle index ab30b57dcf5..4fe78e4f12b 100644 --- a/build.gradle +++ b/build.gradle @@ -77,6 +77,8 @@ dependencies { implementation("org.jsoup:jsoup:1.15.2") implementation("org.hibernate.orm:hibernate-core:6.1.6.Final") implementation("org.postgresql:postgresql:42.7.2") + implementation("org.hibernate.orm:hibernate-agroal:6.1.6.Final") + implementation("io.agroal:agroal-pool:2.1") testAnnotationProcessor(testng) diff --git a/src/main/java/teammates/common/util/HibernateUtil.java b/src/main/java/teammates/common/util/HibernateUtil.java index eedb4b7f757..5fb180758fc 100644 --- a/src/main/java/teammates/common/util/HibernateUtil.java +++ b/src/main/java/teammates/common/util/HibernateUtil.java @@ -117,6 +117,9 @@ public static void buildSessionFactory(String dbUrl, String username, String pas .setProperty("hibernate.hbm2ddl.auto", "update") .setProperty("show_sql", "true") .setProperty("hibernate.current_session_context_class", "thread") + .setProperty("hibernate.agroal.minSize", "5") + .setProperty("hibernate.agroal.maxSize", "50") + .setProperty("hibernate.agroal.reapTimeout", "PT1M") // Uncomment only during migration for optimized batch-insertion, batch-update, and batch-fetch. // .setProperty("hibernate.jdbc.batch_size", "50") // .setProperty("hibernate.order_updates", "true")