Skip to contentSkip to conversation

Over used cache memory?

DISCUSSION Wee Teck Neo 6 participants 7 messages Nov 6, 2003

lore
Share & tools
lore
#0 lore raw

My system having 1GB ram and this is the output of vmstat

procs memory swap io system
cpu

r  b  w   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id
0  0  0   5640  21224 121512 797832    0    0     6     9    3    17  0  0  6

It seems that 797MB is used for caching... thats a high number. Anyway to set a lower cache size?

I've read about the /proc/sys/vm/buffermem but my /proc doesn't have it.

Kernel: 2.4.22

_________________________________________________________________
Get 10mb of inbox space with MSN Hotmail Extra Storage http://join.msn.com/?pgmarket=en-sg

#1 lore raw
Quoted 8 lines · Wee Teck Neo

My system having 1GB ram and this is the output of vmstat

procs memory swap io
system cpu

r  b  w   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id
0  0  0   5640  21224 121512 797832    0    0     6     9    3    17  0  0  6
Quoted 5 lines

It seems that 797MB is used for caching... thats a high number. Anyway to set a lower cache size?

I've read about the /proc/sys/vm/buffermem but my /proc doesn't have it.

Kernel: 2.4.22

Short answer, no.

If it is actually causing you a problem, test the latest 2.4 prerelease. If that doesn't help, report the details of the problem.

#2 lore raw
In reply to Wee Teck Neo
Quoted 8 lines · Wee Teck Neo

My system having 1GB ram and this is the output of vmstat

procs memory swap io
system cpu

r  b  w   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id
0  0  0   5640  21224 121512 797832    0    0     6     9    3    17  0  0  6
Quoted 6 lines

It seems that 797MB is used for caching... thats a high number. Anyway to set a lower cache size?

I've read about the /proc/sys/vm/buffermem but my /proc doesn't have it.

Kernel: 2.4.22

I don't see the problem? Linux uses unused memory as cache and unless you have processes using more memory then thats free you dont have a problem, this is all dynamic and nothing to worry about.

#3 lore raw
In reply to Wee Teck Neo
Quoted 9 lines · Wee Teck Neo

My system having 1GB ram and this is the output of vmstat

procs memory swap io
system cpu

r  b  w   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id
0  0  0   5640  21224 121512 797832    0    0     6     9    3    17  0  0  6

It seems that 797MB is used for caching... thats a high number. Anyway to set a lower cache size?

Yes - _use_ the memory for something else. 1. All unused memory will be put to good use as cache.
2. Memory is taken from the cache whenever you need it for
something else, so (1) is not a problem at all.

Helge Hafting

#4 lore raw
Quoted 5 lines · Helge Hafting

Yes - _use_ the memory for something else.
1. All unused memory will be put to good use as cache.
2. Memory is taken from the cache whenever you need it for something else, so (1) is not a problem at all.

This is the way it is susposed to work, but I am working on a problem where this does not seem to be happening. We have a machine with 6G of ram. It reads some huge files (~5G) and cache fills up. Then it starts to process the data and goes into a swap storm because it can not get any memory for the process because it all is in the cache. If you run top, you see kswapd stuck at the top.

If anyone has any ideas about this, I would love to hear them.

Thanks,

Jim

#5 lore raw
Quoted 1 line · On Thu, 2003-11-06 at 14:40, [email protected] wrote:

If anyone has any ideas about this, I would love to hear them.

cat /proc/pid/maps of app in question....

most likely it's copying a fsck load of that file in to anonymous mappings, causing swapping.

If it has a 2GB anonymous mapping and 1GB physical memory, swap will happen on 1 in 2 pages that that program tries to access, on average.

Signature · 3 lines
// Gianni Tedesco (gianni at scaramanga dot co dot uk)
lynx --source www.scaramanga.co.uk/gianni-at-ecsc.asc | gpg --import
8646BE7D: 6D9F 2287 870E A2C9 8F60 3A3C 91B5 7669 8646 BE7D
#6 lore raw
Quoted 6 lines · Gianni Tedesco
Quoted 1 line · On Thu, 2003-11-06 at 14:40, [email protected] wrote:

If anyone has any ideas about this, I would love to hear them.

most likely it's copying a fsck load of that file in to anonymous mappings, causing swapping.

Thanks for the reply. Unfortunatly thats not it. I can reproduce this problem with a little program that appends data to a file and every so often seeks back to the beginning of the file and scribbles a little there.

Thanks,

Jim