4

QCOW2的几种预分配规则创建时间对比

 3 years ago
source link: https://www.taterli.com/8138/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

QCOW2的几种预分配规则创建时间对比

  • TaterLi
  • 2021年7月25日2021年7月25日

主要有以下几种策略,都在同一个SSD上测试.

  • off => 缺省预分配策略,即不使用预分配策略.
  • metadata => 分配qcow2的元数据(metadata),预分配后的虚拟磁盘仍然属于稀疏映像类型,分配元数据所需的空间,但不为数据分配任何空间,这是配置是预分配里最快的,但客户机写入最慢.
  • falloc => 为元数据和数据分配空间,但将块标记为未分配,这将比metadata配置得慢,但比full配置要快,客户机写入性能将比metadata快得多,并且接近full.
  • full => 分配所有磁盘空间并置零,预分配后的虚拟磁盘属于非稀疏映像类型,并且性能和宿主机差不多,但是这个分配非常的慢.

分配速度测试:

root@debian:/var/lib/libvirt/images# time qemu-img create -f qcow2 -o preallocation=off /var/lib/libvirt/images/seedbox.qcow2 500G
Formatting '/var/lib/libvirt/images/seedbox.qcow2', fmt=qcow2 size=536870912000 cluster_size=65536 preallocation=off lazy_refcounts=off refcount_bits=16

real    0m0.144s
user    0m0.000s
sys     0m0.029s
root@debian:/var/lib/libvirt/images# time qemu-img create -f qcow2 -o preallocation=metadata /var/lib/libvirt/images/seedbox.qcow2 500G
Formatting '/var/lib/libvirt/images/seedbox.qcow2', fmt=qcow2 size=536870912000 cluster_size=65536 preallocation=metadata lazy_refcounts=off refcount_bits=16

real    1m19.068s
user    0m3.763s
sys     0m1.151s
root@debian:/var/lib/libvirt/images# time qemu-img create -f qcow2 -o preallocation=falloc /var/lib/libvirt/images/seedbox.qcow2 500G
Formatting '/var/lib/libvirt/images/seedbox.qcow2', fmt=qcow2 size=536870912000 cluster_size=65536 preallocation=falloc lazy_refcounts=off refcount_bits=16

real    1m28.153s
user    0m3.723s
sys     0m1.766s
root@debian:/var/lib/libvirt/images# time qemu-img create -f qcow2 -o preallocation=full /var/lib/libvirt/images/seedbox.qcow2 500G
Formatting '/var/lib/libvirt/images/seedbox.qcow2', fmt=qcow2 size=536870912000 cluster_size=65536 preallocation=falloc lazy_refcounts=off refcount_bits=16

real    43m11.214s
user    0m3.721s
sys     0m1.216s

所以除非特别纠结,不然还是falloc最划算.

发表评论 取消回复

您的电子邮箱地址不会被公开。 必填项已用*标注

评论

显示名称 *

电子邮箱地址 *

网站地址


Recommend

  • 22

    “ 一个人的精力是有限的,事事做到完美,那只会把自己累死。” 相信大家都会遇到这样的情况,就是1个人对接很多的产品经理、跟好几个项目,应接不暇,忙的透不过气。 嗯,很多面试官也喜欢问这个问题,你怎么答?

  • 12
    • jdhao.github.io 3 years ago
    • Cache

    几种中文分词工具对比

    几种中文分词工具对比2020-11-20Note538 words 2 mins read 127 times read对几种中文分词工具进行了调研,简单总结一下。这里只用了三种开源的分词工具,...

  • 8
    • blogs.igalia.com 3 years ago
    • Cache

    Subcluster allocation for qcow2 images

    In previous blog posts I talked about QEMU’s qcow2 file format and how to make it faster. This post gives an overview...

  • 6

    “Improving the performance of the qcow2 format” at KVM Forum 2017 1 Reply ...

  • 4

    在 .NET 中创建对象的几种方式的对比 在 .net 中,创建一个对象最简单的方法是直接使...

  • 12

    How To Convert VirtualBox Disk Image (VDI) and img to Qcow2 formatThis simple guide will show you the easiest way to convert VDI disk image to use on your Openstack Cloud environ...

  • 10

    常用的几款消息队列的对比 消息队列的作用: 1、应用耦合:多应用间通过消息队列对同一消息进行处理,避免调用接口失败导致整个过程失败; 2、异步处理:多应用对消息队列中同一消息进行处理,应用间并发处理消息,相比串行处理,减少...

  • 5

    3.2 安装 cloud-init 软件包 根据 2.3.5 小节测试,kvm 虚机可正常连通外网,此时直接在线安装软件包即可。目的是为了可以获取到客户自定义元数据信息,如主机名及root密码等。

  • 3
    • gist.github.com 1 year ago
    • Cache

    How to mount a qcow2 disk image

    How to mount a qcow2 disk image How to mount a qcow2 disk image This is a quick guide to mounting a qcow2 d...

  • 3
    • wuxinhua.com 1 year ago
    • Cache

    对比几种常见的排序算法

    对比几种常见的排序算法@0xinhua 发布于 2017年12月13日计算机科学里,排序算法是最基础算法之一,排序的方式有很多种,例如我们常见的冒泡排序、插入排序、快排等,这类需要对系列值进行比较的方法,称为基于比较排序...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK