Sponsored Content
Top Forums UNIX for Advanced & Expert Users echo 1 > /proc/sys/vm/drop_caches a good idea? Post 302462902 by Neo on Friday 15th of October 2010 09:24:06 AM
Old 10-15-2010
Hi Eric,

Actually, it really does not matter much, frankly speaking. I've experimented with dropping caches in Linux so many times on our production web server (LAMP).

Linux does such a great job at using all available memory, and reclaiming it when needed, so it is better to let Linux manage those things.

When you drop the cache (or caches), you will see the CPU load go up (sometimes way up) because the cache is gone. Available RAM goes up, but it does not matter because performance is slower because the cache is empty.

Then over time, if you leave the caches off, the performance will suffer because you are not taking advantage of the cache.

Linux tries to use all available RAM, so the caches will fill over time if you don't instruct Linux to drop the caches, and this is a good thing. You will see available RAM go down, but don't worry, it is available for applications when needed because applications take higher priority than cache.

You want Linux to use all the RAM. That is a good thing because the kernel is basically using all available RAM that is not used by applications (and the OS) for cache. Dropping caches has little positive effect on performance. In fact, it tends to have a negative effect. The reason is that you are not really making more RAM available to the apps, because the apps already have been given the RAM needed. You simply are dropping the cache, which degrades performance.

Regarding, swappiness, the same is basically true. Linux will dump the cache before swapping, as I recall, but I would need to read up on that again to see exactly how it works.

We have experimented with swappiness, and ours is currently set to:
Code:
# cat swappiness
20

... and FYI:

Code:
# cat drop_caches
0

This User Gave Thanks to Neo For This Post:
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Dual Boot a good idea?

I was just wondering if it would be alright to dual boot a machine with both UNIX using XTERM for the interface and windows 98 or if people consider this a bad idea? if you consider it bad do tell me some possible alternatives..also would it be better to get linux over pure unix? I'd like a visual... (8 Replies)
Discussion started by: PravusMentis
8 Replies

2. Shell Programming and Scripting

Limitations of awk? Good idea? Bad idea?

Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts.. I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
Discussion started by: yongho
2 Replies

3. Shell Programming and Scripting

Echo escaped \c in SH Shell Any Idea

Hi All, I have got an echo statement with "\c" in it to avoid getting into a newline. Ths script is using #!\bin\sh Any idea what could make it to escape "\c" (4 Replies)
Discussion started by: asami
4 Replies

4. Shell Programming and Scripting

any good idea on this?

txt file like this, 1 2 3 4456 a bb c d 3 f e 1 k 32 d m f e 123 m 2 k every line contains 3 or more columns, all the columns are separated by space, and every column includes 1 to 3 character. what I wanna do is deleting the first three columns, and keep the rest no matter how long... (7 Replies)
Discussion started by: fedora
7 Replies

5. Linux

Kernal panic error& setuproot:error mounting /proc&/sys

Hi all, I am new to redhat/fedora linux. In fedora linux 6,we created one file system(hda3 - /fs). in this mount poing we were installed mounta vista os. while booting we are getting below error messages. 1) Booting 'mountaVisat(2.6.18_pro 500_pc_target-x86_586 smp)' root(hd0,1)... (2 Replies)
Discussion started by: arjunreddy3
2 Replies

6. Shell Programming and Scripting

Compact script with array - Good idea?

Hi, I have a shell script where a lot of the code is repeated. I wanted to make the code much more compact so I spoke to a guy and he suggested using arrays, like follows: #!/bin/bash readonly -a nginx=('nginx' '--prefix=/opt' '-j 4' 'http://nginx.org/download/nginx-1.2.2.tar.gz' )... (2 Replies)
Discussion started by: Spadez
2 Replies

7. Solaris

Drop_caches doesn't work on Solaris but works on RHEL6

Hello Experts, I am performing performance tests on a few mysql select queries. I use the following command to clear the memory disk caches. sync && echo 3 | sudo tee /proc/sys/vm/drop_caches I however see that the above command works on RHEL6 but doesn't work on Solaris 10. I asked... (4 Replies)
Discussion started by: Anirudh Kumar
4 Replies

8. IP Networking

Cat /proc/sys/net/ipv4/ip_local_port_range

Hello, /proc/sys/net/ipv4/ip_local_port_range returns 32000 - 61000, i have a client TCP and a Server TCP. i have used bind() only on the server, the port of socket client is given by the OS that's it ? it retrieves this port from this range (/proc/sys/net/ipv4/ip_local_port_range) ? ... (5 Replies)
Discussion started by: chercheur111
5 Replies
SLABINFO(5)						     Linux Programmer's Manual						       SLABINFO(5)

NAME
/proc/slabinfo - Kernel slab allocator statistics SYNOPSIS
cat /proc/slabinfo DESCRIPTION
Frequently used objects in the Linux kernel (buffer heads, inodes, dentries, etc.) have their own cache. The file /proc/slabinfo gives statistics. For example: % cat /proc/slabinfo slabinfo - version: 1.1 kmem_cache 60 78 100 2 2 1 blkdev_requests 5120 5120 96 128 128 1 mnt_cache 20 40 96 1 1 1 inode_cache 7005 14792 480 1598 1849 1 dentry_cache 5469 5880 128 183 196 1 filp 726 760 96 19 19 1 buffer_head 67131 71240 96 1776 1781 1 vm_area_struct 1204 1652 64 23 28 1 ... size-8192 1 17 8192 1 17 2 size-4096 41 73 4096 41 73 1 ... For each slab cache, the cache name, the number of currently active objects, the total number of available objects, the size of each object in bytes, the number of pages with at least one active object, the total number of allocated pages, and the number of pages per slab are given. Note that because of object alignment and slab cache overhead, objects are not normally packed tightly into pages. Pages with even one in- use object are considered in-use and cannot be freed. Kernels compiled with slab cache statistics will also have "(statistics)" in the first line of output, and will have 5 additional columns, namely: the high water mark of active objects; the number of times objects have been allocated; the number of times the cache has grown (new pages added to this cache); the number of times the cache has been reaped (unused pages removed from this cache); and the number of times there was an error allocating new pages to this cache. If slab cache statistics are not enabled for this kernel, these columns will not be shown. SMP systems will also have "(SMP)" in the first line of output, and will have two additional columns for each slab, reporting the slab allocation policy for the CPU-local cache (to reduce the need for inter-CPU synchronization when allocating objects from the cache). The first column is the per-CPU limit: the maximum number of objects that will be cached for each CPU. The second column is the batchcount: the maximum number of free objects in the global cache that will be transferred to the per-CPU cache if it is empty, or the number of objects to be returned to the global cache if the per-CPU cache is full. If both slab cache statistics and SMP are defined, there will be four additional columns, reporting the per-CPU cache statistics. The first two are the per-CPU cache allocation hit and miss counts: the number of times an object was or was not available in the per-CPU cache for allocation. The next two are the per-CPU cache free hit and miss counts: the number of times a freed object could or could not fit within the per-CPU cache limit, before flushing objects to the global cache. It is possible to tune the SMP per-CPU slab cache limit and batchcount via: echo "cache_name limit batchcount" > /proc/slabinfo FILES
<linux/slab.h> VERSIONS
/proc/slabinfo exists since Linux 2.1.23. SMP per-CPU caches exist since Linux 2.4.0-test3. NOTES
Since Linux 2.6.16 the file /proc/slabinfo is only present if the CONFIG_SLAB kernel configuration option is enabled. COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. 2007-09-30 SLABINFO(5)
All times are GMT -4. The time now is 10:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy