内存的调优
1.内存测试
安装内存测试软件:memtest
rpm -ivh /media/Packages/memtest86+-4.10-2.el6.x86_64.rpm
内存测试:
memtest-setup
执行结果查看:
cat /etc/grub.conf //启动项已经添加了一个启动选项
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda2
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=1
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Memtest86+ (4.10)
root (hd0,0)
kernel --type=netbsd /elf-memtest86+-4.10
title Red Hat Enterprise Linux(2.6.32-431.el6.x86_64)
root(hd0,0)
kernel/vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=1760ae83-ad1c-48dd-8785-915950691d72 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd/initramfs-2.6.32-431.el6.x86_64.img
reboot
2.内存缓存
BUFFER 索引缓存 缓存 写时用,先写入到内存
CACHE 页缓存 快取 读时用,先读入到内存
buffers #缓存从磁盘读出的内容,这种理解是片面的
cached #缓存需要写入磁盘的内容,这种理解是片面的
终端1:[root@localhost ~]# free -m
终端2:[root@localhost ~]# find /
CACHE:页缓存, 内存页是内存中的最小存储单位,一页尺寸4kB
对象文件系统 块block 1kB 2kB 4kB
扇区sectors 512b
终端1: [root@localhost ~]# free -m //查看 buffer 增长
total used free shared buffers cached
Mem: 1004412 462792 541620 0 27892 190344
-/+ buffers/cache: 244556 759856
Swap: 1048568 0 1048568
手动清空buffer+cache :
查看缓存
[root@localhost ~]# cat /proc/sys/vm/drop_caches //默认是 0
[root@localhost ~]# free –m
total used free shared buffers cached
Mem: 1137 783 353 0 67 411
-/+ buffers/cache: 303 833
Swap: 999 0 999
清空缓存:
sync
#内存和硬盘的数同步,内存数据写入硬盘
echo 1 > /proc/sys/vm/drop_caches
#清空缓存
查看清空结果
[root@localhost ~]# free -m
total used free shared buffers cached
Mem: 1137 367 770 0 0 67
-/+ buffers/cache: 299 838
Swap: 999 0 999