From b7443ee8139fe783427759d8f4b6577774a72f6a Mon Sep 17 00:00:00 2001 From: zml Date: Thu, 15 Jan 2015 13:40:00 -0800 Subject: [PATCH] Use a more optimal pool size --- .../java/ru/tehkode/permissions/backends/sql/SQLBackend.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/ru/tehkode/permissions/backends/sql/SQLBackend.java b/src/main/java/ru/tehkode/permissions/backends/sql/SQLBackend.java index 4fc48384b..4a7319518 100644 --- a/src/main/java/ru/tehkode/permissions/backends/sql/SQLBackend.java +++ b/src/main/java/ru/tehkode/permissions/backends/sql/SQLBackend.java @@ -94,7 +94,8 @@ public SQLBackend(PermissionManager manager, final ConfigurationSection config) this.ds.setUrl("jdbc:" + dbUri); this.ds.setUsername(dbUser); this.ds.setPassword(dbPassword); - this.ds.setMaxActive(20); + // https://github.com/brettwooldridge/HikariCP/wiki/About-Pool-Sizing + this.ds.setMaxActive((Runtime.getRuntime().availableProcessors() * 2) + 1); this.ds.setMaxWait(200); // 4 ticks this.ds.setValidationQuery("SELECT 1 AS dbcp_validate"); this.ds.setTestOnBorrow(true);