James Bensley
2009-Jun-05 07:32 UTC
[CentOS] Swap priorities with swapon (Is my swap drive working?)
Hey Listee's I have a CentOS server with 2GB of ram and a swap drive of 4GB; swapon -a shows my swap drive as 4GB with only about 350 bytes in use (which is fine as my server idles with about 350-400MB ram usage so no swap should be in use. However my one and only swap drive had a priority of -1. I had read that the swap drive priority doesn't matter too much because I only have one swap drive so the kernel hasn't got to make a choice but also that after a certain kernel version (which is think was like 1.3.x?) it didn't even use the priority value and my kernel is newer (I have 2.6.18-128.1.6.e15). Basically I have read difference things from difference source on the old interwebwrok and seek clarification. In the confusion I set my swap drive priority from -1 to 1 because I thought that if the drive priority were a negative value it might not actually use the swap drive. Ultimately I can't tell because there currently isn't enough memory usage demand on the server. On a side note: I'm a reformed Windows admin and have seen the light and am moving each server one at a time over to Linux so I am used to poor memory management and needing massive page files. Realistically the swap drive shouldn't been in use but I am just worried then when this server goes live it will hit 2GB of ram usage and the swap won't kick in. Is there anyway I can check? Thanks for reading. Regards, James ;) -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GIT/MU/U dpu s: a--> C++>$ U+> L++> B-> P+> E?> W+++>$ N K W++ O M++>$ V- PS+++ PE++ Y+ PGP t 5 X+ R- tv+ b+> DI D+++ G+ e(+++++) h--(++) r++ z++ ------END GEEK CODE BLOCK------
RedShift
2009-Jun-05 09:15 UTC
[CentOS] Swap priorities with swapon (Is my swap drive working?)
James Bensley wrote:> Hey Listee's > > I have a CentOS server with 2GB of ram and a swap drive of 4GB; > > swapon -a shows my swap drive as 4GB with only about 350 bytes in use > (which is fine as my server idles with about 350-400MB ram usage so no > swap should be in use. However my one and only swap drive had a > priority of -1. I had read that the swap drive priority doesn't matter > too much because I only have one swap drive so the kernel hasn't got > to make a choice but also that after a certain kernel version (which > is think was like 1.3.x?) it didn't even use the priority value and my > kernel is newer (I have 2.6.18-128.1.6.e15). > > Basically I have read difference things from difference source on the > old interwebwrok and seek clarification. In the confusion I set my > swap drive priority from -1 to 1 because I thought that if the drive > priority were a negative value it might not actually use the swap > drive. Ultimately I can't tell because there currently isn't enough > memory usage demand on the server. > > On a side note: I'm a reformed Windows admin and have seen the light > and am moving each server one at a time over to Linux so I am used to > poor memory management and needing massive page files. Realistically > the swap drive shouldn't been in use but I am just worried then when > this server goes live it will hit 2GB of ram usage and the swap won't > kick in. Is there anyway I can check? >If your system starts to swap, it really needs more memory. Otherwise you're just fine. Swap is only a last resort. Don't worry about it. Glenn
Ralph Angenendt
2009-Jun-05 09:20 UTC
[CentOS] Swap priorities with swapon (Is my swap drive working?)
James Bensley wrote:> Basically I have read difference things from difference source on the > old interwebwrok and seek clarification. In the confusion I set my > swap drive priority from -1 to 1 because I thought that if the drive > priority were a negative value it might not actually use the swap > drive. Ultimately I can't tell because there currently isn't enough > memory usage demand on the server.If you only have one swap area (this sounds like it), you don't need to worry about priorities at all. Only when more than one swap area comes into play, then the kernel decides by priority which swap areas should be used over other ones (ie, have the swap on fast disks have a high priority and the swap on slower disks a lower priority). If you have two swap aread with the same priority, they will be used in a round-robin fashion. See man 2 swapon for an explanation.> On a side note: I'm a reformed Windows admin and have seen the light > and am moving each server one at a time over to Linux so I am used to > poor memory management and needing massive page files. Realistically > the swap drive shouldn't been in use but I am just worried then when > this server goes live it will hit 2GB of ram usage and the swap won't > kick in. Is there anyway I can check?It will kick in, regardless of priority. But probably someone will come up with a small c program which eats all available memory :) Regards, Ralph -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available URL: <http://lists.centos.org/pipermail/centos/attachments/20090605/9aa88d1d/attachment-0001.sig>
James Bensley
2009-Jun-05 12:15 UTC
[CentOS] Swap priorities with swapon (Is my swap drive working?)
> It will kick in, regardless of priority. > > But probably someone will come up with a small c program which eats all > available memory :) > > Regards, > > RalphI would be interested in such a program if anyone has one or a mega bash script that can achive the same?> If your system starts to swap, it really needs more memory. Otherwise you're just fine. Swap is only a last resort. > > Don't worry about it. > > GlennAgreed however I am also setting up some virtual machines so physical RAM expansion won't be an option but extra swap space will be. Obviously the server won't be running constantly in the swap drive its is simply a reserve for those "just in case" moments, obviously I plan on designing the system to have plenty of physical RAM with swap as a back up but we must be prepared so in such cases I need to test it some how? Thanks for the input guys its greatly appreciated; now to find a memory chewing, number crunching, infinite loop beast! James ;) -----BEGIN GEEK CODE BLOCK----- Version: 3.1 GIT/MU/U dpu s: a--> C++>$ U+> L++> B-> P+> E?> W+++>$ N K W++ O M++>$ V- PS+++ PE++ Y+ PGP t 5 X+ R- tv+ b+> DI D+++ G+ e(+++++) h--(++) r++ z++ ------END GEEK CODE BLOCK------