I know this is more of a general unix question, but the thread about the last kernel update, and memory usage got me to looking and thinking. Given a system with 2 Gb of memory, and at peak usage, top reports considerably less than the 2 gig amount in use, as well as system monitoring that never shows all available memory used, what would happen if you just turned swap off, and let memory handle things? This machine here, has now crept up to using just under 400mb of swap, yet I've never seen total memory usage above about 1.4gb. I'm a bit leary of just "swapoff" while the machine is running the weather model, as I'd hate to crash things, but I'm just wondering if turning off swap (assuming the system is actually using the disks) would break things or in the best case, speed things up.
I run without swap all the time, no problem unless you really do use all your physical memory.
Brett
On 6/5/06, Sam Drinkard sam@wa4phy.net wrote:
I know this is more of a general unix question, but the thread about the last kernel update, and memory usage got me to looking and thinking. Given a system with 2 Gb of memory, and at peak usage, top reports considerably less than the 2 gig amount in use, as well as system monitoring that never shows all available memory used, what would happen if you just turned swap off, and let memory handle things? This machine here, has now crept up to using just under 400mb of swap, yet I've never seen total memory usage above about 1.4gb. I'm a bit leary of just "swapoff" while the machine is running the weather model, as I'd hate to crash things, but I'm just wondering if turning off swap (assuming the system is actually using the disks) would break things or in the best case, speed things up.
-- Sam W.Drinkard -- sam@wa4phy.net http://wa4phy.net Augusta Area Mesonet cell 706.825.8513 Home 706.868.7253 MAIL 4428 Branchwood Drive, Martinez Georgia, 30907-1304
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, Jun 05, 2006 at 02:26:04PM -0400, Brett Serkez wrote:
On 6/5/06, Sam Drinkard sam@wa4phy.net wrote:
I know this is more of a general unix question, but the thread about the last kernel update, and memory usage got me to looking and thinking. Given a system with 2 Gb of memory, and at peak usage, top reports considerably less than the 2 gig amount in use, as well as system monitoring that never shows all available memory used, what would happen if you just turned swap off, and let memory handle things? This machine here, has now crept up to using just under 400mb of swap, yet I've never seen total memory usage above about 1.4gb. I'm a bit leary of just "swapoff" while the machine is running the weather model, as I'd hate to crash things, but I'm just wondering if turning off swap (assuming the system is actually using the disks) would break things or in the best case, speed things up.
I run without swap all the time, no problem unless you really do use all your physical memory.
I keep my swap on, but set swappiness to 0. Been working great that way.
[]s
PS: I really wish people would stop top-posting.
- -- Rodrigo Barbosa rodrigob@suespammers.org "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)
Rodrigo Barbosa wrote on Mon, 5 Jun 2006 15:37:26 -0300:
I keep my swap on, but set swappiness to 0. Been working great that way.
where do you set "swappiness"?
PS: I really wish people would stop top-posting.
Actually, if someone doesn't trim the quote I *much* prefer top-posting over endlessly scrolling to the end for reading a single sentence or two.
Kai
Kai Schaetzl wrote:
Rodrigo Barbosa wrote on Mon, 5 Jun 2006 15:37:26 -0300:
I keep my swap on, but set swappiness to 0. Been working great that way.
where do you set "swappiness"?
PS: I really wish people would stop top-posting.
Actually, if someone doesn't trim the quote I *much* prefer top-posting over endlessly scrolling to the end for reading a single sentence or two.
Kai
From what I gather from man swapon, the priority is a value between 0 and 32767, but which field in the /etc/fstab is the "options" field?
/dev/hda5 swap swap defaults 0 0 LABEL=SWAP-hdb7 swap swap defaults 0 0
Which one do you add the pri=0 to set the swappiness ?
OTOH, if you turn swap completely off and the system needs more memory than is available, I would assume a kernel panic would ensue at that point, or something would die. Just guessing on that part.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, Jun 05, 2006 at 09:31:20PM +0200, Kai Schaetzl wrote:
Rodrigo Barbosa wrote on Mon, 5 Jun 2006 15:37:26 -0300:
I keep my swap on, but set swappiness to 0. Been working great that way.
where do you set "swappiness"?
Right way: On /etc/sysctl.conf, add "vm.swappiness = 0"
Or any other value you want. The default is 60.
Don't forget to run "sysctl -p" to load this new value.
Not so right way:
echo 0 > /proc/sys/vm/swappiness
PS: I really wish people would stop top-posting.
Actually, if someone doesn't trim the quote I *much* prefer top-posting over endlessly scrolling to the end for reading a single sentence or two.
Doing both is even better :)
- -- Rodrigo Barbosa rodrigob@suespammers.org "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)
Kai Schaetzl wrote:
where do you set "swappiness"?
Echo a value 0 to 100 into /proc/sys/vm/swappiness.
Higher the number, more swap.
Here's an interesting argument from some kernel developers:
http://kerneltrap.org/node/3000
Max
I would at least keep a little bit of swap space. If you were to ever run out of physical memory it WILL cause a kernel panic. Just a suggestion.
On 6/5/06, Max H. btmanmeh@verizon.net wrote:
Kai Schaetzl wrote:
where do you set "swappiness"?
Echo a value 0 to 100 into /proc/sys/vm/swappiness.
Higher the number, more swap.
Here's an interesting argument from some kernel developers:
http://kerneltrap.org/node/3000
Max _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, Jun 05, 2006 at 02:01:52PM -0600, Joshua Gimer wrote:
On 6/5/06, Max H. btmanmeh@verizon.net wrote: Kai Schaetzl wrote: > where do you set "swappiness"?
Echo a value 0 to 100 into /proc/sys/vm/swappiness. Higher the number, more swap. Here's an interesting argument from some kernel developers: <http://kerneltrap.org/node/3000>
I would at least keep a little bit of swap space. If you were to ever run out of physical memory it WILL cause a kernel panic. Just a suggestion.
And that is why we are suggesting changing swappiness instead of turning of swap.
- -- Rodrigo Barbosa rodrigob@suespammers.org "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)
Rodrigo Barbosa wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, Jun 05, 2006 at 02:01:52PM -0600, Joshua Gimer wrote:
On 6/5/06, Max H. btmanmeh@verizon.net wrote: Kai Schaetzl wrote:
where do you set "swappiness"?
Echo a value 0 to 100 into /proc/sys/vm/swappiness.
Higher the number, more swap.
Here's an interesting argument from some kernel developers:
http://kerneltrap.org/node/3000
I would at least keep a little bit of swap space. If you were to ever run out of physical memory it WILL cause a kernel panic. Just a suggestion.
And that is why we are suggesting changing swappiness instead of turning of swap.
I assume then, with swappiness set to 0, *if* the system does happen to need some extra pages, then it *will* go into swap, but only if all memory is exhausted? Zat sound right?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, Jun 05, 2006 at 04:15:35PM -0400, Sam Drinkard wrote:
On Mon, Jun 05, 2006 at 02:01:52PM -0600, Joshua Gimer wrote:
On 6/5/06, Max H. btmanmeh@verizon.net wrote: Kai Schaetzl wrote:
where do you set "swappiness"?
Echo a value 0 to 100 into /proc/sys/vm/swappiness.
Higher the number, more swap.
Here's an interesting argument from some kernel developers:
http://kerneltrap.org/node/3000
I would at least keep a little bit of swap space. If you were to ever run out of physical memory it WILL cause a kernel panic. Just a suggestion.
And that is why we are suggesting changing swappiness instead of turning of swap.
I assume then, with swappiness set to 0, *if* the system does happen to need some extra pages, then it *will* go into swap, but only if all memory is exhausted? Zat sound right?
About right. It will still choose which pages it will swap out first (buffers and cache blah blah).
Swappiness control how willing the system is to swap. If you set it to 0, it will only swap if it is really needed. At 100, it will do a lot of "preventive" swap, keeping more real memory free for cache and buffers.
- -- Rodrigo Barbosa rodrigob@suespammers.org "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)
Sam Drinkard wrote:
I assume then, with swappiness set to 0, *if* the system does happen to need some extra pages, then it *will* go into swap, but only if all memory is exhausted? Zat sound right?
From what I know about it, yes your statement is correct. If you have swap turned off though, yeah your system is going to freak out for sure. Some people seem to run with no swap at all, but I was always taught to not do so, I guess it's personal preference and experiences.
I've played with different swappiness settings on my laptop, but I never really noticed any difference between the default that CentOS has, and whatever values I used. I tried it at 10 and 90 (I believe the default is 80), at least that's what I have mine set to), and I really didn't notice any difference at all.
I've never run out of memory though, at 1GB in my laptop, I never come close to exhausting all of it.
Perhaps others have better results with playing with swappiness values.
Max
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, Jun 05, 2006 at 04:28:04PM -0400, Max H. wrote:
Sam Drinkard wrote:
I assume then, with swappiness set to 0, *if* the system does happen to need some extra pages, then it *will* go into swap, but only if all memory is exhausted? Zat sound right?
From what I know about it, yes your statement is correct. If you have swap turned off though, yeah your system is going to freak out for sure. Some people seem to run with no swap at all, but I was always taught to not do so, I guess it's personal preference and experiences.
I've played with different swappiness settings on my laptop, but I never really noticed any difference between the default that CentOS has, and whatever values I used. I tried it at 10 and 90 (I believe the default is 80), at least that's what I have mine set to), and I really didn't notice any difference at all.
I've never run out of memory though, at 1GB in my laptop, I never come close to exhausting all of it.
Perhaps others have better results with playing with swappiness values.
It is kind of interesting, but I never noticed much difference from the default value (thats 60, by the way) until I set swappiness to 0. The difference between 10 and 60 is barely noticeable, tho. You are right on that regard.
I have 768MB on my laptop, and I really use it. Meaning spamd, mysql, firefox, openoffice and some nuts and bolts.
- -- Rodrigo Barbosa rodrigob@suespammers.org "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)
Rodrigo Barbosa wrote:
It is kind of interesting, but I never noticed much difference from the default value (thats 60, by the way) until I set swappiness to 0. The difference between 10 and 60 is barely noticeable, tho. You are right on that regard.
I have 768MB on my laptop, and I really use it. Meaning spamd, mysql, firefox, openoffice and some nuts and bolts.
I have a ton of stuff running too, I just never seem to fill up memory.
I'll have to give it a shot with setting it at 0 once. Like you said, I tried it at 10 and 80, figuring that it wouldn't be much more different from 0 to 10. 80 was the last setting I had it on, I must never have put 60 to default.
Max
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, Jun 05, 2006 at 04:55:54PM -0400, Max H. wrote:
Rodrigo Barbosa wrote:
It is kind of interesting, but I never noticed much difference from the default value (thats 60, by the way) until I set swappiness to 0. The difference between 10 and 60 is barely noticeable, tho. You are right on that regard.
I have 768MB on my laptop, and I really use it. Meaning spamd, mysql, firefox, openoffice and some nuts and bolts.
I have a ton of stuff running too, I just never seem to fill up memory.
I'll have to give it a shot with setting it at 0 once. Like you said, I tried it at 10 and 80, figuring that it wouldn't be much more different from 0 to 10. 80 was the last setting I had it on, I must never have put 60 to default.
Another important thing I noticed.
If you keep rebooting/powering your machine every day, you will notice almost no difference. But leave it on for a couple of days, and you will see something. Specially after all those crazy prelink cron jobs run.
- -- Rodrigo Barbosa rodrigob@suespammers.org "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)
Max H. wrote:
Rodrigo Barbosa wrote:
It is kind of interesting, but I never noticed much difference from the default value (thats 60, by the way) until I set swappiness to 0. The difference between 10 and 60 is barely noticeable, tho. You are right on that regard.
I have 768MB on my laptop, and I really use it. Meaning spamd, mysql, firefox, openoffice and some nuts and bolts.
I have a ton of stuff running too, I just never seem to fill up memory.
I'll have to give it a shot with setting it at 0 once. Like you said, I tried it at 10 and 80, figuring that it wouldn't be much more different from 0 to 10. 80 was the last setting I had it on, I must never have put 60 to default.
Max
Just prior to the next run of my application, I set swappiness to 0, turned swap off, then turned it back on after doing a reread of sysctl stuff. At first, the system sat quietly running, consuming 1.4G of memory, then all of a sudden, swap jumped up to 2.2 mb. It is still running 1.3g on memory and swap is stabilized at 2.2mb. Guess there is something in there that needed more than what memory could afford, perhaps instantaneously. Dunno..... will see what happens during the night when a bunch of cron jobs run in addition to the system crons.
Max H. wrote:
Kai Schaetzl wrote:
where do you set "swappiness"?
Echo a value 0 to 100 into /proc/sys/vm/swappiness.
Higher the number, more swap.
Here's an interesting argument from some kernel developers:
Some interesting points made in that article. Sounds like too, that something has been implemented that would control the swappiness based on load.
Max H. wrote on Mon, 05 Jun 2006 15:46:01 -0400:
Interesting read, thanks. I wasn't aware that there are any tuning parameters.
Kai
I keep my swap on, but set swappiness to 0. Been working great that way.
Yeah but with that patch that changed the vm system behaviour, setting swappiness to 0 had ZERO effect. The kernel happily swapped out what data it could from programs that were running.
This blinking patch gave the impression that Centos 4, that is RHEL4, was slow compared to RHEL3 and the Fedora distros.
I don't understand why the fix will wait till 4.4...
Feizhou wrote on Tue, 06 Jun 2006 10:54:26 +0800:
Yeah but with that patch that changed the vm system behaviour, setting swappiness to 0 had ZERO effect. The kernel happily swapped out what data it could from programs that were running.
But you apparently need some additional environmental condition for this to happen. I see normal behavior as ever with my 4.3. After boot it slowly fills up memory until less than 50 MB is left. If the machine is scarce on memory it even gets almost to zero physical mem left. swap file usage stays at a few 100k. I don't have desktop machines, only servers. I suspect that the problematic behavior occurs only when you close applications. In that case it might swap the diskcache of the closed application out instead of keeping it in RAM. On a server this doesn't happen, you have your applications running continuously and no big memory eaters that don't run all the time - well there are exceptions, of course.
Kai
Kai Schaetzl wrote:
Feizhou wrote on Tue, 06 Jun 2006 10:54:26 +0800:
Yeah but with that patch that changed the vm system behaviour, setting swappiness to 0 had ZERO effect. The kernel happily swapped out what data it could from programs that were running.
But you apparently need some additional environmental condition for this to happen. I see normal behavior as ever with my 4.3. After boot it slowly fills up memory until less than 50 MB is left. If the machine is scarce on memory it even gets almost to zero physical mem left. swap file usage stays at a few 100k. I don't have desktop machines, only servers. I suspect that the problematic behavior occurs only when you close applications. In that case it might swap the diskcache of the closed application out instead of keeping it in RAM. On a server this doesn't happen, you have your applications running continuously and no big memory eaters that don't run all the time - well there are exceptions, of course.
I don't suppose you are running on AMD64? The patch only affects Intel processor-based boxes.
Here chew this:
https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=129064
My previous colleagues all think that RHEL4 or Centos 4 is slow which is true but due to the dumb vm patch Redhat applied to the RHEL4 kernel which is makes the box swap.
I do not access to those boxes now but I can tell you that vmstat will report swapping activity with constant non-zero figures under si and so. That is swapping. Hence, vmstat will also have high numbers under wa and id due to the apps all waiting for i/o on the RHEL4 box. The FC4 has completely different vmstat reports which are basically zero swapping, full utilization (cpu idle = 0) and zero or low wa numbers.
Redhat has admitted as much that the problem was their vm patch. Setting swappiness or whatever has zero bearing on the current RHEL4 kernel's knack of writing pages to swap even though there is plenty of RAM available.
Feizhou wrote on Wed, 07 Jun 2006 10:33:34 +0800:
The patch only affects Intel processor-based boxes.
Machines in question are intel-based, PIII or Celeron, no "new" processor, though. As I said it cannot be a general problem, maybe it affects P4 machines or so. It doesn't seem to affect the machines with CentOS 4.3 I use.
The interesting figure in your free output is that there are 0 buffers on the RHEL machine.
Kai
Kai Schaetzl wrote:
Feizhou wrote on Wed, 07 Jun 2006 10:33:34 +0800:
The patch only affects Intel processor-based boxes.
Machines in question are intel-based, PIII or Celeron, no "new" processor, though. As I said it cannot be a general problem, maybe it affects P4 machines or so. It doesn't seem to affect the machines with CentOS 4.3 I use.
Same here. PIII boxes.
The interesting figure in your free output is that there are 0 buffers on the RHEL machine.
Precisely because that patch changed the vm to behave like that. That patch don't pay any attention to swappiness or what not. It puts memory pressure on running processes instead.
On Monday 05 June 2006 2:18 pm, Sam Drinkard wrote:
I know this is more of a general unix question, but the thread about the last kernel update, and memory usage got me to looking and thinking. Given a system with 2 Gb of memory, and at peak usage, top reports considerably less than the 2 gig amount in use, as well as system monitoring that never shows all available memory used, what would happen if you just turned swap off, and let memory handle things? This machine here, has now crept up to using just under 400mb of swap, yet I've never seen total memory usage above about 1.4gb. I'm a bit leary of just "swapoff" while the machine is running the weather model, as I'd hate to crash things, but I'm just wondering if turning off swap (assuming the system is actually using the disks) would break things or in the best case, speed things up.
On Mon, 2006-06-05 at 17:52 -0400, Steve Snyder wrote:
On Monday 05 June 2006 2:18 pm, Sam Drinkard wrote:
<snip>
Hurray Steve! Sam, there's our "bug".
<snip sig stuff>
Steve, just wanted to thank you for taking the time.
William L. Maltby wrote:
On Mon, 2006-06-05 at 17:52 -0400, Steve Snyder wrote:
On Monday 05 June 2006 2:18 pm, Sam Drinkard wrote:
<snip>
Hurray Steve! Sam, there's our "bug".
<snip sig stuff>
Steve, just wanted to thank you for taking the time.
I believe this is the same bug page that was referenced a few days ago, but if it won't be available till U4, I'll not worry about patching at this point. System still runs, and I can wait.