From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C146BC433E0 for ; Thu, 4 Mar 2021 11:17:54 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A5ED64F0A for ; Thu, 4 Mar 2021 11:17:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A5ED64F0A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHlzN-0005oS-2m for qemu-devel@archiver.kernel.org; Thu, 04 Mar 2021 06:17:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35098) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHlx2-0004NS-2Y for qemu-devel@nongnu.org; Thu, 04 Mar 2021 06:15:28 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1lHlwx-0002tG-5b for qemu-devel@nongnu.org; Thu, 04 Mar 2021 06:15:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1614856522; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NsS/ir/0UU74yA7CKFg5WsCHSlL8Y1153yVVkOsdXYU=; b=JijAuXBIgaQ5x+ifoeia1bvGp97RC5Rjhg9P8aZXhC+MDCfpmk5a5qAcjZJugz0bnHjJjA u4HB+hwhDp4mc4HWRqhUZ63WGlj6DvW+VWJMtW9vds5LdGVB1vaz4wCqoVANiYEaB+byyt ADXijyL0ptIIl0KzhZmpeMXtGN92fnU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-359-t79r4Ec6NfakXZIRslx5qg-1; Thu, 04 Mar 2021 06:15:20 -0500 X-MC-Unique: t79r4Ec6NfakXZIRslx5qg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 915B2107466A; Thu, 4 Mar 2021 11:15:19 +0000 (UTC) Received: from redhat.com (ovpn-115-33.ams2.redhat.com [10.36.115.33]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7FE51002393; Thu, 4 Mar 2021 11:15:14 +0000 (UTC) Date: Thu, 4 Mar 2021 11:15:11 +0000 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= To: Stefano Garzarella Subject: Re: QEMU RBD is slow with QCOW2 images Message-ID: References: <20210303174058.sdy5ygdfu75xy4rr@steredhat> <20210304085540.ivknwqwrvhko3vxg@steredhat> <20210304111251.2ernxss627lllwqa@steredhat> MIME-Version: 1.0 In-Reply-To: <20210304111251.2ernxss627lllwqa@steredhat> User-Agent: Mutt/2.0.5 (2021-01-21) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=216.205.24.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= Cc: Peter Lieven , dillaman@redhat.com, qemu-devel , qemu-block Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Thu, Mar 04, 2021 at 12:12:51PM +0100, Stefano Garzarella wrote: > On Thu, Mar 04, 2021 at 10:25:33AM +0000, Daniel P. Berrangé wrote: > > On Thu, Mar 04, 2021 at 09:55:40AM +0100, Stefano Garzarella wrote: > > > On Wed, Mar 03, 2021 at 01:47:06PM -0500, Jason Dillaman wrote: > > > > On Wed, Mar 3, 2021 at 12:41 PM Stefano Garzarella wrote: > > > > > > > > > > Hi Jason, > > > > > as reported in this BZ [1], when qemu-img creates a QCOW2 image on RBD > > > > > writing data is very slow compared to a raw file. > > > > > > > > > > Comparing raw vs QCOW2 image creation with RBD I found that we use a > > > > > different object size, for the raw file I see '4 MiB objects', for QCOW2 > > > > > I see '64 KiB objects' as reported on comment 14 [2]. > > > > > This should be the main issue of slowness, indeed forcing in the code 4 > > > > > MiB object size also for QCOW2 increased the speed a lot. > > > > > > > > > > Looking better I discovered that for raw files, we call rbd_create() > > > > > with obj_order = 0 (if 'cluster_size' options is not defined), so the > > > > > default object size is used. > > > > > Instead for QCOW2, we use obj_order = 16, since the default > > > > > 'cluster_size' defined for QCOW2, is 64 KiB. > > > > > > > > > > Using '-o cluster_size=2M' with qemu-img changed only the qcow2 cluster > > > > > size, since in qcow2_co_create_opts() we remove the 'cluster_size' from > > > > > QemuOpts calling qemu_opts_to_qdict_filtered(). > > > > > For some reason that I have yet to understand, after this deletion, > > > > > however remains in QemuOpts the default value of 'cluster_size' for > > > > > qcow2 (64 KiB), that it's used in qemu_rbd_co_create_opts() > > > > > > > > > > At this point my doubts are: > > > > > Does it make sense to use the same cluster_size as qcow2 as object_size > > > > > in RBD? > > > > > > > > No, not really. But it also doesn't really make any sense to put a > > > > QCOW2 image within an RBD image. To clarify from the BZ, OpenStack > > > > does not put QCOW2 images on RBD, it converts QCOW2 images into raw > > > > images to store in RBD. > > > > > > Yes, that was my doubt, thanks for the confirmation. > > > > > > Also Daniel (+CC) confirmed me the same thing, but just to be complete he > > > added that there is a case where OpenStack could use qcow2 on RBD, but in > > > this case using in-kernel RBD, so the QEMU RBD is not involved. > > > > > > > > > > > > If we want to keep the 2 options separated, how can it be done? Should > > > > > we rename the option in block/rbd.c? > > > > > > > > You can already pass overrides to the RBD block driver by just > > > > appending them after the > > > > "rbd:[:option1=value1[:option2=value2]]" portion, perhaps > > > > that could be re-used. > > > > > > I see, we should extend qemu_rbd_parse_filename() to suppurt it. > > > > We shouldn't really be extending the legacy filename syntax. > > If we need extra options we want them in the QAPI schema for > > blockdev. > > Got it. > > I'm still a bit confused about how QemuOpts are handled between format and > protocol drivers. > > It seems that in this case the protocol tries to access some information > from the format (BLOCK_OPT_CLUSTER_SIZE). > > Since the format removes this information from the QemuOpts passed to the > protocol, this takes the default value of the format, even if a different > value is specified. > > Is it correct for a protocol to access BLOCK_OPT_CLUSTER_SIZE? In a -blockdev world, the caller would be expected to set the values explicitly at all layers that need it. You're talking about a scenario that is non-blockdev though, and I'm not sure what the right answer is here. Will need Kevin/Max to answer that one. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|