From 6c39810ba702a952dd61a0208943c8b123a8cf03 Mon Sep 17 00:00:00 2001 From: mposolda Date: Thu, 11 Feb 2016 15:50:00 +0100 Subject: [PATCH] KEYCLOAK-2436 Better defaults --- .../reference/en/en-US/modules/server-installation.xml | 9 +++++---- .../connections/httpclient/DefaultHttpClientFactory.java | 6 +++--- .../connections/httpclient/HttpClientBuilder.java | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docbook/auth-server-docs/reference/en/en-US/modules/server-installation.xml b/docbook/auth-server-docs/reference/en/en-US/modules/server-installation.xml index 10b0ec4840..aceff9ba96 100755 --- a/docbook/auth-server-docs/reference/en/en-US/modules/server-installation.xml +++ b/docbook/auth-server-docs/reference/en/en-US/modules/server-installation.xml @@ -396,7 +396,7 @@ bin/add-user.[sh|bat] -r master -u -p connection-pool-size - How many connections can be in the pool (200 by default). + How many connections can be in the pool (128 by default). @@ -404,7 +404,7 @@ bin/add-user.[sh|bat] -r master -u -p max-pooled-per-route - How many connections can be pooled per host (100 by default). + How many connections can be pooled per host (64 by default). @@ -412,7 +412,7 @@ bin/add-user.[sh|bat] -r master -u -p connection-ttl-millis - Maximum connection time to live in milliseconds + Maximum connection time to live in milliseconds. Not set by default. @@ -420,7 +420,8 @@ bin/add-user.[sh|bat] -r master -u -p max-connection-idle-time-millis - Maximum time the connection might stay idle in the connection pool. Will start background cleaner thread if set (by default it's not set) + Maximum time the connection might stay idle in the connection pool (900 seconds by default). Will start background cleaner thread of Apache HTTP client. + Set to -1 to disable this checking and the background thread. diff --git a/services/src/main/java/org/keycloak/connections/httpclient/DefaultHttpClientFactory.java b/services/src/main/java/org/keycloak/connections/httpclient/DefaultHttpClientFactory.java index 430da72397..d881382d2a 100755 --- a/services/src/main/java/org/keycloak/connections/httpclient/DefaultHttpClientFactory.java +++ b/services/src/main/java/org/keycloak/connections/httpclient/DefaultHttpClientFactory.java @@ -119,10 +119,10 @@ public class DefaultHttpClientFactory implements HttpClientFactory { if (httpClient == null) { long socketTimeout = config.getLong("socket-timeout-millis", -1L); long establishConnectionTimeout = config.getLong("establish-connection-timeout-millis", -1L); - int maxPooledPerRoute = config.getInt("max-pooled-per-route", 100); - int connectionPoolSize = config.getInt("connection-pool-size", 200); + int maxPooledPerRoute = config.getInt("max-pooled-per-route", 64); + int connectionPoolSize = config.getInt("connection-pool-size", 128); long connectionTTL = config.getLong("connection-ttl-millis", -1L); - long maxConnectionIdleTime = config.getLong("max-connection-idle-time-millis", -1L); + long maxConnectionIdleTime = config.getLong("max-connection-idle-time-millis", 900000L); boolean disableCookies = config.getBoolean("disable-cookies", true); String clientKeystore = config.get("client-keystore"); String clientKeystorePassword = config.get("client-keystore-password"); diff --git a/services/src/main/java/org/keycloak/connections/httpclient/HttpClientBuilder.java b/services/src/main/java/org/keycloak/connections/httpclient/HttpClientBuilder.java index ba727bd2d8..e4ac52ba89 100755 --- a/services/src/main/java/org/keycloak/connections/httpclient/HttpClientBuilder.java +++ b/services/src/main/java/org/keycloak/connections/httpclient/HttpClientBuilder.java @@ -92,11 +92,11 @@ public class HttpClientBuilder { protected boolean disableTrustManager; protected HostnameVerificationPolicy policy = HostnameVerificationPolicy.WILDCARD; protected SSLContext sslContext; - protected int connectionPoolSize = 200; - protected int maxPooledPerRoute = 100; + protected int connectionPoolSize = 128; + protected int maxPooledPerRoute = 64; protected long connectionTTL = -1; protected TimeUnit connectionTTLUnit = TimeUnit.MILLISECONDS; - protected long maxConnectionIdleTime = -1; + protected long maxConnectionIdleTime = 900000; protected TimeUnit maxConnectionIdleTimeUnit = TimeUnit.MILLISECONDS; protected HostnameVerifier verifier = null; protected long socketTimeout = -1;