]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2441] added warning message to instruct Kea MT rewuired HA+MT
authorRazvan Becheriu <razvan@isc.org>
Mon, 29 Aug 2022 11:29:42 +0000 (14:29 +0300)
committerRazvan Becheriu <razvan@isc.org>
Mon, 29 Aug 2022 11:42:15 +0000 (14:42 +0300)
doc/examples/kea4/ha-load-balancing-server1-mt-with-tls.json
doc/examples/kea4/ha-load-balancing-server2-mt.json
doc/examples/template-ha-mt-tls/kea-dhcp4-1.conf
doc/examples/template-ha-mt-tls/kea-dhcp4-2.conf
src/hooks/dhcp/high_availability/ha_config.cc
src/hooks/dhcp/high_availability/ha_messages.cc
src/hooks/dhcp/high_availability/ha_messages.h
src/hooks/dhcp/high_availability/ha_messages.mes

index a837ada39274dc8d3cd8bd45acb217155f5c9dda..91dde37eb8a9a4e59aece439d74b59b6898d8959 100644 (file)
                     "sync-timeout": 60000,
                     // To not experience performance degradation when the Kea server is
                     // processing packets on multiple threads, the High Availablility module
-                    // must be configured in a similar way.
+                    // must have multi-threading enabled.
                     "multi-threading": {
                         "enable-multi-threading": true,
                         // When running in MT mode, the dedicated listener is used to handle
                         // lease updates.
                         "http-dedicated-listener": true,
                         // The number of threads used to handle incomming requests.
-                        "http-listener-threads": 4,
+                        // A value of 0 instructs the server to use the same number of
+                        // threads that the Kea core is using for DHCP multi-threading.
+                        "http-listener-threads": 0,
                         // The number of threads used to handle outgoing requests.
-                        "http-client-threads": 4
+                        // A value of 0 instructs the server to use the same number of
+                        // threads that the Kea core is using for DHCP multi-threading.
+                        "http-client-threads": 0
                     },
                     "peers": [
                         // This is the configuration of this server instance.
index 9563b0703209ffe6828864bc42199b33eebdd666..5a985e6694cdbf1da0101361cd2a8578158d6447 100644 (file)
                     "sync-timeout": 60000,
                     // To not experience performance degradation when the Kea server is
                     // processing packets on multiple threads, the High Availablility module
-                    // must be configured in a similar way.
+                    // must have multi-threading enabled.
                     "multi-threading": {
                         "enable-multi-threading": true,
                         // When running in MT mode, the dedicated listener is used to handle
                         // lease updates.
                         "http-dedicated-listener": true,
                         // The number of threads used to handle incomming requests.
-                        "http-listener-threads": 4,
+                        // A value of 0 instructs the server to use the same number of
+                        // threads that the Kea core is using for DHCP multi-threading.
+                        "http-listener-threads": 0,
                         // The number of threads used to handle outgoing requests.
-                        "http-client-threads": 4
+                        // A value of 0 instructs the server to use the same number of
+                        // threads that the Kea core is using for DHCP multi-threading.
+                        "http-client-threads": 0
                     },
                     "peers": [
                         // This is the configuration of the HA peer.
index e7974ee59821249411728e93085414a6942da050..5bff5c19d413687d71ca11f2a3a79f546fad68e2 100644 (file)
                     // further. The default value is 60000ms (60 seconds).
                     "sync-timeout": 60000,
                     // Multi-threading parameters.
+                    // To not experience performance degradation when the Kea server is
+                    // processing packets on multiple threads, the High Availablility module
+                    // must have multi-threading enabled.
                     "multi-threading": {
                         "enable-multi-threading": true,
                         // When running in MT mode, the dedicated listener is used to handle
                         // lease updates.
                         "http-dedicated-listener": true,
                         // The number of threads used to handle incomming requests.
-                        "http-listener-threads": 4,
+                        // A value of 0 instructs the server to use the same number of
+                        // threads that the Kea core is using for DHCP multi-threading.
+                        "http-listener-threads": 0,
                         // The number of threads used to handle outgoing requests.
-                        "http-client-threads": 4
+                        // A value of 0 instructs the server to use the same number of
+                        // threads that the Kea core is using for DHCP multi-threading.
+                        "http-client-threads": 0
                     },
                     "peers": [
                         // This is the configuration of this server instance.
index 36c418dd193eef6f6b6a6802ef552f1837846a6e..dcdfc332b430c4368919b012f50577dda85ce6a4 100644 (file)
                     // further. The default value is 60000ms (60 seconds).
                     "sync-timeout": 60000,
                     // Multi-threading parameters.
+                    // To not experience performance degradation when the Kea server is
+                    // processing packets on multiple threads, the High Availablility module
+                    // must have multi-threading enabled.
                     "multi-threading": {
                         "enable-multi-threading": true,
                         // When running in MT mode, the dedicated listener is used to handle
                         // lease updates.
                         "http-dedicated-listener": true,
                         // The number of threads used to handle incomming requests.
-                        "http-listener-threads": 4,
+                        // A value of 0 instructs the server to use the same number of
+                        // threads that the Kea core is using for DHCP multi-threading.
+                        "http-listener-threads": 0,
                         // The number of threads used to handle outgoing requests.
-                        "http-client-threads": 4
+                        // A value of 0 instructs the server to use the same number of
+                        // threads that the Kea core is using for DHCP multi-threading.
+                        "http-client-threads": 0
                     },
                     "peers": [
                         // This is the configuration of the primary server.
index 1e3a8c684dbf586db65d66f83167fabdd5bf8c27..529078dd230d583bb872bf6cf4646938aa36c64c 100644 (file)
@@ -462,15 +462,15 @@ HAConfig::validate() {
         }
     }
 
-    if (enable_multi_threading_) {
-        // We get it from staging because applying the DHCP multi-threading configuration
-        // occurs after library loading during the (re)configuration process.
-        auto mcfg = CfgMgr::instance().getStagingCfg()->getDHCPMultiThreading();
-        bool dhcp_mt_enabled = false;
-        uint32_t dhcp_threads = 0;
-        uint32_t dummy_queue_size = 0;
-        CfgMultiThreading::extract(mcfg, dhcp_mt_enabled, dhcp_threads, dummy_queue_size);
+    // We get it from staging because applying the DHCP multi-threading configuration
+    // occurs after library loading during the (re)configuration process.
+    auto mcfg = CfgMgr::instance().getStagingCfg()->getDHCPMultiThreading();
+    bool dhcp_mt_enabled = false;
+    uint32_t dhcp_threads = 0;
+    uint32_t dummy_queue_size = 0;
+    CfgMultiThreading::extract(mcfg, dhcp_mt_enabled, dhcp_threads, dummy_queue_size);
 
+    if (enable_multi_threading_) {
         if (!dhcp_mt_enabled) {
             // HA+MT requires DHCP multi-threading.
             LOG_INFO(ha_logger, HA_CONFIG_DHCP_MT_DISABLED);
@@ -500,6 +500,12 @@ HAConfig::validate() {
         if (http_client_threads_ == 0) {
             http_client_threads_ = dhcp_threads;
         }
+    } else {
+        if (dhcp_mt_enabled) {
+            // DHCP multi-threading requires HA+MT for optimal performance.
+            LOG_WARN(ha_logger, HA_CONFIG_DHCP_MT_DISABLED_AND_KEA_MT_ENABLED);
+            return;
+        }
     }
 }
 
index ac669f4e9336aae1188926af4bc4b5c4291f0008..2e7872d8f2f04e3b34d5fabad119984e469a38f7 100644 (file)
@@ -25,6 +25,7 @@ extern const isc::log::MessageID HA_CONFIGURATION_FAILED = "HA_CONFIGURATION_FAI
 extern const isc::log::MessageID HA_CONFIGURATION_SUCCESSFUL = "HA_CONFIGURATION_SUCCESSFUL";
 extern const isc::log::MessageID HA_CONFIG_AUTO_FAILOVER_DISABLED = "HA_CONFIG_AUTO_FAILOVER_DISABLED";
 extern const isc::log::MessageID HA_CONFIG_DHCP_MT_DISABLED = "HA_CONFIG_DHCP_MT_DISABLED";
+extern const isc::log::MessageID HA_CONFIG_DHCP_MT_DISABLED_AND_KEA_MT_ENABLED = "HA_CONFIG_DHCP_MT_DISABLED_AND_KEA_MT_ENABLED";
 extern const isc::log::MessageID HA_CONFIG_LEASE_SYNCING_DISABLED = "HA_CONFIG_LEASE_SYNCING_DISABLED";
 extern const isc::log::MessageID HA_CONFIG_LEASE_SYNCING_DISABLED_REMINDER = "HA_CONFIG_LEASE_SYNCING_DISABLED_REMINDER";
 extern const isc::log::MessageID HA_CONFIG_LEASE_UPDATES_AND_SYNCING_DIFFER = "HA_CONFIG_LEASE_UPDATES_AND_SYNCING_DIFFER";
@@ -130,6 +131,7 @@ const char* values[] = {
     "HA_CONFIGURATION_SUCCESSFUL", "HA hook library has been successfully configured",
     "HA_CONFIG_AUTO_FAILOVER_DISABLED", "auto-failover disabled for %1",
     "HA_CONFIG_DHCP_MT_DISABLED", "HA multi-threading has been disabled, it cannot be enabled when Kea global multi-threading is disabled",
+    "HA_CONFIG_DHCP_MT_DISABLED_AND_KEA_MT_ENABLED", "HA multi-threading is disabled while Kea global multi-threading is enabled which most likely cause performance degradation.",
     "HA_CONFIG_LEASE_SYNCING_DISABLED", "lease database synchronization between HA servers is disabled",
     "HA_CONFIG_LEASE_SYNCING_DISABLED_REMINDER", "bypassing SYNCING state because lease database synchronization is administratively disabled",
     "HA_CONFIG_LEASE_UPDATES_AND_SYNCING_DIFFER", "unusual configuration where \"send-lease-updates\": %1 and \"sync-leases\": %2",
index 167a64e22d3f2a810e916707cfd0b161ba33370c..4798d31bb1dc26f2be1dabde392040e175b7f1ad 100644 (file)
@@ -26,6 +26,7 @@ extern const isc::log::MessageID HA_CONFIGURATION_FAILED;
 extern const isc::log::MessageID HA_CONFIGURATION_SUCCESSFUL;
 extern const isc::log::MessageID HA_CONFIG_AUTO_FAILOVER_DISABLED;
 extern const isc::log::MessageID HA_CONFIG_DHCP_MT_DISABLED;
+extern const isc::log::MessageID HA_CONFIG_DHCP_MT_DISABLED_AND_KEA_MT_ENABLED;
 extern const isc::log::MessageID HA_CONFIG_LEASE_SYNCING_DISABLED;
 extern const isc::log::MessageID HA_CONFIG_LEASE_SYNCING_DISABLED_REMINDER;
 extern const isc::log::MessageID HA_CONFIG_LEASE_UPDATES_AND_SYNCING_DIFFER;
index 52ae8f137361663501843ec9ff504bb0157641c0..c64613e850d71138eb2455d91e445be0eeb1e683 100644 (file)
@@ -124,6 +124,11 @@ sending appropriate ha-scopes command.
 This informational message is issued when HA configuration has enabled
 multi-threading while Kea global configuration has multi-threading disabled.
 
+% HA_CONFIG_DHCP_MT_DISABLED_AND_KEA_MT_ENABLED HA multi-threading is disabled while Kea global multi-threading is enabled which most likely cause performance degradation.
+This warning message is issued when HA configuration has disabled
+multi-threading while Kea global configuration has multi-threading enabled.
+This will likely cause performance degradation.
+
 % HA_CONFIG_LEASE_SYNCING_DISABLED lease database synchronization between HA servers is disabled
 This warning message is issued when the lease database synchronization is
 administratively disabled. This is valid configuration if the leases are