[SOLVED] Existeth a way to 'clear out' all the old/cached crap from RAM/SWAP to free up space?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
@ jiml8 - you're right, initially I didn't mention my desktop, but then somewhere up there near the top, I indicated my window manager is the very tiny i3 (I don't use a DE per se) and that the only KDE things I use are Kwrite and Kmix, one or both of which do start up all sorts of daemons and services that don't go away when the application closes, leaving me to kill them when I'm done with Kwrite/Kmix. I've never used Ktorrent, and any other KDE apps I may ever use, are used very rarely. I try to avoid them
Basically it seems you & most others above are right - X is the main culprit, or at very least the scapegoat in this situation.
Quote:
Originally Posted by johnsfine
Wrong because (unless you keep messing around unwisely with swappiness) it would never do that.
@ johnsfine - if you'd care to qualify this remark with something helpful about vm.swappiness, that'd be great. We've gotten this far in a thread without snide/unqualified interjections, and I'm grateful for your input thus far. FWIW, my vm.swappiness has been =50 for about 2 years now; I changed it yesterday for the first time.
@ syg00 - I believe you're right about things like FF images/bitmaps. I definitely see the performance degradation increase after a large amount of image-filled websites have been viewed. What would be nice in this regard is some sort of settable time limit, that would say "after XYZ image has been lying around in memory/swap unused for ABC amount of time, let's dump it and free that space rather than continue to store it indefinitely."
So... It took MUCH longer than anticipated for slackpkg to update my system last night (due to my ^$#&@*% wireless internet connection being near unusable) I STILL have not logged out, but will be doing so shortly. Even though I doubt we'll see anything surprising (that we aren't expecting) when I run some of the commands I have run above, after logging back in with a fresh X, I'll post the outputs anyhow, so we can see the baseline of a fresh X session - OR, if that's not much different, I'll reboot and do it then.
Thanks for the input everyone!
Last edited by GrapefruiTgirl; 07-23-2010 at 04:47 AM.
Reason: typo
if you'd care to qualify this remark with something helpful about vm.swappiness
Something helpful about swappiness: Leave it at the default.
Quote:
We've gotten this far in a thread without snide/unqualified interjections
No insult was intended. I just wanted to qualify my own statement about the helpfulness of adding more swap space for your problem. That depends on a reasonable value in swappiness. The value you lowered it to is approaching unreasonable for that purpose.
Quote:
my vm.swappiness has been =50 for about 2 years now
So, I've just logged out of X and back in. Memory consumption shows as minimal, and swap appears to have been 'refreshed'. Here's some outputs comparable to those I posted earlier when everything was maxed out:
Unless someone specifically wants to see the output of the script I used earlier in post#11, I won't post that, since it just expands upon the known fact that X appears to be the main consumer.
Thanks johnsfine for the clarifications re: swappiness. I've moved it back to 50 since when my automatic daily backup began this morning, the desktop became near unusable :P -- putting swappiness back where it had been for so long, instantly revived the desktop.
For the time being I'm not going to increase the swap space - I'll save that experiment for (A) after I look at the HDD and see what space there is to expand it into, and (B) after I examine (C) below:
(C) Next plan: try to upgrade my Xorg systems to the current Slackware64-current version. If that actually works, I'll begin to examine this entire situation anew, and see how the gradual consumption of RAM/SWAP compares (roughly) to how it is on my present version of Xorg. I don't expect any miracle, but who knows.. Maybe they fixed some leaks
If the newest Slack64 Xorg does NOT work still for me, I'll look at increasing swap space. LOL, stay tuned for the next few months -- I'll need another 30-90 days of uptime for a comparison
I've moved it back to 50 since when my automatic daily backup began this morning, the desktop became near unusable :P -- putting swappiness back where it had been for so long, instantly revived the desktop.
That is not at all what I expected. Enough so that I wonder if there was some coincidence that something else happened at the moment you changed swappiness.
Your swap partition size is low enough that an increase in swappiness should not be able to make any dramatic improvement.
A daily backup is the kind of operation where I would expect the system to feel more responsive with a lower value of swappiness.
The major impact of swappiness is on the relative memory priority of anonymous vs. non anonymous memory. Simplistically: the anonymous memory is the stack and heap of all your processes, and non anonymous memory is the code of all your processes plus the files recently read or written by your processes.
Normally anonymous has a moderate priority over non anonymous. If you set swappiness lower, that relative priority increases, so that stale anonymous data (such as that accumulating inside X) has priority over the code of running programs. At a normal swappiness setting the stale vs. active difference overwhelms the moderate relative priority of anonymous.
A daily backup might be expected to read and write a lot of files, so recently copied files would be active non annonymous data and would take up memory forcing inactive anonymous data to the swap partition. But some of that inactive anonymous data is in GUI programs that are waiting for the next mouse click. When that next mouse click happens such programs would take longer to get back to normal speed than they would have with a low swappiness setting. That is the reason many people prefer a low swappiness setting. Overall it makes performance and throughput worse, but in that specific very noticeable case it makes responsiveness better.
That is not at all what I expected. In fact I think there was some coincidence that something else happened at the moment you changed swappiness.
...
A daily backup is the kind of operation where I would expect the system to feel more responsive with a lower value of swappiness.
Sentence 2 above is precisely what I was thinking when I tried to change it to 10; I had hoped for a "general" improvement in responsiveness (EDIT: That's not to say that responsiveness is generally a problem, but I thought what the heck, let's see what this does! ).
Maybe there was just some coincidence at the same time, but I don't know what it may have been..
1 - I was using browser.
2 - mouse cursor stopped responding for seconds at a time, browser wouldn't scroll, I thought ??wth??
3 - noticed the time of day & the backup drive was mounted - Aha! That's the problem, but *normally* it doesn't affect desktop responsiveness.
4 - zapped vm.swappiness back to 50
5 - instant recovery back to normal responsiveness.
FWIW - The backup started before I logged out and cleaned out all the junk; and, the backup happens via rsync, if that makes any difference.
Last edited by GrapefruiTgirl; 07-23-2010 at 07:39 AM.
of course if you leave off the count switch, -c1, it will run continously and if you leave off the option to display memory usage, --procopt m, you'll see 'standard' top format.
If people are interested in slabs, you can use --top with a sort field that shows slab data (see collectl --showtopopt) or just run:
collectl -sY -i:1 --slabopt S
to see slabs as they change (and ONLY those that change). for more options see "collectl --showsubopt"
Since last posting in this thread, I have been using drop_caches = 3 to dump all the crap when memory gets full. I have it as a setting in /etc/sysctl.conf but it doesn't seem to actively make a difference during the day, just from being there. I have to manually apply it any time I want to 'clear the crap'. No big deal - I figure I'll stick an entry into a daily (or nightly, when nothing's going on) cron script, as follows:
Code:
#!/bin/sh
sync; sync;
sysctl -w vm.drop_caches=3
And that will give me a fresh start each day.
At this time I don't think I'll get too involved with collectl - but will keep it in mind for future use, should I find a need for it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.