posir 发表于 2017-6-25 17:07:48

虚拟机的优化

# 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
# 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上,减少缓存丢失的情况



# taskset --help
taskset (util-linux-ng 2.17.2)
usage: taskset ]
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 直接内存访问
  大页内存



# cat /proc/sys/vm/swappiness
60




IO的调度算法;
# cat /sys/block/sda/queue/scheduler
noop anticipatory deadline
默认的是cfq(保证每个进程的IO都比效平均)
deadline:主要用于CPU(如果是数据库的调优的诚征最好是用这种方法)
noop:是没有做何的算法(用SSD的硬盘话 就必需要用这个)
页: [1]
查看完整版本: 虚拟机的优化