Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
MAKE SURE YOU READ TO THE LAST POST ..posted by Romy Maxwell
1.It's ok to have almost 100% cached memory.
2.You should NOT manually clear the cache.
3.You can manually clear the cache.
4.Make sure you read official documents/documentation before making decisions that affect the state of the system.
Last edited by ddaemonunics; 07-20-2009 at 01:09 AM.
I don't know specifics about what it is that guy on that blog is running (no version numbers or anything like that) but I will say, if he has to continually perform that task, something else is wrong with the setup of that system. I've never had (or heard of anyone else until now having) to force flush memory caches or reboot systems on a regular basis for memory cache usage reasons. I'd dig deeper into what is actually using the memory before I took that approach...
I've never had (or heard of anyone else until now having) to force flush memory caches
If you read Linux forums, I'm sure you've heard of a lot of people who think they have to flush the cache.
They misunderstand the Linux memory statistics as the OP of this thread did, and think there is a problem when there actually is no problem.
For the OP: Look at the part of your top output that says "7587356k cached". Under most conditions you should interpret that memory as if it were just another kind of free memory. For most purposes it will act like free memory.
As for the guy in that blog, my best guess is that the performance symptoms he reported are imagined rather than measured and he had no real issue with caching.
However, both Linux and Windows have the flaw that they do not properly prioritize memory use according to task priority, so there are instances of a strange feedback situation of inverted priority:
Low priority tasks might have all the pages they want to access in the page cache while the high priority task has the pages it wants on disk. The high priority task can't use the CPU because it is waiting for a page to be brought in, so the low priority tasks use the CPU and fault their pages in instantly from the cache. When the high priority task gets the page it was waiting for, it immediately faults on another page on disk and the pattern continues. The high priority task makes so little progress that most of its pages have not been accessed for a long time and they get dropped from ram, assuring that it will continue faulting almost every access indefinitely. The pages used by the low priority tasks are all accessed often enough to keep them from ever aging out of the cache.
In normal situations, the direct priority over CPU use results in an indirect effect that pages of high priority tasks are accessed more resulting in correct prioritization of memory without any direct prioritization of memory. But on rare occasions, that breaks down. If the blog description was true, most likely it is the result of some such priority inversion.
For the OP, if the mysql-server is a background task and you want interactive tasks to get priority over it, you have the basic conditions that could allow a priority inversion. But a priority inversion also requires serious "memory pressure", which is absolutely not the case in the memory use statistics you quoted.
Ummm ... not sure what that guys problem is, but it's not
the solution to his underlying issues. I've been using
Linux on desktops and servers in many flavours and
variations, with RAM from as little as 96MB to as much as
16GB, for well over 10 years, and not once felt the need
to force cached content out of RAM. Pity so many people
on his blog seem to think he's onto something ;p
I can't reach that blog, but I guess it discusses drop_caches.
If starting mysql_server prefetches (and eats disk cache) like that, you'd sure not want to drop them.
On a small/quiet system it probably won't matter, but is pointless. Otherwise it's likely to be harmful to (at least) performance.
I just sat in on a talk by one of the drizzle devs - they plan on page-fixing that proportion of storage on startup. Think about the questions that'll raise in future (used rather than just cached).
I didn't posted that link so that he will do the same thing...only to better understand the problem(if it is one)...on that blog the users already said that manually flushing the cache is not a solution.
I quote (from that blog):
On that note... for most applications, regularly clearing the cache is like chopping off both arms to cure a pinky infection. The cache exists for a reason -- it eliminates TONS of disk accesses. If you clear the cache, you will always have to load everything from disk, defeating its purpose and effectively wasting that memory.
The likely problem is that you have something running in the background, maybe an indexing service, that is filling up your cache and causing disk IO. Chances are, if you reduce your swappiness, or locate the culprit(s), or both, you won't have anymore problems.:[quote]
Last edited by ddaemonunics; 07-19-2009 at 03:06 AM.
I didn't posted that link so that he will do the same thing...only to better understand the problem...on that blog the users already said that manually flushing the cache is not a solution.
I quote (from that blog):
Sorry, if it was your intention to point out Romy Maxwells
post it almost certainly fails; it's toward the end of a whole
heap of short "thumbs up" and "awesome" and "thanks
a ton" responses. Even if people who are ill informed about
Linux memory usage read the whole blog they'll conclude
that the one poster against that practice must be an idiot.
maybe the fact that I've learned all by myself ..by reading stuff and buying books sometimes makes me post links to other discussions rather that explaining..
There should be a rule..before making a post(looking for an answer)..make proof that you have tried to read some documentation before
Yea ditto. I reply to mad quants of nubie bs on this mofo. But that's just it: when you're noob you're noob, you don't even know that "rtfm" means "bracket code bracket man topic bracket slash code end braket." A big part for me when I was starting was just gaining access to the documents. Even when you do, it takes years of googling, wikipedia, howtos, posts, etc., just to understand what a man page is telling you. Linux isn't easy --if it does seem so, it's only because we spend our lives using and developing it. It's even harder for those of us who grew up without UNIX, or those that didn't get a technical (let alone Computer Science) degree.
My post here strays from the topic. I think we've adequately pointed the OP at the appropriate info.
Originally Posted by jtshaw
I will say, if he has to continually perform that task, something else is wrong with the setup of that system. I've never had (or heard of anyone else until now having) to force flush memory caches or reboot systems on a regular basis for memory cache usage reasons.
Nor have I. That sounds wicked ghetto. Like a mal-configured kernel from 1995.
Last edited by jhwilliams; 07-19-2009 at 03:49 AM.