[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Limiting Disck Cache



On Wed, 2004-12-15 at 23:26 +0000, Ivan Garcia Sainz-Aja wrote:
> On Wed, Dec 15, 2004 at 04:34:45PM -0600, Ron Johnson wrote:
> > On Wed, 2004-12-15 at 22:24 +0000, Ivan Garcia Sainz-Aja wrote:
> > > Hi all,
> > > 
> > > how can i limit the amount of this cache linux uses?
> > 
> > You can't.  By design, it's totally dynamic.
> > 
> > > i'm using an external usb hd for playing movies/mp3 but
> > > after a time of usage the memory becomes full and the system 
> > > virtually unusable and i got to umount/mount the drive to 
> > > keep working
> > > 
> > > root@thinkpad:~# cat /proc/meminfo
> > >         total:    used:    free:  shared: buffers:  cached:
> > > Mem:  775114752 772341760  2772992        0  7421952 609456128
> > > Swap: 348323840 14917632 333406208
> > > MemTotal:       756948 kB
> > > MemFree:          2708 kB
> > > MemShared:           0 kB
> > > Buffers:          7248 kB
> > > Cached:         593088 kB
> > > SwapCached:       2084 kB
> > > Active:          41492 kB
> > > Inactive:       664144 kB
> > > HighTotal:           0 kB
> > > HighFree:            0 kB
> > > LowTotal:       756948 kB
> > > LowFree:          2708 kB
> > > SwapTotal:      340160 kB
> > > SwapFree:       325592 kB
> > > 
> > > which is mad
> > 
> > Only 15MB of "stuff" is in swap.  That's not enough to make the
> > system "virtually unusable".  Something else must be going on that
> > you aren't telling us about.
> 
> At the moment of that cat /proc/meminfo i was only coping an mpeg file
> from the cdrom to usb hd and just surfing the web when the mouse start
> responding funy so i just stoped tomcat and eclipse but the happiness
> didnt last

Ah, so you aren't *just* cp'ing files from point A to point B.
What else are you running besides Tomcat and Eclipse?

Operating on huge files will always cause the kind of problems
you describe.  Why?  Because when you run the cp (or dd or what-
ever) command, the OS takes and starts loading that file into
cache, while writing it out to the destination.  So what?  The
Last In, First Out algorithm used to determine what stays in
RAM and what goes in swap sees this brand new file being used
right *now*, and sees that Tomcat and Eclipse are *not* being
used now.  So, they get pushed aside, to make room for the file
that *is* being used now.

Unfortunately, that one file takes up all of cache.  So, the next
time that you want to use Mozilla or Eclipse or whatever, it has
to be taken back out of swap, and put back in RAM.

If your CD drive hdb, hdc or hdd?

> the point is that if i have the sub drive connected the disck cache grows
> up to whatever limit and everything stop working 
> i even got java.lang.OutOfMemory from tomcat
> 
> Im monitoring the memory with that aplication from KDE and there is not
> much swap usage and the phisical free memory under 5% while disk cache is
> about 500M ...
> 
> I dont know what is this but it frozes the computer
> 
> Thanks for any help.
> 
> PS: here it goes another after a time of 'normal' working
> 
> total:    used:    free:  shared: buffers:  cached:
> Mem:  775114752 770510848  4603904        0 41541632 477081600
> Swap: 348323840 13242368 335081472
> MemTotal:       756948 kB
> MemFree:          4496 kB
> MemShared:           0 kB
> Buffers:         40568 kB
> Cached:         461060 kB
> SwapCached:       4840 kB
> Active:         131572 kB
> Inactive:       562132 kB
> HighTotal:           0 kB
> HighFree:            0 kB
> LowTotal:       756948 kB
> LowFree:          4496 kB
> SwapTotal:      340160 kB
> SwapFree:       327228 kB
> 
> 

-- 
-----------------------------------------------------------------
Ron Johnson, Jr.
Jefferson, LA USA
PGP Key ID 8834C06B I prefer encrypted mail.

Why is cyber-crime not being effectively controlled? What is
fueling the rampancy?
* Parental apathy & the public education system
http://www.linuxsecurity.com/feature_stories/feature_story-
150.html

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: