I am considering installing CentOS 4.4, and am interested in how best to set up. I have been using FC2 and helping administer a Debian machine for a few years, but do not consider myself a Linux guru.
My current set up uses a /swap partition which is 2x my memory size
mem = 256 MB
$ sudo /sbin/fdisk -l /dev/hda6 76506 77545 524128+ 82 Linux swap
I'm interested in the use of a file for swap, as I hear that there is now no speed penalty for that. I use ext3 for my partitions.
I'm also interested in whether it be reasonable/desirable to make /home, /tmp, and /var be on a separate partition. I have heard arguments on both sides, some claiming that with ext3 the system won't become unbootable because of /tmp filling up.
Anyone care to weigh in?
Mike
My current set up uses a /swap partition which is 2x my memory size
mem = 256 MB $ sudo /sbin/fdisk -l /dev/hda6 76506 77545 524128+ 82 Linux swap
For low memory systems, this logic is okay, but as your memory grows, you don't need to keep doubling the size for swap. For example, on a system with 2Gigs of ram, there's no reason to have 4G of swap space.
I'm interested in the use of a file for swap, as I hear that there is now no speed penalty for that. I use ext3 for my partitions.
Using swap by itself is generally a speed penalty. Using a file for it can be done, but it's not really something I'd do.
I'm also interested in whether it be reasonable/desirable to make /home, /tmp, and /var be on a separate partition. I have heard arguments on both sides, some claiming that with ext3 the system won't become unbootable because of /tmp filling up.
This depends entirely on the tasks required of the box. Putting /tmp on a separate partition can allow you to mount it noexec, which can help with security, and filling up /tmp won't fill the rest of the disk.
/home on a separate partition can be a good thing for major upgrades or re-installs, as you can do a completely clean install and format the system without nuking user data.
/var is the most task dependent because this is where the webroot and database files live by default. Splitting /var and subdirs out based on task can be beneficial.
Jim Perrin wrote:
Using swap by itself is generally a speed penalty. Using a file for it can be done, but it's not really something I'd do.
Why not?
I'm also interested in whether it be reasonable/desirable to make /home, /tmp, and /var be on a separate partition. I have heard arguments on both sides, some claiming that with ext3 the system won't become unbootable because of /tmp filling up.
This depends entirely on the tasks required of the box. Putting /tmp on a separate partition can allow you to mount it noexec, which can help with security, and filling up /tmp won't fill the rest of the disk.
OTOH anything bad you can do with /tmp you can do better with /var/tmp, and making that noexec is not a realistic proposition.
/home on a separate partition can be a good thing for major upgrades or re-installs, as you can do a completely clean install and format the system without nuking user data.
/var is the most task dependent because this is where the webroot and database files live by default. Splitting /var and subdirs out based on task can be beneficial.
For a personal system, I go with one big partition (well, maybe plus a little one for /boot).
For a small server, same deal. If you don't know what you're doing, you don't have any chance of getting it right for you.
With Xen, I'm now contemplating several small systems under Xen, with shared storage (via NFS maybe, NFS should be fairly quick over virtual wire) where sensible, extra virtual disk where they need more private space. This is about what the Big Boys do with their zSeries.
On 2/26/07, John Summerfield debian@herakles.homelinux.org wrote:
Using swap by itself is generally a speed penalty. Using a file for it can be done, but it's not really something I'd do.
Why not?
Habit, and I have yet to hear a convincing argument for why it's worth the (admittedly minimal) trouble to configure as opposed to a normal swap partition.
OTOH anything bad you can do with /tmp you can do better with /var/tmp, and making that noexec is not a realistic proposition.
Very true, but applications like apache/php use /tmp as their default scratch/upload space. While mounting noexec won't stop determined folks, it may be a step that deters the more common automaded bot attacks. It's by no means a total solution, but it's a layer that can be used, and a layered security model is the best way to go in my opinion. I use this in conjunction with selinux and mod_security for my webservers which so far has been an excellent combination.
For a personal system, I go with one big partition (well, maybe plus a little one for /boot).
My home systems are the one I'm most concerned about /home on (as I tend to wipe and rebuild frequently) but I usually don't partition out much else than /home and /boot.
For a small server, same deal. If you don't know what you're doing, you don't have any chance of getting it right for you.
That's why he has us to ask :-P
With Xen, I'm now contemplating several small systems under Xen, with shared storage (via NFS maybe, NFS should be fairly quick over virtual wire) where sensible, extra virtual disk where they need more private space. This is about what the Big Boys do with their zSeries.
If you're going to go that route, finish it off and make yourself a virtual cluster with the CS/GFS stuff and use that for your shared storage.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Mon, Feb 26, 2007 at 08:48:15PM -0500, Jim Perrin wrote:
OTOH anything bad you can do with /tmp you can do better with /var/tmp, and making that noexec is not a realistic proposition.
Very true, but applications like apache/php use /tmp as their default scratch/upload space.
Thank you by saying "default".
This is one thing I think should be watched carefully. I for one make sure not only /tmp is mounted noexec, but also that apache can't write to it:
On one of my servers (webserver mainly):
/dev/sda3 on /tmp type ext3 (rw,noexec,nosuid,nodev,acl)
$ getfacl /tmp | grep apache getfacl: Removing leading '/' from absolute path names user:apache:--- default:user:apache:---
This kind of setup can save you a world of trouble/headaches.
[]s
- -- Rodrigo Barbosa "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Tue, Feb 27, 2007 at 10:07:35AM +0900, John Summerfield wrote:
This depends entirely on the tasks required of the box. Putting /tmp on a separate partition can allow you to mount it noexec, which can help with security, and filling up /tmp won't fill the rest of the disk.
OTOH anything bad you can do with /tmp you can do better with /var/tmp, and making that noexec is not a realistic proposition.
Why not ? I have /tmp and /var/tmp as noexec on all my servers, along with ACLs to better protect it.
[]s
- -- Rodrigo Barbosa "Quid quid Latine dictum sit, altum viditur" "Be excellent to each other ..." - Bill & Ted (Wyld Stallyns)
Mike McCarty wrote:
I am considering installing CentOS 4.4, and am interested in how best to set up. I have been using FC2 and helping administer a Debian machine for a few years, but do not consider myself a Linux guru.
My current set up uses a /swap partition which is 2x my memory size
This is a completely false premise that has no basis in Linux or even in verions of Solaris after SunOS4. Only SunOS4 *REQUIRED* swap be twice the amount of RAM due to how its VM was implemented. The best of part of this is that this is actually a part of the 'knowledge' that the LPI examinations will examine you on.
With regards to swap, on servers you want to tune things such that swap is NEVER used but do create some swap space to handle edge cases. On desktops, create as much swap as you wish to handle firefox, thunderbird or whatever memory hungry GTK application you have. Of course, the more RAM you have, the merrier.
I'm also interested in whether it be reasonable/desirable to make /home, /tmp, and /var be on a separate partition. I have heard arguments on both sides, some claiming that with ext3 the system won't become unbootable because of /tmp filling up.
ext3 reserves blocks and inodes for root so it is true that /tmp filling up will not prevent boot up to an extent. You might find it necessary to make sure /var is not filled up if it prevents any critical services from starting. Putting /home on a separate partition makes it easier to upgrade the OS without having to move data around. If it were possible to make / read only, I would definitely put /tmp on a separate partition and just use ext2 for it.
I would therefore put at least /home and /var on separate partitions if it were a server where /home had data. If not, /var will be on its own. If it were my home desktop, /home definitely gets its own partition.
Feizhou wrote:
Mike McCarty wrote:
I am considering installing CentOS 4.4, and am interested in how best to set up. I have been using FC2 and helping administer a Debian machine for a few years, but do not consider myself a Linux guru.
My current set up uses a /swap partition which is 2x my memory size
This is a completely false premise that has no basis in Linux or even in verions of Solaris after SunOS4. Only SunOS4 *REQUIRED* swap be twice the amount of RAM due to how its VM was implemented. The best of part of this is that this is actually a part of the 'knowledge' that the LPI examinations will examine you on.
With regards to swap, on servers you want to tune things such that swap is NEVER used but do create some swap space to handle edge cases. On desktops, create as much swap as you wish to handle firefox, thunderbird or whatever memory hungry GTK application you have. Of course, the more RAM you have, the merrier.
Of course. But I'm a laid-off engineer. If you like, I'd gladly take donations for more RAM. In the meantime, this machine remains 256M.
This is a single-user desktop with no external access servers like SSH, Apache, or NFS running. I have a firewall to enforce no external access, which "stealths" all ports except the e-mail port, which is denied.
I find that on my machine, memory usage often looks like this:
Mem: 248088k total, 244192k used, 3896k free, 11860k buffers Swap: 524120k total, 182916k used, 341204k free, 43576k cached
[snip]
I would therefore put at least /home and /var on separate partitions if it were a server where /home had data. If not, /var will be on its own. If it were my home desktop, /home definitely gets its own partition.
Thanks for the reply.
Mike
Of course. But I'm a laid-off engineer. If you like, I'd gladly take donations for more RAM. In the meantime, this machine remains 256M.
This is a single-user desktop with no external access servers like SSH, Apache, or NFS running. I have a firewall to enforce no external access, which "stealths" all ports except the e-mail port, which is denied.
sshd takes little resources and I use it because I sometimes need to be able to access my home machine from work. With a desktop, what really matters is them memory hogs firefox, thunderbird and other GTK rubbish. If opera's IMAP client was better, I would switch over completely. Or maybe I should just try mutt again...
I find that on my machine, memory usage often looks like this:
Mem: 248088k total, 244192k used, 3896k free, 11860k buffers Swap: 524120k total, 182916k used, 341204k free, 43576k cached
Here is mine.
free -m total used free shared buffers cached Mem: 503 440 63 0 84 233 -/+ buffers/cache: 122 380 Swap: 2047 0 2047
At the moment, there is nothing running except KDE and konsole with a few terminals. swappiness set to 0 :D.
When I get firefox and thunderbird fired up, memory usage can go through the roof so I have allocated 2GB (maximum swap partition size btw) for my swap partition. I get the odd 1GB worth of swap once in a while that takes quite a while to release when I close firefox and thunderbird...
So there you go. Set up as much swap as you need/want for a desktop.
On 27/02/07, Feizhou feizhou@graffiti.net wrote:
When I get firefox and thunderbird fired up, memory usage can go through the roof so I have allocated 2GB (maximum swap partition size btw) for
Pardon me, but I just set up a CentOS box with 8GB of swap partition yesterday. Am I misisng something?
my swap partition. I get the odd 1GB worth of swap once in a while that takes quite a while to release when I close firefox and thunderbird...
Alvin Chang wrote:
On 27/02/07, Feizhou feizhou@graffiti.net wrote:
When I get firefox and thunderbird fired up, memory usage can go through the roof so I have allocated 2GB (maximum swap partition size btw) for
Pardon me, but I just set up a CentOS box with 8GB of swap partition yesterday. Am I misisng something?
Hmm...after looking carefully at the mkswap man page, it appears I have been out of date on Linux swap support. :D
This was true on 2.2 kernels for i386 boxes and the limitations on the maximum useful size of a swap are were removed in 2.3.3
On Tue, 2007-02-27 at 07:36 +0200, Alvin Chang wrote:
On 27/02/07, Feizhou feizhou@graffiti.net wrote:
When I get firefox and thunderbird fired up, memory usage can go through the roof so I have allocated 2GB (maximum swap partition size btw) for
Pardon me, but I just set up a CentOS box with 8GB of swap partition yesterday. Am I misisng something?
Not really. 2GB is (or was) the maximum _safe_ swap partition size. However, I have a system with a 4GB swap part and one with a 3GB swap running CentOS, and they both run fine.
I have heard however, that smaller-sized swap partitions are faster/more efficient. ie. 3x1 GB swap partitions are 'supposed to be' better than 1 x 3 GB partition. So when I'm building new systems, I create a number of 1 GB swap partitions depending upon predicted load, and give them differing priorities.
I've theorized (but never bothered to do some benchmarking or to put into practice) that optimum swap strategy may be to have varying sizes eg. 512 MB with highest priority, then 1 GB, 2 GB and 4GB with lowest priority. But I think that would be 'gilding the lily', for just a 'theoretical' increase in eficiency, as opposed to making a practical difference.
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of DamianS Sent: Tuesday, February 27, 2007 1:59 AM To: CentOS mailing list Subject: Re: [CentOS] Swap Considerations
On Tue, 2007-02-27 at 07:36 +0200, Alvin Chang wrote:
On 27/02/07, Feizhou feizhou@graffiti.net wrote:
When I get firefox and thunderbird fired up, memory usage
can go through
the roof so I have allocated 2GB (maximum swap partition
size btw) for
Pardon me, but I just set up a CentOS box with 8GB of swap partition yesterday. Am I misisng something?
Not really. 2GB is (or was) the maximum _safe_ swap partition size. However, I have a system with a 4GB swap part and one with a 3GB swap running CentOS, and they both run fine.
I have heard however, that smaller-sized swap partitions are faster/more efficient. ie. 3x1 GB swap partitions are 'supposed to be' better than 1 x 3 GB partition. So when I'm building new systems, I create a number of 1 GB swap partitions depending upon predicted load, and give them differing priorities.
I've theorized (but never bothered to do some benchmarking or to put into practice) that optimum swap strategy may be to have varying sizes eg. 512 MB with highest priority, then 1 GB, 2 GB and 4GB with lowest priority. But I think that would be 'gilding the lily', for just a 'theoretical' increase in eficiency, as opposed to making a practical difference.
If you have 4 1GB swap partitions of equal priority it will interleave operations between them giving you a RAID0 type effect and increasing overall swap performance.
If you setup swap on top of RAID-1, say with LVM, then this scenario will give you the best performance and be able to continue running in the event of a drive failure.
-Ross
______________________________________________________________________ This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof.
On Tue, 27 Feb 2007 at 2:53pm, Ross S. W. Walker wrote
If you have 4 1GB swap partitions of equal priority it will interleave operations between them giving you a RAID0 type effect and increasing overall swap performance.
Note that this will only increase your swap performance if those partitions are on separate physical hard drives. If they're all on the same spindle -- well, that's a bit silly.
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Joshua Baker-LePain Sent: Tuesday, February 27, 2007 2:56 PM To: CentOS mailing list Subject: RE: [CentOS] Swap Considerations
On Tue, 27 Feb 2007 at 2:53pm, Ross S. W. Walker wrote
If you have 4 1GB swap partitions of equal priority it will
interleave
operations between them giving you a RAID0 type effect and
increasing
overall swap performance.
Note that this will only increase your swap performance if those partitions are on separate physical hard drives. If they're all on the same spindle -- well, that's a bit silly.
Yes, true, if you have the spindles.
-Ross
______________________________________________________________________ This e-mail, and any attachments thereto, is intended only for use by the addressee(s) named herein and may contain legally privileged and/or confidential information. If you are not the intended recipient of this e-mail, you are hereby notified that any dissemination, distribution or copying of this e-mail, and any attachments thereto, is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender and permanently delete the original and any copy or printout thereof.
On Tue, Feb 27, 2007 at 07:36:36AM +0200, Alvin Chang wrote:
When I get firefox and thunderbird fired up, memory usage can go through the roof so I have allocated 2GB (maximum swap partition size btw) for
Pardon me, but I just set up a CentOS box with 8GB of swap partition yesterday. Am I misisng something?
Sure -- about 8GB of disk space which could have been better used in another way. :)
On 27/02/07, Matthew Miller mattdm@mattdm.org wrote:
On Tue, Feb 27, 2007 at 07:36:36AM +0200, Alvin Chang wrote:
When I get firefox and thunderbird fired up, memory usage can go through the roof so I have allocated 2GB (maximum swap partition size btw) for
Pardon me, but I just set up a CentOS box with 8GB of swap partition yesterday. Am I misisng something?
Sure -- about 8GB of disk space which could have been better used in another way. :)
eerrrr but it would be 6GB surely? AFAIK 2GB of swap is max addresseable by CentOS so only balance would have been better used somewhere else ;-)
On Tue, Feb 27, 2007 at 05:47:08PM +0530, Sudev Barar wrote:
Pardon me, but I just set up a CentOS box with 8GB of swap partition yesterday. Am I misisng something?
Sure -- about 8GB of disk space which could have been better used in another way. :)
eerrrr but it would be 6GB surely? AFAIK 2GB of swap is max addresseable by CentOS so only balance would have been better used somewhere else ;-)
In almost all cases, if you're using more than a few dozen megabytes of swap, it's already too late. Disk is so many times slower than ram it's pathetic. If you have to use anywhere close to 2GB, you might as well be out of memory.
(The exception here is suspend-to-disk, which uses your swap partition.)
Matthew Miller wrote:
[snip]
(The exception here is suspend-to-disk, which uses your swap partition.)
This is interesting, and something which just occurred to me. There should be no reason that a desktop system should not be able to suspend to disk. I have an UPS which saves my hide about one or two times a month. OTOH, perhaps three times it has completely run down, and I lost power. ISTM that one should be able to configure a desktop to "notice" when the UPS is signalling that it is out of power, and be able to suspend to disk, rather than shut down.
I haven't bothered to learn how to make my machine shut down when the UPS is about to go "flat", because it hasn't seemed worth the effort. However, if I could make it suspend to disk, so the machine state could be recovered, that would be worth it.
Anyone have recommendations on how this could be done, and how much swap to reserve for that?
Mike
I'm going to be different from most. I don't believe in using swap at all. I have my swap starting equal to my ram and as i go up i REDUCE the swap. My vm.swappiness is always set to zero as swapping to disk is many times slower than keeping it in ram.
Mike McCarty wrote:
I am considering installing CentOS 4.4, and am interested in how best to set up. I have been using FC2 and helping administer a Debian machine for a few years, but do not consider myself a Linux guru.
My current set up uses a /swap partition which is 2x my memory size
mem = 256 MB
$ sudo /sbin/fdisk -l /dev/hda6 76506 77545 524128+ 82 Linux swap
I'm interested in the use of a file for swap, as I hear that there is now no speed penalty for that. I use ext3 for my partitions.
I'm also interested in whether it be reasonable/desirable to make /home, /tmp, and /var be on a separate partition. I have heard arguments on both sides, some claiming that with ext3 the system won't become unbootable because of /tmp filling up.
Anyone care to weigh in?
Mike
William Warren spake the following on 2/27/2007 12:04 PM:
I'm going to be different from most. I don't believe in using swap at all. I have my swap starting equal to my ram and as i go up i REDUCE the swap. My vm.swappiness is always set to zero as swapping to disk is many times slower than keeping it in ram.
Yes, but a small bit of swap in an emergency condition wouldn't hurt, and dasd is a lot cheaper than it used to be.
I guess I am showing my age with the dasd reference.
wow..i actually remembe3red what that was..rofl..:) That's not a term i have heard in a looooong time..<G>
Scott Silva wrote:
William Warren spake the following on 2/27/2007 12:04 PM:
I'm going to be different from most. I don't believe in using swap at all. I have my swap starting equal to my ram and as i go up i REDUCE the swap. My vm.swappiness is always set to zero as swapping to disk is many times slower than keeping it in ram.
Yes, but a small bit of swap in an emergency condition wouldn't hurt, and dasd is a lot cheaper than it used to be.
I guess I am showing my age with the dasd reference.
I guess I am showing my age with the dasd reference.
Only a little :-P
However, since today seems to be 'old reference' day between here and work, I'll throw down a gauntlet.
Geek challenge of the day: What does the acronym GECOS stand for and how is it used in linux today?
No cheating with man pages or wikipedia!
On Tuesday 27 February 2007 4:46:59 pm Jim Perrin wrote:
However, since today seems to be 'old reference' day between here and work, I'll throw down a gauntlet.
Geek challenge of the day: What does the acronym GECOS stand for and how is it used in linux today?
No cheating with man pages or wikipedia!
General Electric Comprehensive Operating System It is my understanding that it is currently used in linux to refer to the proper name field in the /etc/passwd file.
Is that close?
I cheated, however, I didn't use wikipedia or the man page. So I /am/ following the rules set forth ;)
Tim
General Electric Comprehensive Operating System It is my understanding that it is currently used in linux to refer to the proper name field in the /etc/passwd file.
Is that close?
Winner!
I cheated, however, I didn't use wikipedia or the man page. So I /am/ following the rules set forth ;)
ooooh stripped of the ribbon :-P
(I use that question occasionally during hiring sessions to see who *really* knows their stuff )
Tim Wunder spake the following on 2/27/2007 2:00 PM:
On Tuesday 27 February 2007 4:46:59 pm Jim Perrin wrote:
However, since today seems to be 'old reference' day between here and work, I'll throw down a gauntlet.
Geek challenge of the day: What does the acronym GECOS stand for and how is it used in linux today?
No cheating with man pages or wikipedia!
General Electric Comprehensive Operating System It is my understanding that it is currently used in linux to refer to the proper name field in the /etc/passwd file.
Is that close?
I cheated, however, I didn't use wikipedia or the man page. So I /am/ following the rules set forth ;)
Tim
He didn't say you couldn't use Google ;-P Plenty of links that aren't man page or wikipedia.
It's even in RedHat docs.
On Tuesday 27 February 2007 6:53:50 pm Scott Silva wrote:
Tim Wunder spake the following on 2/27/2007 2:00 PM:
<snip>
I cheated, however, I didn't use wikipedia or the man page. So I /am/ following the rules set forth ;)
He didn't say you couldn't use Google ;-P Plenty of links that aren't man page or wikipedia.
It's even in RedHat docs.
Google! Hah! My sources are far more reliable than google ;)
Tim
Scott Silva wrote:
William Warren spake the following on 2/27/2007 12:04 PM:
I'm going to be different from most. I don't believe in using swap at all. I have my swap starting equal to my ram and as i go up i REDUCE the swap. My vm.swappiness is always set to zero as swapping to disk is many times slower than keeping it in ram.
Yes, but a small bit of swap in an emergency condition wouldn't hurt, and dasd is a lot cheaper than it used to be.
But a lot of swap in some emergencies can cause more problems that they solve. I have several times over the years had an app start eating up memory and my system will get to a point that it is useless for a VERY long time while even trying to log in can take a very long time(hour) or never finish because your system is so busy moving tasks back and forth into and out of swap under that condition.
I prefer for my desktop system to have plenty of RAM. If swap is ever filled up by even 64 megs something is wrong. By setting swap very low and making sure I have plenty of memory if some app does start eating up memory the oom killer will kill the task much faster if your system isn't busy trying to swap 512 megs of running tasks that got pushed into swap because of one runaway app.
On 3/1/07, Adam Gibson agibson@ptm.com wrote:
Scott Silva wrote:
William Warren spake the following on 2/27/2007 12:04 PM:
I'm going to be different from most. I don't believe in using swap at all. I have my swap starting equal to my ram and as i go up i REDUCE the swap. My vm.swappiness is always set to zero as swapping to disk is many times slower than keeping it in ram.
Yes, but a small bit of swap in an emergency condition wouldn't hurt, and dasd is a lot cheaper than it used to be.
But a lot of swap in some emergencies can cause more problems that they solve. I have several times over the years had an app start eating up memory and my system will get to a point that it is useless for a VERY long time while even trying to log in can take a very long time(hour) or never finish because your system is so busy moving tasks back and forth into and out of swap under that condition.
I prefer for my desktop system to have plenty of RAM. If swap is ever filled up by even 64 megs something is wrong. By setting swap very low and making sure I have plenty of memory if some app does start eating up memory the oom killer will kill the task much faster if your system isn't busy trying to swap 512 megs of running tasks that got pushed into swap because of one runaway app.
The problem with the OOM killer is it cannot differentiate between mission critical apps and other not so critical. Course, once you really do run out of memory what other choice do you have? An automatic orderly shutdown and reboot (that actually might be a better choice for telco/CGL environments). Anyway just some thoughts...james
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
James Olin Oden wrote:
On 3/1/07, Adam Gibson agibson@ptm.com wrote:
I prefer for my desktop system to have plenty of RAM. If swap is ever filled up by even 64 megs something is wrong. By setting swap very low and making sure I have plenty of memory if some app does start eating up memory the oom killer will kill the task much faster if your system isn't busy trying to swap 512 megs of running tasks that got pushed into swap because of one runaway app.
The problem with the OOM killer is it cannot differentiate between mission critical apps and other not so critical. Course, once you really do run out of memory what other choice do you have? An automatic orderly shutdown and reboot (that actually might be a better choice for telco/CGL environments). Anyway just some thoughts...james
For a server I agree that it is a gamble... would you rather the system eat itself alive and be non responsive requiring a hard reset or for it to try and kill the app that it thinks is causing the problem though. Either way there is a possibility of lost data but with the small swap though you can restore things to working order quicker and safer imho. I would argue that killing the app vs a hard reset is better in most circumstances especially if you have more than one service running on the server. Kill all services and make them get into an unknown state because of a hard reset or just have one service get that treatment. I vote for the latter. I never set more than 256 megs of swap on servers but even with that much swap the system can stay non-responsive for a very long time if the system gets overloaded memory wise.
For a desktop system though the oom killer seems to kill the correct app for me because I have plenty of memory to spare so it kills the one with the most memory I assume. It might get it wrong but you should save often anyway. This is not as critical for a desktop system for the oom killer to try and kill something.
William Warren wrote:
I'm going to be different from most. I don't believe in using swap at all. I have my swap starting equal to my ram and as i go up i REDUCE the swap. My vm.swappiness is always set to zero as swapping to disk is many times slower than keeping it in ram.
OH come on, you don't need to do that for a DESKTOP! Or do you really do this for your deskop?
I do it for ALL Linux boxes i run. Why would i want to chug a machine through swap? That's the windows way of doing things. I'll just throw in memory..especially with how cheap it is these days.
Feizhou wrote:
William Warren wrote:
I'm going to be different from most. I don't believe in using swap at all. I have my swap starting equal to my ram and as i go up i REDUCE the swap. My vm.swappiness is always set to zero as swapping to disk is many times slower than keeping it in ram.
OH come on, you don't need to do that for a DESKTOP! Or do you really do this for your deskop? _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
.
William Warren wrote:
I do it for ALL Linux boxes i run. Why would i want to chug a machine through swap? That's the windows way of doing things. I'll just throw in memory..especially with how cheap it is these days.
/me wishes he had spare cash to get more RAM to handle memory abusing GTK apps.
:D
Funny though that you say Windows chugs through swap. I remember millions of posts from newbie Linux 'admins' complaining about Linux using up all memory available. Does not that imply that Windows does not chug through swap? Or you are just saying that is what Windows admins do?
windows doesn't work like Linux..:0 In windows it does everything it can to present some free memory to the admins because they are trained from 9x that says you must have free physical ram or the systems will crash. Plus windows allocates swap for every byte of allocated physical memory.
We all know how Linux totally departs from this mindless ideal..:)
Feizhou wrote:
William Warren wrote:
I do it for ALL Linux boxes i run. Why would i want to chug a machine through swap? That's the windows way of doing things. I'll just throw in memory..especially with how cheap it is these days.
/me wishes he had spare cash to get more RAM to handle memory abusing GTK apps.
:D
Funny though that you say Windows chugs through swap. I remember millions of posts from newbie Linux 'admins' complaining about Linux using up all memory available. Does not that imply that Windows does not chug through swap? Or you are just saying that is what Windows admins do? _______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
.
On 28/02/07, William Warren hescominsoon@emmanuelcomputerconsulting.com wrote:
windows doesn't work like Linux..:0 In windows it does everything it can to present some free memory to the
Snipped and bottom posting.... Poor OP .... he would be totally confused now. So to OP...nothing wrong with your swap set.with experience you may find the swap settings needed for next server.
Sudev Barar wrote:
On 28/02/07, William Warren hescominsoon@emmanuelcomputerconsulting.com wrote:
windows doesn't work like Linux..:0 In windows it does everything it can to present some free memory to the
Snipped and bottom posting.... Poor OP .... he would be totally confused now. So to OP...nothing wrong with your swap set.with experience you may find the swap settings needed for next server.
Well, I'm the OP, and I'm not as confused as you may think, having supported various OS on several hardware platforms since about 1982 or so :-)
Mostly RTOS, wrote one in 1984.
Mike
William Warren wrote:
I do it for ALL Linux boxes i run. Why would i want to chug a machine through swap? That's the windows way of doing things. I'll just throw in memory..especially with how cheap it is these days.
You aren't a laid-off telecomm engineer, like I am. NOTHING is cheap.
Mike
I'm not a laid off telecom engineer i am a laid off PC technician for over two years so i started teaching myself other stuff and started my own consultancy. Even with tight finances memory is still cheap..:)
Mike McCarty wrote:
William Warren wrote:
I do it for ALL Linux boxes i run. Why would i want to chug a machine through swap? That's the windows way of doing things. I'll just throw in memory..especially with how cheap it is these days.
You aren't a laid-off telecomm engineer, like I am. NOTHING is cheap.
Mike
William Warren spake the following on 2/27/2007 4:57 PM:
I do it for ALL Linux boxes i run. Why would i want to chug a machine through swap? That's the windows way of doing things. I'll just throw in memory..especially with how cheap it is these days.
The windows way of doing things is to REQUIRE more ram and faster processors every upgrade.
I don't do things that way. Why would you want to use swap when ram is orders of magnitudes faster and cheap? I have several Centos server from a p-3 1ghz all the way to a p-d 2.8 ghz. I have put centos 4.4 on a p-3 550 with 256 megs of ram. The instant i could i added another 256 megs of ram because swap was chuggin the box. I don't change processors every upgrade. hell my current machine is 5+ years old and has lived through windows 2k and xp and will get vista. it has done centos 3 and now centos 4. i don't advocate nor practice the windows way of hardware management.
Scott Silva wrote:
William Warren spake the following on 2/27/2007 4:57 PM:
I do it for ALL Linux boxes i run. Why would i want to chug a machine through swap? That's the windows way of doing things. I'll just throw in memory..especially with how cheap it is these days.
The windows way of doing things is to REQUIRE more ram and faster processors every upgrade.
On Wed, Feb 28, 2007 at 08:48:01AM +0800, Feizhou wrote:
I'm going to be different from most. I don't believe in using swap at all. I have my swap starting equal to my ram and as i go up i REDUCE the swap. My vm.swappiness is always set to zero as swapping to disk is many times slower than keeping it in ram.
OH come on, you don't need to do that for a DESKTOP! Or do you really do this for your deskop?
The answer is, as always, "it depends." This is one of those edge cases which has practically nothing to do reality.
One of my customers got very unhappy because his 16G system only had 2G of swap, and his app was now happilly making working sets in excess of 20G. (They knew what the size of the working set was because an otherwise identical system which did have 16G of swap was showing a peak load of 20G.)
When confronted with this, I argued that if the working set was in any way dynamic they'd be far better off taking all the RAM out of one box and putting it into the second and running two jobs sequentially on it (or even better, buy more RAM for both computers). However, detailed examination showed that most of this working set was not dynamically used -- it was written into RAM, then post-processed into a file (which, of course, was almost immediately dumped). So while things got slow at the end, it wasn't faster to run two jobs sequentially on a single machine with all the RAM.
Like I said, this example has almost nothing to do with reality.
William Warren wrote:
I'm going to be different from most. I don't believe in using swap at all. I have my swap starting equal to my ram and as i go up i REDUCE the swap. My vm.swappiness is always set to zero as swapping to disk is many times slower than keeping it in ram.
It makes sense not to continue to increase swap as RAM increases, that's true. But for "small" RAM machines, swap makes a lot of sense, I trow. Virtual is slow, but it beats not being able to run apps at all.
Mike
Mike McCarty wrote:
[snip]
I'm interested in the use of a file for swap, as I hear that there is now no speed penalty for that. I use ext3 for my partitions.
I'm still waiting for some commentary on use of a file for swap.
Mike
On 2/28/07, Mike McCarty Mike.McCarty@sbcglobal.net wrote:
Mike McCarty wrote:
[snip]
I'm interested in the use of a file for swap, as I hear that there is now no speed penalty for that. I use ext3 for my partitions.
I'm still waiting for some commentary on use of a file for swap.
heh, it does appear that the conversation missed the boat. Actually, I asked RedHat (when we supposedly had their attention) years ago about what the real swap requirements for linux where, or what were the best practices, and what should we monitor concerning swap for alarming purposes and never really got a good answer. Those were back in the RH 9 days, but at anyrate I would be interested in hearing oppinions of how one should use swap if they were to use it.
Cheers...james
heh, it does appear that the conversation missed the boat. Actually, I asked RedHat (when we supposedly had their attention) years ago about what the real swap requirements for linux where, or what were the best practices, and what should we monitor concerning swap for alarming purposes and never really got a good answer. Those were back in the RH 9 days, but at anyrate I would be interested in hearing oppinions of how one should use swap if they were to use it.
With the presence of LVM, I would make a mirror array, make that a PV and later make a lv for the swap partition.
I think monitoring swap comes down to two things: strange memory use and whether there is a lot of stuff going in and out of swap and the amount of data. For I/O intensive servers, you don't want to see swap being used so monitoring swap usage can help to fine tune no. of processes or whatever to keep the box from using swap if it does use swap.
So I personally only care about swap if using it gets in the way (usually servers) and if my box does not have enough RAM for the applications I have to open where disk I/O is not critical (usually desktops)
On 3/1/07, Feizhou feizhou@graffiti.net wrote:
heh, it does appear that the conversation missed the boat. Actually, I asked RedHat (when we supposedly had their attention) years ago about what the real swap requirements for linux where, or what were the best practices, and what should we monitor concerning swap for alarming purposes and never really got a good answer. Those were back in the RH 9 days, but at anyrate I would be interested in hearing oppinions of how one should use swap if they were to use it.
With the presence of LVM, I would make a mirror array, make that a PV and later make a lv for the swap partition.
I think monitoring swap comes down to two things: strange memory use and whether there is a lot of stuff going in and out of swap and the amount of data. For I/O intensive servers, you don't want to see swap being used so monitoring swap usage can help to fine tune no. of processes or whatever to keep the box from using swap if it does use swap.
What your really saying, and this is a very fair answer, is to monitor it on systems with different loads and learn what it should look like when things are well, such that I can determine what is the norm, and thus with that defination identify aberrations.
So I personally only care about swap if using it gets in the way (usually servers) and if my box does not have enough RAM for the applications I have to open where disk I/O is not critical (usually desktops)
Presently most of our servers have between 4 and 8 gigs of ram, and our distro (a one off from CentOS) blankedly creates a 2 gig swap area on top of lvm on top of a raid 1 md device. But with all the applications we write not a one of them do we ever want to actually use swap, we mainly have it there just in case. What we never did was the research on our own to figure out what real threshholds exist such that we could monitor and alarm when thresholds were crossed. On Solaris we were given very specific things to look for by Sun, so we were taken aback when RedHat (whom we were paying too) did not give such specific instructions.
thanks...james
I think monitoring swap comes down to two things: strange memory use and whether there is a lot of stuff going in and out of swap and the amount of data. For I/O intensive servers, you don't want to see swap being used so monitoring swap usage can help to fine tune no. of processes or whatever to keep the box from using swap if it does use swap.
What your really saying, and this is a very fair answer, is to monitor it on systems with different loads and learn what it should look like when things are well, such that I can determine what is the norm, and thus with that defination identify aberrations.
No. You do not have to compare different systems. See below.
So I personally only care about swap if using it gets in the way (usually servers) and if my box does not have enough RAM for the applications I have to open where disk I/O is not critical (usually desktops)
Presently most of our servers have between 4 and 8 gigs of ram, and our distro (a one off from CentOS) blankedly creates a 2 gig swap area on top of lvm on top of a raid 1 md device. But with all the applications we write not a one of them do we ever want to actually use swap, we mainly have it there just in case. What we never did was the research on our own to figure out what real threshholds exist such that we could monitor and alarm when thresholds were crossed. On Solaris we were given very specific things to look for by Sun, so we were taken aback when RedHat (whom we were paying too) did not give such specific instructions.
It comes down to whether the use of swap has a significant effect on your operations. You can tell the kernel to not ever use swap unless absolutely necessary: swappiness = 0. Normally it is set at 60 (range is from 0 - 100). Let me explain how I would handle swap.
Take a case of mail servers with hundreds of processes that only have 1GB of RAM and a pair of disks. I would use vmstat to check the 'si so' columns to see whether the box is swapping. Positive figures in both columns indicates use of swap and if I see constant reports of positive figures for these two columns, I start reducing the number of processes allowed to run to increase performance. This is how I identify active swap usage as opposed to swap in use. Swap in use is not the same as active swap usage. I could get maybe tens or even hundreds of megabytes being reported in swap but if vmstat 'si so' columns report zeros, I don't worry about its effect on disk i/o because there is none. However, if the amount of swap in use continues to grow over time, I start looking for memory leaks.
On Thu, 2007-03-01 at 23:17 +0800, Feizhou wrote:
It comes down to whether the use of swap has a significant effect on your operations. You can tell the kernel to not ever use swap unless absolutely necessary: swappiness = 0. Normally it is set at 60 (range is from 0 - 100). Let me explain how I would handle swap.
Take a case of mail servers with hundreds of processes that only have 1GB of RAM and a pair of disks. I would use vmstat to check the 'si so' columns to see whether the box is swapping. Positive figures in both columns indicates use of swap and if I see constant reports of positive figures for these two columns, I start reducing the number of processes allowed to run to increase performance. This is how I identify active swap usage as opposed to swap in use. Swap in use is not the same as active swap usage. I could get maybe tens or even hundreds of megabytes being reported in swap but if vmstat 'si so' columns report zeros, I don't worry about its effect on disk i/o because there is none. However, if the amount of swap in use continues to grow over time, I start looking for memory leaks.
This has been a very interesting thread, and given the length (discounting a few digressions), and the general number of occurrences of the subject of swap in the list archives, there is a high level of interest in the topic. My search of the Wiki turns up nothing helpful. Sounds like a good candidate for an entry on the Wiki FAQ page:
Anyone (like Feizhou :-) who has a through grasp of the topic willing to step up?
Cheers, Phil
Phil Schaffner wrote:
This has been a very interesting thread, and given the length (discounting a few digressions), and the general number of occurrences of the subject of swap in the list archives, there is a high level of interest in the topic. My search of the Wiki turns up nothing helpful. Sounds like a good candidate for an entry on the Wiki FAQ page:
Anyone (like Feizhou :-) who has a through grasp of the topic willing to step up?
Hey! Normally that would be my job to spot documentation for the wiki!
=:)
Yes, I'd really like to see that there, also. So if anyone wants to step up and jump through the hoops:
http://wiki.centos.org/HowToContribute/Wiki
Ralph
Mike McCarty spake the following on 2/28/2007 7:06 PM:
Mike McCarty wrote:
[snip]
I'm interested in the use of a file for swap, as I hear that there is now no speed penalty for that. I use ext3 for my partitions.
I'm still waiting for some commentary on use of a file for swap.
Mike
Might be a little slower with file system overhead, but it is not a problem to do so. Is there some reason you want to use a file? IMHO a 2 gig swap partition takes the same space as a 2 gig swap file.
Scott Silva wrote:
Might be a little slower with file system overhead, but it is not a problem to do so.
I have heard that, with ext3, the extra time to use a file has mostly been removed.
Is there some reason you want to use a file? IMHO a 2 gig swap partition takes the same space as a 2 gig swap file.
Yes, I'd like to experiment with various amounts of swap, and see what best fits my system. I don't want to repartition over and over, and reinstall repeatedly. ISTM that if I can fix the size of swap by using a file it would be more easily tuned.
But I hope the tuning isn't markedly different for using a swap partition and a swap file. Near a min or max, any smoothly changing function has a derivative near zero, so if the sweet point isn't very far away, it shouldn't make much difference to actual performance.
Mike
Mike McCarty wrote:
Might be a little slower with file system overhead, but it is not a problem to do so.
I have heard that, with ext3, the extra time to use a file has mostly been removed.
Is there some reason you want to use a file? IMHO a 2 gig swap partition takes the same space as a 2 gig swap file.
Yes, I'd like to experiment with various amounts of swap, and see what best fits my system. I don't want to repartition over and over, and reinstall repeatedly. ISTM that if I can fix the size of swap by using a file it would be more easily tuned.
What kind of a system are you using where this even matters? If you've swapped out 2 gigs and have to wait for programs to reload as they run the machine will be so unresponsive that you'd probably reboot instead of waiting for it to recover. It doesn't hurt to swap out memory from programs that aren't active and you want to survive the nightly updatedb runs, etc. that hopefully happen when interactive speed doesn't matter, but if you are swapping enough that performance of the swap space matters you should fix it some other way. Remember what Seymour Cray said about virtual memory: "Memory is like an orgasm. It's a lot better when you don't have to fake it". And that hasn't changed.
But I hope the tuning isn't markedly different for using a swap partition and a swap file. Near a min or max, any smoothly changing function has a derivative near zero, so if the sweet point isn't very far away, it shouldn't make much difference to actual performance.
You should be able to add a file as extra swap space if you need it in addition to any partition(s) you have configured.
Mike McCarty spake the following on 3/1/2007 8:43 AM:
Scott Silva wrote:
Might be a little slower with file system overhead, but it is not a problem to do so.
I have heard that, with ext3, the extra time to use a file has mostly been removed.
Is there some reason you want to use a file? IMHO a 2 gig swap partition takes the same space as a 2 gig swap file.
Yes, I'd like to experiment with various amounts of swap, and see what best fits my system. I don't want to repartition over and over, and reinstall repeatedly. ISTM that if I can fix the size of swap by using a file it would be more easily tuned.
But I hope the tuning isn't markedly different for using a swap partition and a swap file. Near a min or max, any smoothly changing function has a derivative near zero, so if the sweet point isn't very far away, it shouldn't make much difference to actual performance.
Mike
The best swap is un-needed swap. If you need to play with swap for performance reasons, just get some more memory.
Scott Silva wrote:
The best swap is un-needed swap. If you need to play with swap for performance reasons, just get some more memory.
I have two reasons. One is that my system is indeed somewhat overburdened and needs more RAM, which I don't have funds for at the moment. The second reason is for the purposes of experimentation itself. "Just get more memory" is not economically feasible, and even if I did that, it wouldn't address reason # 2.
Mike
Mike McCarty spake the following on 3/2/2007 8:28 AM:
Scott Silva wrote:
The best swap is un-needed swap. If you need to play with swap for performance reasons, just get some more memory.
I have two reasons. One is that my system is indeed somewhat overburdened and needs more RAM, which I don't have funds for at the moment. The second reason is for the purposes of experimentation itself. "Just get more memory" is not economically feasible, and even if I did that, it wouldn't address reason # 2.
Mike
Then I think the best performance option would be a swap partition on a separate hard drive. Run some tests on the drive to see where it's sweet spot is in relation to access speed, probably the beginning of the drive, but not always. If it is the only partition on the drive, changing the size would be trivial. You could even have a small swap file on the main drive so you still have swap available while you play with the testing. You could probably find a used but small fast scsi drive on ebay fairly cheap. I sometimes see 36 gig drives for $20 US because they are to small for the original users purposes.