From 276d33a725fc77fa49c731ad9ee882dc095b2332 Mon Sep 17 00:00:00 2001 From: Brad Klein Date: Thu, 11 Aug 2016 13:48:10 -0600 Subject: [PATCH] Allow tuning of database connection thread pool settings Change-Id: I431f5f3fcdc934dcb6e65a29fcc43ed94a813095 --- manifests/api.pp | 23 +++++++++++++++++++++++ templates/api-config.yml.erb | 6 +++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/manifests/api.pp b/manifests/api.pp index ec3a471..1c90582 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -4,6 +4,26 @@ # # === Parameters: # +# [*api_db_thread_min*] +# (Optional) Minimum number of threads for db connection pool. +# Defaults to 4. +# +# [*api_db_thread_max*] +# (Optional) Maximum number of threads for db connection pool. +# Defaults to 32. +# +# [*api_db_wait*] +# (Optional) Amount of time to wait for db connection. Can specify +# any string supported by io.dropwizard Duration class, for example: +# +# '1ns' is 1 nanosecond +# '1s' is 1 seconds +# '1m' is 1 minute +# '1h' is 1 hour +# '1d' is 1 day +# +# Defaults to '5s' (5 seconds). +# # [*api_user*] # (Optional) Name of the monasca api user. # Defaults to 'monasca_api'. @@ -92,6 +112,9 @@ # Example: "zookeeper_host_1:2181,zookeeper_host_2:2181" # class monasca::api ( + $api_db_thread_min = 4, + $api_db_thread_max = 32, + $api_db_wait = '5s', $api_user = 'monasca_api', $blobmirror = undef, $check_conn_while_idle = true, diff --git a/templates/api-config.yml.erb b/templates/api-config.yml.erb index cc8e0bb..ee2f2fe 100644 --- a/templates/api-config.yml.erb +++ b/templates/api-config.yml.erb @@ -52,10 +52,10 @@ vertica: url: jdbc:vertica://<%= @database_host %>:5433/mon user: <%= @api_db_user %> password: <%= @api_db_password %> - maxWaitForConnection: 5s + maxWaitForConnection: <%= @api_db_wait %> validationQuery: "/* MyService Health Check */ SELECT 1" - minSize: 4 - maxSize: 32 + minSize: <%= @api_db_thread_min %> + maxSize: <%= @api_db_thread_max %> checkConnectionWhileIdle: <%= @check_conn_while_idle %> dbHint: <%= @vertica_db_hint %>