Answer the question
In order to leave comments, you need to log in
Does all memory gradually disappear under Cached?
Hello!
There is a server (1GB of RAM, AMD ATHLON 64 X2) running on it:
apache 10 clients and ~ 5 times a day fetching (php) from the database for ~ 4000 rows (line length 33 + indexes), mysql,
a process that makes 20 inserts in give me a sec.
All free RAM approximately every 3 days goes under Cached and => the process making inserts dies + lack of memory for php scripts for large selections from the database.
What to do? What to read in theory?
[[email protected] ~]# free<br/>
total used free shared buffers cached<br/>
Mem: 1034164 660876 373288 0 133568 441132<br/>
-/+ buffers/cache: 86176 947988<br/>
Swap: 2102456 0 2102456
[[email protected] ~]# cat /proc/meminfo <br/>
MemTotal: 1034164 kB<br/>
MemFree: 373164 kB<br/>
Buffers: 133572 kB<br/>
Cached: 441220 kB<br/>
SwapCached: 0 kB<br/>
Active: 618896 kB<br/>
Inactive: 9916 kB<br/>
HighTotal: 129984 kB<br/>
HighFree: 256 kB<br/>
LowTotal: 904180 kB<br/>
LowFree: 372908 kB<br/>
SwapTotal: 2102456 kB<br/>
SwapFree: 2102456 kB<br/>
Dirty: 200 kB<br/>
Writeback: 0 kB<br/>
AnonPages: 53992 kB<br/>
Mapped: 23372 kB<br/>
Slab: 20724 kB<br/>
PageTables: 4600 kB<br/>
NFS_Unstable: 0 kB<br/>
Bounce: 0 kB<br/>
CommitLimit: 2619536 kB<br/>
Committed_AS: 269908 kB<br/>
VmallocTotal: 116728 kB<br/>
VmallocUsed: 7756 kB<br/>
VmallocChunk: 108832 kB<br/>
HugePages_Total: 0<br/>
HugePages_Free: 0<br/>
HugePages_Rsvd: 0<br/>
Hugepagesize: 2048 kB
Answer the question
In order to leave comments, you need to log in
as it should be, this is normal kernel behavior:
linuxatemyram.com/
how caching affects performance can be read there:
linuxatemyram.com/play.html
You have two gigs of swap still free - the process cannot die from lack of memory, this is a bug in it. Otherwise, part of the memory would simply be swapped and the process would continue to work.
I observed the gigantic sizes of occupied cached memory on all my computers, and this did not really interfere with performance.
And here is the script for clearing the cache
#!/bin/sh
sync
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question