From patchwork Fri Sep 9 21:32:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Maximets X-Patchwork-Id: 1676251 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MPTjw3kCMz1ynm for ; Sat, 10 Sep 2022 07:32:48 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 12FD7610DE; Fri, 9 Sep 2022 21:32:44 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 12FD7610DE X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 61sYkgVa27EQ; Fri, 9 Sep 2022 21:32:43 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 2851A60F20; Fri, 9 Sep 2022 21:32:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2851A60F20 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id CF484C0032; Fri, 9 Sep 2022 21:32:41 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3040EC002D for ; Fri, 9 Sep 2022 21:32:40 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id DEC014193B for ; Fri, 9 Sep 2022 21:32:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org DEC014193B X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ja5VK-uc7CGS for ; Fri, 9 Sep 2022 21:32:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org A422041934 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by smtp4.osuosl.org (Postfix) with ESMTPS id A422041934 for ; Fri, 9 Sep 2022 21:32:34 +0000 (UTC) Received: (Authenticated sender: i.maximets@ovn.org) by mail.gandi.net (Postfix) with ESMTPSA id 81FBF2000A; Fri, 9 Sep 2022 21:32:27 +0000 (UTC) From: Ilya Maximets To: ovs-dev@openvswitch.org Date: Fri, 9 Sep 2022 23:32:19 +0200 Message-Id: <20220909213223.824013-1-i.maximets@ovn.org> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Cc: Ilya Maximets , Dumitru Ceara Subject: [ovs-dev] [PATCH ovn v3 0/4] northd: Optimize preparation of load balancers. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Re-compute of 'northd' node in ovn-northd may take almost half of the total processing time in case there is a big number of load balancers applied to multiple switches/routers or if there are huge load balancer groups applied to them. The latter is a common case for ovn-kubernetes clusters. This patch set is a result of profiling ovn-northd in ovn-heater density-heavy scenario with 500 fake nodes, which supposed to resemble high scale ovn-kubernetes setups. There are no functional changes, only mechanical optimizations that allows to achieve exactly the same result by doing less work. In total these patches allowed to speed up ovn-northd in the aforementioned scenario by about 40%. For exmaple, average northd poll interval went down from 19.7 seconds to 10.2 seconds. And the maximum poll interval reduced from 31.7 to 14.9 seconds. Version 2: - Moved LB-specific structures and function to lib/lb.[c,h]. - 'ods' array in struct ovn_lb_group split in two: ls and lr. - Added missed handling of 'skip_snat' and 'event' options. - Minor re-base/re-factor. - Added 'Acked-by' from Dumitru to patches 1 and 4. Version 3: - Code to manage struct ovn_lb_group split into separate functions in lib/lb.[c,h]: * ovn_lb_group_create() * ovn_lb_group_destroy() * ovn_lb_group_add_ls/lr() - Added 'Acked-by' from Dumitru to remaining patches. Ilya Maximets (4): northd: Optimize load balancer lookups for groups. northd: Add datapaths to load balancers in bulk. northd: Retrieve load balancer options only once. northd: Re-use IP sets created for load balancer groups. lib/lb.c | 126 +++++++++++++++++++++++-- lib/lb.h | 75 +++++++++++++-- northd/en-northd.c | 2 + northd/northd.c | 229 ++++++++++++++++++++++++++------------------- northd/northd.h | 16 ++-- 5 files changed, 328 insertions(+), 120 deletions(-)