diff --git a/src/metabase/async/streaming_response/thread_pool.clj b/src/metabase/async/streaming_response/thread_pool.clj index ff089fd92a723e94e87d06b082f3b2c9e2b04736..e5183944bf558518da3c697f340a357e475c2b80 100644 --- a/src/metabase/async/streaming_response/thread_pool.clj +++ b/src/metabase/async/streaming_response/thread_pool.clj @@ -4,7 +4,9 @@ org.apache.commons.lang3.concurrent.BasicThreadFactory$Builder)) (def ^:private ^Long thread-pool-max-size - (or (config/config-int :mb-jetty-maxthreads) 50)) + (or (config/config-int :mb-async-query-thread-pool-size) + (config/config-int :mb-jetty-maxthreads) + 50)) (defonce ^:private thread-pool* (delay diff --git a/src/metabase/db.clj b/src/metabase/db.clj index be13d590ffd1f1ea56207e5d0898f45db10e3071..fbeadecd25a5c9051a12b9c66f22a1fa6f77c3b7 100644 --- a/src/metabase/db.clj +++ b/src/metabase/db.clj @@ -240,7 +240,12 @@ we use separate options for data warehouse DBs. See https://www.mchange.com/projects/c3p0/#configuring_connection_testing for an overview of the options used below (jump to the 'Simple advice on Connection testing' section.)" - {"idleConnectionTestPeriod" 60}) + (merge + {"idleConnectionTestPeriod" 60} + ;; only merge in `max-pool-size` if it's actually set, this way it doesn't override any things that may have been + ;; set in `c3p0.properties` + (when-let [max-pool-size (config/config-int :mb-application-db-max-connection-pool-size)] + {"maxPoolSize" max-pool-size}))) (defn- create-connection-pool! [jdbc-spec] (db/set-default-quoting-style! (case (db-type) diff --git a/src/metabase/driver/sql_jdbc/connection.clj b/src/metabase/driver/sql_jdbc/connection.clj index 23554c2da9de439e650e3d09bad942ac7e245fc8..cf5cb4308c27234098c6d78c713f29c3e6f2cb29 100644 --- a/src/metabase/driver/sql_jdbc/connection.clj +++ b/src/metabase/driver/sql_jdbc/connection.clj @@ -4,6 +4,7 @@ (:require [clojure.java.jdbc :as jdbc] [clojure.tools.logging :as log] [metabase + [config :as config] [connection-pool :as connection-pool] [driver :as driver] [util :as u]] @@ -44,14 +45,15 @@ (defmethod data-warehouse-connection-pool-properties :default [_] - {;; only fetch one new connection at a time, rather than batching fetches (default = 3 at a time). This is done in + { ;; only fetch one new connection at a time, rather than batching fetches (default = 3 at a time). This is done in ;; interest of minimizing memory consumption "acquireIncrement" 1 ;; [From dox] Seconds a Connection can remain pooled but unused before being discarded. "maxIdleTime" (* 3 60 60) ; 3 hours "minPoolSize" 1 "initialPoolSize" 1 - "maxPoolSize" 15 + "maxPoolSize" (or (config/config-int :mb-jdbc-data-warehouse-max-connection-pool-size) + 15) ;; [From dox] If true, an operation will be performed at every connection checkout to verify that the connection is ;; valid. [...] ;; Testing Connections in checkout is the simplest and most reliable form of Connection testing, ;; but for better performance, consider verifying connections periodically using `idleConnectionTestPeriod`. [...]