您的位置:首页 > 其它

虚拟机的优化

2016-07-05 23:56 141 查看
[root@ok Desktop]# lscpu
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    2
Core(s) per socket:    2
Socket(s):             1
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 60
Stepping:              3
CPU MHz:               800.000
BogoMIPS:              5188.22
Virtualization:        VT-x
L1d cache:             32K#一级缓存分为数据和指今缓存
L1i cache:             32K#一级缓存是静怸内存
L2 cache:              256K#二级缓存是共享的(一个CPU中的多个核共享)
L3 cache:              3072K#二三是高速的动态内存
NUMA node0 CPU(s):     0-3
[root@ok Desktop]# lscpu -p
# The following is the parsable format, which can be fed to other
# programs. Each different item in every column has an unique ID
# starting from zero.
# CPU,Core,Socket,Node,,L1d,L1i,L2,L3
0,0,0,0,,0,0,0,0
1,0,0,0,,0,0,0,0
2,1,0,0,,1,1,1,0
3,1,0,0,,1,1,1,0


把QEMU进程绑定在CPU上,减少缓存丢失的情况

[root@ok Desktop]# taskset --help
taskset (util-linux-ng 2.17.2)
usage: taskset [options] [mask | cpu-list] [pid | cmd [args...]]
set or get the affinity of a process

-p, --pid                  operate on existing given pid
-c, --cpu-list             display and specify cpus in list format
-h, --help                 display this help
-V, --version              output version information

The default behavior is to run a new command:
taskset 03 sshd -b 1024
You can retrieve the mask of an existing task:
taskset -p 700
Or set it:
taskset -p 03 700
List format uses a comma-separated list instead of a mask:
taskset -pc 0,3,7-11 700
Ranges in list format can take a stride argument:
e.g. 0-31:2 is equivalent to mask 0x55555555


DMA 直接内存访问

大页内存

[root@ok Desktop]# cat /proc/sys/vm/swappiness
60


IO的调度算法;
[root@ok Desktop]# cat /sys/block/sda/queue/scheduler
noop anticipatory deadline [cfq]
默认的是cfq(保证每个进程的IO都比效平均)
deadline:主要用于CPU(如果是数据库的调优的诚征最好是用这种方法)
noop:是没有做何的算法(用SSD的硬盘话 就必需要用这个)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: