IBM Cloud VPC Gen2 - x86和Power虚机实例比较
偶然发现IBM公有云VPC(第二代)里x86实例已从Xen转向KVM了,更惊讶的是居然支持Power…要知道Power主机的RISC和MIPS多处理器体系结构,致力追求RAS三高,其运算能力和稳定性一直定位于传统企业客户,主要用于金融领域的核心业务和复杂信息管理系统。而且,早年Power平台的硬伤就是性价比低、操作系统门槛儿高,所以Power指令集开源后IBM一直专注openpower生态、PowerAI和大数据应用场景。但x86当道的公有云,IBMCloud在世人眼里可用“奇葩”形容,解决方案多,云服务种类多,再就是IaaS异构虚拟化多(裸金属和vmware且不说,还有HyperProtect虚机,mainframe都搬到云端了啊!!!),相信Power虚机的推出不是为了情怀, 差异化竞争,应对企业的混合负载,才是云商生存法则。 令鄙人感到过分意外的是,Power实例在价格上与x86无比接近(同规格例如16核/64G貌似较x86还要便宜几十刀,IBM想干嘛?…)
一直想搞清楚两者虚机在用户OS层面不同点到底在哪儿,尤其是性能和体验的PK,借此机会感受下IBM Cloud这两种VPC虚机实例。
测试环境:
- 同一个VPC网络下的x86 和Power虚机实例
- 虚机规格:B2 - 2c X 8g
测试内容:
- sysbench分别测试CPU、内存 、磁盘
- iperf测试网卡带宽
- 实例做web服务,内网ab测试
1. 创建Gen2 VPC和子网
1.1 登陆cloud.ibm.com , 先创建VPC,选择第二代,定义VPC名称,选择好资源组,也可放在“Default”
1.2 选择VPC ACL策略,勾选安全组的两个规则SSH和Ping(方便后面远程连接),然后定义一个子网,这里我选择将其建在Dallas-3数据中心。
2. 创建VPC Gen2 x86和Power虚机实例
基本步骤:
a. 选择规格 为bx2 – 2c*8g(缺省情况bx2 x86网卡带宽为4Gbps,而Power是6Gbps)
b. 选择操作系统,这里我选centos7.x最小安装
c. 选择默认系统boot磁盘,100G容量,3000 IOPS(max)
d. 添加一块连接管理子网(mgmt-net)的虚拟网卡
e. Floating IP分配给x86虚拟机(demo-vsi-x86)作为vpc跳板
f. 添加系统远程访问的ssh公钥证书
整个过程非常方便,值得 一提的是两种虚机从创建到就绪时间不到半分钟, 比之前Xen 虚机实例快了好多倍!!!
下图以x86虚拟机创建为例,Power的唯一不同点就是选择不同处理器平台
3. SSH登陆虚拟机
我们可以看到Hypervisor都是kvm,一个是标准的x86开源 ,一个是ibm power(ppc64)平台的kvm移植;CPU架构不同,而且PowerPC在OS和内核版本明显高一点点。
[root@demo-vsi-x86 ~]# virt-what; cat /etc/redhat-release; uname -r
kvm
CentOS Linux release 7.6.1810 (Core)
3.10.0-957.12.2.el7.x86_64
[root@demo-vsi-power ~]# virt-what; cat /etc/redhat-release; uname -r
kvm
ibm_power-kvm
CentOS Linux release 7.7.1908 (AltArch)
3.10.0-1062.1.2.el7.ppc64le
4. 安装sysbench、fio、apache、iperf3 等测试工具
从软件安装部署上看power虚机和x86并无太多差别,centos系统yum源支持也很到位,常见主流应用基本可以直接获取,传统x86 Linux管理员的系统管理标准以及运维流程在power上可以完全复用。
以sysbench为例:
x86
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash
sudo yum -y install sysbench
Power
貌似无法直接yum安装,需要自己编译,下面步骤以供参考,相对i386和x86_64,ppc64开源项目的安装包势必给 IT自动化运维带来困惑,好在源码基本都能找到并支持编译。
## Install required packages
yum -y install make automake libtool pkgconfig libaio-devel
# For MySQL support, replace with mysql-devel on RHEL/CentOS 5
yum -y install mariadb-devel openssl-devel
# For PostgreSQL support
yum -y install postgresql-devel
# clone latest sysbench
git clone https://github.com/akopytov/sysbench.git
# replace LuaJIAT bundle with the version including “pc64le” support fix.
cd /root/tools/sysbench/sysbench/third_party/luajit; rm -rf luajit
git clone https://github.com/PPC64/LuaJIT.git luajit
## compile ppc64le sysbench
cd /root/tools/sysbench/sysbench; ./autogen.sh
# Add --with-pgsql to build with PostgreSQL support
./configure
make -j
make install
#test sysbench
[root@demo-vsi-power ~]# sysbench --version
sysbench 1.1.0-bd4b418
5. 性能比较
5.1 sysbench - CPU test
sysbench CPU测试原理主要进行素数的加法运算,当最大素数、线程数以及运行时间指定的情况下,比较cpu speed以及处理event个数,速度越快性能越好。
sysbench cpu --cpu-max-prime=20000 --threads=2 --time=60 run
x86 (默认2核心)
[root@demo-vsi-x86 ~]# lscpu |egrep On-line
On-line CPU(s) list: 0,1
Power (默认2核心)
[root@demo-vsi-power ~]# lscpu |egrep On-line
On-line CPU(s) list: 0,1
对比可以看到,Power vCPU性能基本碾压x86,每秒处理event以及60秒内处理event总数比x86快三倍多,平均延迟(1.03ms)比x86(3.94)低近3.5倍。通过改变并发线程数目,以及素数最大值和运行时间,执行三次测试结果基本保持一致。
5.2 sysbench - mem test
OS里可用内存都为7.5G,每台机器运行两种访问类型测试(顺序和随机)
[root@demo-vsi-x86 ~]# lsmem |egrep 'online memory'
Total online memory: 7.5G
[root@demo-vsi-power ~]# lsmem |egrep 'online memory'
Total online memory: 7.5G
# 顺序
sysbench memory --threads=10 --events=10000 --memory-block-size=4K --memory-total-size=100G --memory-access-mode=seq run
# 随机
sysbench memory --threads=10 --events=10000 --memory-block-size=4K --memory-total-size=100G --memory-access-mode=rnd run
测试中发现–threads并没有什么用途, 而且–memory-total-size并不是当前系统可用内存总量,而是整个测试写入操作占用的地址空间总量(满了就会释放,不用担心)
两种情况下x86略优于power,power内存没有想象中那么出众,不知道是不是与测试场景有关 ,继续磁盘…
5.3 sysbench - fileio test
这里没有条件再外挂云存储,所以直接针对boot volume进行I/O测试,看看承诺的3000 IOPS是否可以达到。
一般云商都推荐FIO来去飙max iops, 由于sysbench遍历128个文件,对于2核心的VM难免有点牵强,第二个原因sysbench libaio缺省时未生效,再加上文件读写模式默认也不是direct,而且还有涉及到系统缓存的fsync操作影响,所以大家觉得sysbench测iops不准。 这里想尝试下sysbench并刻意规避一些干扰项,看看结果能否达到FIO一样的水准。(注:FIO的结果是两种虚机IOPS都可以达到3000)
fileio命令三部曲:
sysbench fileio --file-total-size=5G --file-test-mode=rndrw --time=60 --file-io-mode=async --file-extra-flags=direct --file-num=1 --file-rw-ratio=1 --file-fsync-freq=0 prepare
sysbench fileio --file-total-size=5G --file-test-mode=rndrw --time=60 --file-io-mode=async --file-extra-flags=direct --file-num=1 --file-rw-ratio=1 --file-fsync-freq=0 run
sysbench fileio --file-total-size=5G --file-test-mode=rndrw --time=60 --file-io-mode=async --file-extra-flags=direct --file-num=1 --file-rw-ratio=1 --file-fsync-freq=0 cleanup
x86 -> 3043 IOPS
Power -> 3050 IOPS
结果很直观,两者boot分区 IOPS平分秋色,都可以达到3000
5.4 iperf3 bandwidth test
虚拟机网卡带宽限制一直是云商颇感神秘的地方 ,aws EC2 m4(2c x 8g) 只提供“Moderate”等级的带宽,依照网上共享的内网测试结果最大不超过700Mbps。 IBM Cloud x86 b2同样规格默认4Gbps,Power为6Gbps,为了公平验证,在vpc里再开一个8Gbps的实例做为iperf服务端,以便x86和power能够达到带宽极限,接下来看看IBM是否厚道?
结果如下 ,两个虚拟实例的网卡带宽都能达到承诺的size(4Gbps and 6Gbps),显而易见,Power更胜一筹!
x86 --> 4.44Gbps
[root@demo-vsi-x86 ~]# iperf3 -c 10.240.128.11 -i 1 -t 5 --parallel 2
Connecting to host 10.240.128.11, port 5201
[ 4] local 10.240.128.4 port 48886 connected to 10.240.128.11 port 5201
[ 6] local 10.240.128.4 port 48888 connected to 10.240.128.11 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 391 MBytes 3.28 Gbits/sec 0 1.58 MBytes
[ 6] 0.00-1.00 sec 310 MBytes 2.60 Gbits/sec 0 1.58 MBytes
[SUM] 0.00-1.00 sec 701 MBytes 5.88 Gbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 1.00-2.00 sec 265 MBytes 2.22 Gbits/sec 0 2.01 MBytes
[ 6] 1.00-2.00 sec 221 MBytes 1.86 Gbits/sec 0 1.99 MBytes
[SUM] 1.00-2.00 sec 486 MBytes 4.08 Gbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 2.00-3.00 sec 252 MBytes 2.12 Gbits/sec 0 2.26 MBytes
[ 6] 2.00-3.00 sec 231 MBytes 1.94 Gbits/sec 0 2.17 MBytes
[SUM] 2.00-3.00 sec 484 MBytes 4.06 Gbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 3.00-4.00 sec 254 MBytes 2.13 Gbits/sec 0 2.52 MBytes
[ 6] 3.00-4.00 sec 236 MBytes 1.98 Gbits/sec 0 2.27 MBytes
[SUM] 3.00-4.00 sec 490 MBytes 4.11 Gbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 4.00-5.00 sec 246 MBytes 2.07 Gbits/sec 0 2.82 MBytes
[ 6] 4.00-5.00 sec 242 MBytes 2.03 Gbits/sec 0 2.48 MBytes
[SUM] 4.00-5.00 sec 489 MBytes 4.10 Gbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-5.00 sec 1.38 GBytes 2.36 Gbits/sec 0 sender
[ 4] 0.00-5.00 sec 1.37 GBytes 2.36 Gbits/sec receiver
[ 6] 0.00-5.00 sec 1.21 GBytes 2.08 Gbits/sec 0 sender
[ 6] 0.00-5.00 sec 1.21 GBytes 2.08 Gbits/sec receiver
[SUM] 0.00-5.00 sec 2.59 GBytes 4.45 Gbits/sec 0 sender
[SUM] 0.00-5.00 sec 2.58 GBytes 4.44 Gbits/sec receiver
Power --> 6.05Gbps
[root@demo-vsi-power ~]# iperf3 -c 10.240.128.11 -i 1 -t 5 --parallel 2
Connecting to host 10.240.128.11, port 5201
[ 4] local 10.240.128.5 port 39740 connected to 10.240.128.11 port 5201
[ 6] local 10.240.128.5 port 39742 connected to 10.240.128.11 port 5201
[ ID] Interval Transfer Bandwidth Retr Cwnd
[ 4] 0.00-1.00 sec 465 MBytes 3.90 Gbits/sec 0 1.52 MBytes
[ 6] 0.00-1.00 sec 432 MBytes 3.63 Gbits/sec 0 1.38 MBytes
[SUM] 0.00-1.00 sec 897 MBytes 7.52 Gbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 1.00-2.00 sec 342 MBytes 2.87 Gbits/sec 0 2.03 MBytes
[ 6] 1.00-2.00 sec 336 MBytes 2.82 Gbits/sec 0 1.87 MBytes
[SUM] 1.00-2.00 sec 679 MBytes 5.69 Gbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 2.00-3.00 sec 341 MBytes 2.86 Gbits/sec 58 1.67 MBytes
[ 6] 2.00-3.00 sec 339 MBytes 2.84 Gbits/sec 0 2.22 MBytes
[SUM] 2.00-3.00 sec 680 MBytes 5.70 Gbits/sec 58
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 3.00-4.00 sec 312 MBytes 2.62 Gbits/sec 0 1.85 MBytes
[ 6] 3.00-4.00 sec 366 MBytes 3.07 Gbits/sec 1 2.49 MBytes
[SUM] 3.00-4.00 sec 679 MBytes 5.69 Gbits/sec 1
- - - - - - - - - - - - - - - - - - - - - - - - -
[ 4] 4.00-5.00 sec 315 MBytes 2.64 Gbits/sec 0 1.99 MBytes
[ 6] 4.00-5.00 sec 366 MBytes 3.07 Gbits/sec 0 2.55 MBytes
[SUM] 4.00-5.00 sec 681 MBytes 5.71 Gbits/sec 0
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth Retr
[ 4] 0.00-5.00 sec 1.73 GBytes 2.98 Gbits/sec 58 sender
[ 4] 0.00-5.00 sec 1.73 GBytes 2.97 Gbits/sec receiver
[ 6] 0.00-5.00 sec 1.80 GBytes 3.09 Gbits/sec 1 sender
[ 6] 0.00-5.00 sec 1.79 GBytes 3.08 Gbits/sec receiver
[SUM] 0.00-5.00 sec 3.53 GBytes 6.07 Gbits/sec 59 sender
[SUM] 0.00-5.00 sec 3.52 GBytes 6.05 Gbits/sec receiver
iperf Done.
5.5 apache ab test
两种机型同规格价格相似(Power略便宜),有一点需要指出,尽管控制台虚拟机cpu大小都是2核心,Power虚拟处理器在SMT-4(并发多线程)支持下,用户在OS里可自定义激活4颗vcpu,所以我们分别对x86-2c, Power-2c 以及Power-4c 三种CPU配置 分别进行http并发测试,发现不论哪种情况,Power web服务整体性能是优于x86的。同样的价格 ,ppc感觉能做到更多,惊艳 …!!!
# Power - Enable offline CPUs
[root@demo-vsi-power ~]# chcpu -e 2,3
CPU 2 enabled
CPU 3 enabled
[root@demo-vsi-power ~]# lscpu |egrep On-line
On-line CPU(s) list: 0-3
总结:作为IBM Cloud VPC最新的虚机实例 ,同规格的Power在处理器、虚拟网卡以及整体服务性能上是明显占优的;并且绝大多数x86 linux开源应用都可迁移到ppc下运行,在其他云商开始角逐基于ARM架构下的全新计算服务,Power-based云主机的出现,对于出海业务的用户来说未尝不是一个选择,至少从性价比上看,它追求的可不是 “低功效” ! :)