0917 内库被缓存占用

上一篇 / 下一篇  2014-09-17 17:24:34 / 个人分类:LR性能测试

问题现象:跑中期收租时,生成话单比较慢,只有250TPS,top命令查看,发现CBE进程占用内存并不是非常大,Mem 的Free只有700多M,内存到底哪里去了呢?
估计内存可能被缓存占用了,上网查了资料,使用echo 3 > /proc/sys/vm/drop_caches
可以释放缓存占用的内存。
linux-wzq02 mdsp/smdb> free -m
             total       used       free     shared    buffers     cached
Mem:         24099      22021       2078          0         69      14684
-/+ buffers/cache:       7266      16832
Swap:         2055        238       1817
linux-wzq02 mdsp/smdb> su - root
Password:
root@linux-wzq02:[/root]swapoff-a
root@linux-wzq02:[/root]
root@linux-wzq02:[/root]free-m
             total       used       free     shared    buffers     cached
Mem:         24099      22254       1845          0         69      14922
-/+ buffers/cache:       7262      16837
Swap:            0          0          0
root@linux-wzq02:[/root]echo3 > /proc/sys/vm/drop_caches
root@linux-wzq02:[/root]
root@linux-wzq02:[/root]free-m
             total       used       free     shared    buffers     cached
Mem:         24099      19248       4850          0          2      12035
-/+ buffers/cache:       7210      16888
Swap:            0          0          0
root@linux-wzq02:[/root]swapon-a
root@linux-wzq02:[/root]free-m
             total       used       free     shared    buffers     cached
Mem:         24099      19248       4850          0          2      12034
-/+ buffers/cache:       7210      16888
Swap:         2055          0       2055
 
--网摘:
有时内存被缓存占用,导致SWAP空间影响性能,
Linux系统的缓存机制是相当先进的,他会针对dentry(用于VFS,加速文件路径名到inode的转换)、Buffer Cache(针对磁盘块的读写)和Page Cache(针对文件inode的读写)进行缓存操作。但是在进行了大量文件操作之后,缓存会把内存资源基本用光。但实际上我们文件操作已经完成,这部分缓存已经用不到了。这个时候,我们难道只能眼睁睁的看着缓存把内存空间占据掉么?

#! /bin/bash
# cache释放:
# To free pagecache:
sync
sync
#echo 1 > /proc/sys/vm/drop_caches
# To free dentries and inodes:
#echo 2 > /proc/sys/vm/drop_caches
# To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches

TAG:

 

评分:0

我来说两句

Open Toolbar