From patchwork Tue Nov 19 13:12:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Patrick Marlier (pamarlie)" X-Patchwork-Id: 11251937 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5885714E5 for ; Tue, 19 Nov 2019 13:20:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2AE92222B5 for ; Tue, 19 Nov 2019 13:20:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=cisco.com header.i=@cisco.com header.b="AxlH8YGT"; dkim=pass (1024-bit key) header.d=cisco.onmicrosoft.com header.i=@cisco.onmicrosoft.com header.b="Hq4UM03O" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727450AbfKSNUG (ORCPT ); Tue, 19 Nov 2019 08:20:06 -0500 Received: from alln-iport-3.cisco.com ([173.37.142.90]:5720 "EHLO alln-iport-3.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725798AbfKSNUG (ORCPT ); Tue, 19 Nov 2019 08:20:06 -0500 X-Greylist: delayed 426 seconds by postgrey-1.27 at vger.kernel.org; Tue, 19 Nov 2019 08:20:05 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1918; q=dns/txt; s=iport; t=1574169605; x=1575379205; h=from:to:subject:date:message-id: content-transfer-encoding:mime-version; bh=ALfJX9ZtrWP2art7ejGueuQPkoQ70DVwJpwGBsJDkxs=; b=AxlH8YGTJAEU2VjvNymAatPXqMb66mvhE8jYgSL0JkU12VIJubiFA4rM cBZmsyjs74+ggJyDqrmlSRgizfhheneZalt9G07G/iUrCc5bCtDmIzkap QMAtqtwRFc5bqdt+cbv74thH6rUZaaQ7iBjvzid14SmscehB3dYK7PB0h U=; X-IPAS-Result: A0DoDwCH6dNd/5BdJa1lgkSBS1AFgUQgBAsqh3ADinVOmhCBLhSBEANUCQEBAQwBAS0CAQGEQAKCJCQ0CQ4CAwEBAQMCAwIBAQQBAQECAQUEbYU3AQuFahUZAQE4EQEcZBQTBBMIDA6FRwMuAaVUAoE4iGCBdDOCfgEBBYUEGIIXCYE2jBUYgUA/gVeCHoR5OoNAgiyWXpdPCoIrA5VnmhGOSJoIAgQCBAUCDgEBBYFSOYFYcBU7gmxQERSRJheDUIpTdIEojg4BAQ IronPort-PHdr: 9a23:iw4boRUBilNjPNCAou9rwvjrxTPV8LGuZFwc94YnhrRSc6+q45XlOgnF6O5wiEPSA9yJ8OpK3uzRta2oGXcN55qMqjgjSNRNTFdE7KdehAk8GIiAAEz/IuTtankiFcFLTltk8lmwMFNeH4D1YFiB6nA= X-IronPort-Anti-Spam-Filtered: true X-IronPort-AV: E=Sophos;i="5.69,218,1571702400"; d="scan'208";a="383598982" Received: from rcdn-core-8.cisco.com ([173.37.93.144]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 19 Nov 2019 13:12:58 +0000 Received: from XCH-RCD-017.cisco.com (xch-rcd-017.cisco.com [173.37.102.27]) by rcdn-core-8.cisco.com (8.15.2/8.15.2) with ESMTPS id xAJDCwQ5032072 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL) for ; Tue, 19 Nov 2019 13:12:58 GMT Received: from xhs-aln-003.cisco.com (173.37.135.120) by XCH-RCD-017.cisco.com (173.37.102.27) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 19 Nov 2019 07:12:58 -0600 Received: from xhs-rtp-003.cisco.com (64.101.210.230) by xhs-aln-003.cisco.com (173.37.135.120) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 19 Nov 2019 07:12:57 -0600 Received: from NAM03-CO1-obe.outbound.protection.outlook.com (64.101.32.56) by xhs-rtp-003.cisco.com (64.101.210.230) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 19 Nov 2019 08:12:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BMcpgZY1je6hGvUE+iIAu2kCCH/omEcSdymXYp8gmLcZKbdhMceONnzCOqwbJS5ubyB199tA3R4Vrc9ITOg4opHPxd24py3xoIBjqV2WENFZVaZIqVlHBuio8PNdccAkVv7RzN21OhrXKXQrILqWY0iqk8of2XEM6Abcw1IrCxgTrpeY9ZVz2uOx2+rSR6RwPwSkQSRuYimB2AgoYtVQlauG4/di7aZRymwk0evbId3OhaGoXlyCQaA0NBChF8WllCy6gDchoZLUxK6vueaDA6vGKXNOyHiRxvsUBjUHtcsTqvDEzIci+0RpAxXPOs6z0lE/LI6SdD5a4UUI7MOAGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VFT4hl2YI6VM1gDR47206kwu+od8tfKYvh57f4myxSI=; b=SPgBBOsVtiP7iycjqAyHBPbFUqT2UQtKoIatkSGSzDbFpFqpl8bFba+S43RCxEWOdJ5f0yBJqCgeyHTGcj5f798YLeq7+4+pBlqZXHZBGG+7g9+gipTwRB/cRLSJDsf7Gg2kmqkW+/mJvvKMyNww8BzJHlCvx8ZJ4iTLQTqBx84KZyVTtUXrCMhaE84XAdB8B3drl8hBy1ZLm/caKoGFNIJeXFDcpKHv8juLtFl9e/ZFEBKL3mG02aZ3hwHVAejzSPGxF2lsjr4uiJoVlhNZlmuS1sggqSjBMnqP/Wk53g12gVKK1QHoZ7OqXhUjEyAJF43b+MgxKCWVY4r3wbtyIg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cisco.com; dmarc=pass action=none header.from=cisco.com; dkim=pass header.d=cisco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cisco.onmicrosoft.com; s=selector2-cisco-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VFT4hl2YI6VM1gDR47206kwu+od8tfKYvh57f4myxSI=; b=Hq4UM03ObcVaWTNRK1HPU8Lg2DOR1+250mv4fHlHaaWxzU+G0GA0GrTXTVMcjD6GFnHEM/VVNXDKOi2QGuGa61boojReGfyp5Tw9zUI6sIJUkeIWm4LUjC5i9LlN1FshA4E5CMDqLcJCryaITpEj+qqyPYnNPDbb0hoH+cJdTYA= Received: from CH2PR11MB4294.namprd11.prod.outlook.com (10.141.118.210) by CH2PR11MB4454.namprd11.prod.outlook.com (10.186.148.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2451.23; Tue, 19 Nov 2019 13:12:51 +0000 Received: from CH2PR11MB4294.namprd11.prod.outlook.com ([fe80::759a:b24d:909d:853]) by CH2PR11MB4294.namprd11.prod.outlook.com ([fe80::759a:b24d:909d:853%7]) with mapi id 15.20.2451.029; Tue, 19 Nov 2019 13:12:51 +0000 From: "Patrick Marlier (pamarlie)" To: "git@vger.kernel.org" Subject: Push a ref to a remote with many refs Thread-Topic: Push a ref to a remote with many refs Thread-Index: AQHVntgNsCy38IgfMk2h9wErEHyX6A== Date: Tue, 19 Nov 2019 13:12:51 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=pamarlie@cisco.com; x-originating-ip: [2001:420:c0c0:1011::98] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 29cb20b5-b9f4-4241-8f28-08d76cf22ec5 x-ms-traffictypediagnostic: CH2PR11MB4454: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 022649CC2C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(366004)(396003)(39860400002)(346002)(376002)(136003)(199004)(189003)(5660300002)(14454004)(2906002)(74316002)(478600001)(33656002)(99286004)(486006)(91956017)(5640700003)(76116006)(316002)(6436002)(413944005)(6916009)(476003)(9686003)(55016002)(6506007)(8936002)(2351001)(256004)(102836004)(71190400001)(71200400001)(25786009)(6116002)(7696005)(66446008)(305945005)(64756008)(66556008)(8676002)(52536014)(81156014)(81166006)(1730700003)(2501003)(7736002)(186003)(66476007)(66946007)(46003)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:CH2PR11MB4454;H:CH2PR11MB4294.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: cisco.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 6MEVY3Gl87svV5Dpp58YjieS4cNDTGBjWN9DkEmzEcxJkqNVpNe0zuOeIrGmzuYzxiIlh7KJJLBE4qe9SeT1E5VE9X81WjhFC96XKpL0kECgqafcqJNoOhwjDWcr1Wh0vEkMDkUQPdLJHTUDqC5MWImEeqeXyGVqM9d4DmNEabMyvkt9RWrf3JkEFk4GCW652RziM5BQ2m+eHCltCymwkQqmqQMe7CBnpdV1NKnprz2aA2NcdsZxacmgDa4QbwPB4qmMNObqhfKUt34aysKfxcnjetLi6TdX7wZJJeVEIE+TlB5TbEtRY9aNDzeKe9jVnTx1bQzDnFzp36XDZMR4/bwRgAiQCi1Y4npBULd1ZrfczsQh6GccmbgTXhUQjDHkKMd0g3yuss37s5qo1qDx3ES4oddY7CrePTIxnjqV3yvuo8Vogav5W9hfkE7uIOI4 x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 29cb20b5-b9f4-4241-8f28-08d76cf22ec5 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Nov 2019 13:12:51.6280 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 3s85hvDSBiSr6niW6qNJWL0Hzgnl7NmdHGl+mZO4EqN4ktdbgzwA3V8xygLSN7r7holRR06Z4bhDp+6UoYXomA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR11MB4454 X-OriginatorOrg: cisco.com X-Outbound-SMTP-Client: 173.37.102.27, xch-rcd-017.cisco.com X-Outbound-Node: rcdn-core-8.cisco.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Dear git community, I am hitting a performance issue with "git push ". The local repository has only few refs and the remote repository has a lot of refs (1000+) with objects unknown to the local repository. "git push" of only one refspec takes minutes to complete. A quick analysis shows that a lot of time is spent in the client side. A deeper analysis shows that the client receives the entire list of refs on the remote, then the client is checking in its local repository if the objects exist for all remote refs. Since the local repository has a only few refs, most of the objects are unknown. This issue is particularly amplified because the local repository is using many alternates. Indeed for each unknown object, git will try to find in all alternates too. To workaround this issue, I ended up skipping the refs that are not part of the push. See patch at the end of the message. Is this safe to do? Is there a better way to do this? Thanks. Have a nice day, Author: Patrick Marlier Date: Tue Aug 6 21:40:48 2019 +0200 send-pack skip if not part of refspec diff --git a/send-pack.c b/send-pack.c index 34c77cbb1a..0fe899f753 100644 --- a/send-pack.c +++ b/send-pack.c @@ -94,7 +94,7 @@ static int pack_objects(int fd, struct ref *refs, struct oid_array *extra, struc feed_object(&extra->oid[i], po_in, 1); while (refs) { - if (!is_null_oid(&refs->old_oid)) + if (!is_null_oid(&refs->old_oid) && !is_null_oid(&refs->new_oid)) feed_object(&refs->old_oid, po_in, 1); if (!is_null_oid(&refs->new_oid)) feed_object(&refs->new_oid, po_in, 0);