Show Table of Contents
6.3. 缓存
缓存选项可以在客机安装期间用 virt-manager 进行配置,或通过编辑客机 XML 配置在现存的客户虚拟机中配置。
表 6.1. 缓存选项
| 缓存选项 | 描述 |
|---|---|
| Cache=none | 客机中的 I/O 不能在主机上缓存,但可以保留在回写磁盘缓存中。在客机中使用此选项来应对较大的需求。此选项通常是支持迁移的最佳和唯一选项。 |
| Cache=writethrough | 客机中的 I/O 在主机上缓存,但在物理媒介中直写。该模式较慢且更易造成缩放问题。最好是在客机数量较小且 I/O 需求较低的情况下使用。推荐的应用对象是无需迁移、不支持回写缓存的客机(如 Red Hat Enterprise Linux 5.5 或更早的版本)。 |
| Cache=writeback | 客机中的 I/O 在主机上缓存。 |
| Cache=directsync | 与 writethrough 相似,但客机中的 I/O 将忽略主机页面缓存。 |
| Cache=unsafe | 主机可能会缓存所有的 I/O 磁盘,客机的同步要求将被忽略。 |
| Cache=default | 如果没有指定缓存模式,将会选择系统默认设置。 |
在客机 XML 中配置缓存模式,请编辑设置在
driver 标签内部的 cache,指定一个缓存选项。例如,将缓存设置为 writeback:
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='writeback'/>

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.