许多开发人员、用户和行业都依赖于由 Xen、QEMU/KVM 或 kvmtool 等软件所提供的虚拟化。尽管 QEMU 可以运行基于软件的虚拟机,Xen 可以在没有硬件支持的情况下运行协作的半虚拟化操作系统,当前大多数对虚拟化的使用和部署都依赖于硬件虚拟化。LInux 通过 Kernel Virtual Machine(KVM) API 提供硬件虚拟化功能。在本文中,我们仔细看看 KVM API,直接用它在不使用其他现有的虚拟机实现的情况下直接启动一个虚拟机。
KVM 的十年(2016)
KVM 于 2006 年 10 月 19 日被它的缔造者 Avi Kivity 首次发布在 Linux 内核邮件列表的这个提交中。
第一版的 KVM 补丁支持VMX 指令集,这个指令集刚被 Intel 公布不久。紧接着又支持了 AMD 的SVM 指令集。这个补丁在 2006 年 12 月合并进了上游的内核中,在次年的 2 月随着 2.6.20 版本内核一起发布。
RCU 同步机制
TODO: memory barriar RCU 内存一致性
RCU(Read-copy update)读复制更新机制,用于保护读频繁的数据结构。RCU 在读方面非常高效且可扩展性强(它是 wait-free 的)。
RCU 支持一个 writer 和多个 reader 并行,因此它不会单独使用。通常情况下,写入端会通过一个锁来序列化多个更新,但是其他方法也是可能的(例如:将更新限制为单个任务)。在 QEMU 中,这个锁通常就是“iothread mutex”,也就是熟知的“big QEMU lock”(BQL)。当然,限制为单个任务的方法在 QEMU 中也可以通过“bottom half”API 实现。
RCU 本质上是一个“wait-to-finish”机制。读端使用“critical sections”标记代码段,更新端在执行前会等待所有当前“正在运行”的“critical sections”。
sphinx 文档生成器
QEMU 使用Sphinx
工具生成文档,简单入门一下Sphinx
热迁移预测模型
为用户提供私有云或者 IT 服务,总是伴随着service level agreement(SLA)
。我们需要向客户承诺服务可靠性。对于虚拟机热迁移来说,目前没有可靠的预测热迁移 downtime 和 totaltime 的方法。
主动故障管理的关键概念是在故障实际发生之前就对潜在故障采取行动。目标是执行一些能够防止即将发生的故障的操作,使其不会发生,或者为可能发生的故障准备恢复机制。
关键在于:增加
mean-time-to-failure
(MTTF)或者减少mean-time-to-repair
(MTTR)Accuracy is inversely related to the length of the time interval how far prediction reaches into the future, which is called the failure prediction lead time.
mysql
安装 mysql
由于从 centos7 之后,官方 yum 仓库默认的 mysql 数据库变成了 mariadb,所以要安装 mysql 需要先导入 mysql官方 yum 源
从官方 yum 源选择与你系统版本相同的源下载。我这里是 CentOS7
1 |
|
libvirt 迁移实验
在 zstack 环境下,通过 virsh 直接迁移虚拟机,测试不同选项对虚拟机迁移的影响。
Hammerdb 开启 time profile
In addition to performance profiles based on throughput you should also take note of transaction response times. Whereas performance profiles show the cumulative performance of all of the virtual users running on the system, response times show performance based on the experience of the individual user. When comparing systems both throughput and response time are important comparative measurements. HammerDB includes a time profiling package called etprof that enables you to select an individual user and measure the response times. This functionality is enabled by selecting Time Profile checkbox in the driver options. When enabled the time profile will report response time percentile values at 10 second intervals as well as cumulative values for all of the test at the end of the test run. The time profile values are recorded in microseconds.
衡量数据库的性能指标除了吞吐另一个更重要的是事务的响应时间,事务的响应快慢直接影响用户的体验。HammerDB 使用 etprof 库来统计一次测试中某个独立用户面对的响应时间。
Redis 教程
最近在看数据库相关的东西,正好看到 Redis 挺有意思。记录一下。
libvirt 迁移
相比于 QEMU,在 libvirt 的层面上,虚拟机迁移方式就更为多样灵活。libvirt 上的迁移有多种方式,每种都有自己的优点和缺点,为了最大程度地保证 hypervisor 集成和管理员部署的灵活性,libvirt 实现了多种迁移选择。