From dcf53da20964ed0b1a1b2583f9b861850f0b64ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 23 Nov 2018 09:28:59 +0200 Subject: [PATCH] Enable connection_keepalive by default Enabling the feature by default prevents the master connection from dying during times when there are very little or no writes. Having a modest ping interval of 300 seconds serves to minimize the amount of extra work that both MaxScale and the server have to do while still keeping the connections in good shape. --- .../Release-Notes/MaxScale-2.3.2-Release-Notes.md | 8 ++++++++ Documentation/Routers/ReadWriteSplit.md | 6 ++++-- server/modules/routing/readwritesplit/readwritesplit.cc | 2 +- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Documentation/Release-Notes/MaxScale-2.3.2-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.3.2-Release-Notes.md index eab0a9881..c7717ee27 100644 --- a/Documentation/Release-Notes/MaxScale-2.3.2-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.3.2-Release-Notes.md @@ -16,6 +16,14 @@ The systemd watchdog is now safe to use in all circumstances. By default it is enabled with a timeout of 60 seconds. +### Readwritesplit + +#### `connection_keepalive` + +The default value of `connection_keepalive` is now 300 seconds. This prevents +the connections from dying due to wait_timeout with longer sessions. This is +especially helpful with pooled connections that stay alive for a very long time. + ## Bug fixes ## Known Issues and Limitations diff --git a/Documentation/Routers/ReadWriteSplit.md b/Documentation/Routers/ReadWriteSplit.md index 179746b01..154825eb2 100644 --- a/Documentation/Routers/ReadWriteSplit.md +++ b/Documentation/Routers/ReadWriteSplit.md @@ -92,7 +92,8 @@ master_failure_mode=fail_on_write ### `connection_keepalive` Send keepalive pings to backend servers. This feature was introduced in MaxScale -2.2.0 and is disabled by default. +2.2.0. The default value is 300 seconds starting with 2.3.2 and for older +versions the feature was disabled by default. The parameter value is the interval in seconds between each keepalive ping. A keepalive ping will be sent to a backend server if the connection is idle and it @@ -103,7 +104,8 @@ client executes a query. This functionality allows the readwritesplit module to keep all backend connections alive even if they are not used. This is a common problem if the backend servers have a low _wait_timeout_ value and the client connections live -for a long time. +for a long time or if your workload is extremely read-heavy with writes done at +lower intervals than the configured _wait_timeout_. ### `master_reconnection` diff --git a/server/modules/routing/readwritesplit/readwritesplit.cc b/server/modules/routing/readwritesplit/readwritesplit.cc index 356b1623a..0c348f8af 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.cc +++ b/server/modules/routing/readwritesplit/readwritesplit.cc @@ -503,7 +503,7 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() {"strict_multi_stmt", MXS_MODULE_PARAM_BOOL, "false" }, {"strict_sp_calls", MXS_MODULE_PARAM_BOOL, "false" }, {"master_accept_reads", MXS_MODULE_PARAM_BOOL, "false" }, - {"connection_keepalive", MXS_MODULE_PARAM_COUNT, "0" }, + {"connection_keepalive", MXS_MODULE_PARAM_COUNT, "300" }, {"causal_reads", MXS_MODULE_PARAM_BOOL, "false" }, {"causal_reads_timeout", MXS_MODULE_PARAM_STRING, "10" }, {"master_reconnection", MXS_MODULE_PARAM_BOOL, "false" },