From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwO1g-0004Xn-T1 for qemu-devel@nongnu.org; Thu, 26 Dec 2013 22:23:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VwO1c-0008U7-1a for qemu-devel@nongnu.org; Thu, 26 Dec 2013 22:23:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VwO1b-0008U3-Om for qemu-devel@nongnu.org; Thu, 26 Dec 2013 22:23:47 -0500 Message-ID: <52BCF2B1.8050108@redhat.com> Date: Fri, 27 Dec 2013 11:23:29 +0800 From: Fam Zheng MIME-Version: 1.0 References: <1388074792-29946-1-git-send-email-pl@kamp.de> In-Reply-To: <1388074792-29946-1-git-send-email-pl@kamp.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH] qcow2: add a readahead cache for qcow2_decompress_cluster List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven , qemu-devel@nongnu.org Cc: kwolf@redhat.com, pbonzini@redhat.com, ronniesahlberg@gmail.com, stefanha@redhat.com On 2013=E5=B9=B412=E6=9C=8827=E6=97=A5 00:19, Peter Lieven wrote: > while evaluatiing compressed qcow2 images as a good basis for > virtual machine templates I found out that there are a lot > of partly redundant (compressed clusters have common physical > sectors) and relatively short reads. > > This doesn't hurt if the image resides on a local > filesystem where we can benefit from the local page cache, > but it adds a lot of penalty when accessing remote images > on NFS or similar exports. > > This patch effectevily implements a readahead of 2 * cluster_size > which is 2 * 64kB per default resulting in 128kB readahead. This > is the common setting for Linux for instance. > > For example this leads to the following times when converting > a compressed qcow2 image to a local tmpfs partition. > > Old: > time ./qemu-img convert nfs://10.0.0.1/export/VC-Ubuntu-LTS-12.04.2-64b= it.qcow2 /tmp/test.raw > real 0m24.681s > user 0m8.597s > sys 0m4.084s > > New: > time ./qemu-img convert nfs://10.0.0.1/export/VC-Ubuntu-LTS-12.04.2-64b= it.qcow2 /tmp/test.raw > real 0m16.121s > user 0m7.932s > sys 0m2.244s > > Signed-off-by: Peter Lieven > --- > block/qcow2-cluster.c | 27 +++++++++++++++++++++++++-- > block/qcow2.h | 1 + > 2 files changed, 26 insertions(+), 2 deletions(-) I like this idea, but here's a question. Actually, this penalty is=20 common to all protocol drivers: curl, gluster, whatever. Readahead is=20 not only good for compression processing, but also quite helpful for=20 boot: BIOS and GRUB may send sequential 1 sector IO, synchronously, thus=20 suffer from high latency of network communication. So I think if we want=20 to do this, we will want to share it with other format and protocol=20 combinations. Fam