From patchwork Fri Aug 23 11:23:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1152126 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46FJtJ5Z6Cz9s00 for ; Fri, 23 Aug 2019 21:23:20 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A2F38D9C; Fri, 23 Aug 2019 11:23:16 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 810A4D98 for ; Fri, 23 Aug 2019 11:23:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2621289B for ; Fri, 23 Aug 2019 11:23:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7555C10F23E5 for ; Fri, 23 Aug 2019 11:23:14 +0000 (UTC) Received: from dceara.remote.csb (ovpn-117-75.ams2.redhat.com [10.36.117.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF3835F9D3 for ; Fri, 23 Aug 2019 11:23:13 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Fri, 23 Aug 2019 13:23:09 +0200 Message-Id: <20190823112304.30602.63778.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Fri, 23 Aug 2019 11:23:14 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v2 ovn 0/3] ovn-controller: Logical flow processing optimizations X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This series adds some (independent) optimizations that improve ovn-controller performance by lowering the number of operations that need to be executed during a iteration of the main controller loop. Each patch in the series addresses a bottleneck reported by running `perf record -g --call-graph dwarf -i /usr/bin/ovn-controller` on a system where the Southbound DB was already populated by ovn-northd. The logical configuration of the OVN is: - 500 logical routers - 1 logical switch attached to each router - 2 logical ports attached to each switch - 4 ACLs per switch To evaluate the performance impact of the change in a more realistic way the following test is performed (on a single node that runs ovn-northd and ovn-controller and emulates the VM hosts with OVS internal interfaces): 1. Start ovs-vswitchd. 2. Remove the Southbound DB such that ovn-northd needs to repopulate everything based on the Northbound DB contents. 3. Start a patched version of ovn-controller such that it tracks loop time execution information and how long it takes to process all logical flows from the Southbound DB. 4. At the same time with step 3 above, start ovn-northd which will populate the Southbound DB. The following measurements are taken: - real time (measured with `time`) to have all corresponding openflow flows processed by ovs-vswitchd. - maximum ovn-controller main loop iteration duration - average ovn-controller main loop iteration duration - number of times ovn-controller executes the main loop until all logical flows are processed Comparing the results before and after this series we see: - 13% performance boost w.r.t. real time taken to have all openflow flows installed in ovs-vswitchd - 41% decrease of average ovn-controller loop iteration duration and 12% increase of ovn-controller number of loop iterations. Essentially processing loops are faster and can happen more often. - 2% decrease of maximum ovn-controller main loop iteration duration. Dumitru Ceara (3): ofctrl: Avoid recomputing match hash in ofctrl_dup_flow(). ovn-controller: Optimize update of ct-zones external-ids. ovn-controller: Minimize SB DB port_binding lookups. controller/binding.c | 19 ++++++++++++--- controller/ofctrl.c | 2 +- controller/ovn-controller.c | 53 +++++++++++++++++++++++++++++++++++++------ controller/ovn-controller.h | 11 ++++++++- controller/physical.c | 4 ++- controller/pinctrl.c | 53 +++++++++++-------------------------------- 6 files changed, 87 insertions(+), 55 deletions(-) --- v2: Send series for OVN repo instead of OVS.