![]() |
|||
How much SWAP i set if my server is having 8 GB RAM ( Main Memory )
By: rekha singh | 11 Mar 2010 11:57 am
How much maximum swap can Linux use. I know this formula ( SWAP=2 * RAM SIZE ) is used to calculate SWAP Space. But really is there limit that you can not increase SWAP more than 4 GB. What you will do if your server having 8 GB RAM, then can you suggest what will be the recommended RAM I have to select CommentsThere is no 4GB limit on swap...... You can have multiple swap files in use at the same time. When you only have a little memory (I am suggesting up to 8GB) I would use 1:1.5 memory to swap When you have lots of memory, 8GB or up, I would go 1:1 ratio swap to memory. This info doc indicates MINIMUMS
By: rekha singh | 11 Mar 2010
Not sure I agree with all that... of course, I've not run large RAM systems in production, only in stress testing, but honestly, if you are in a position where you NEED to run more than 4 GB of swap space, you should consider adding RAM or finding a new way (load balancing, cluster, etc). In test at least, even systems with 512GB or more, I've run memory stress up to 98% RAM utilization with no more than 4 or 8 GB of swap and even then only about 50% of the swap space was used during stress testing. Swap was more important (and the 2*RAM number was important) when systems had less than 1 GB RAM. Back when you were running on a server that maxed out at 512MB perhaps... Now a days, RAM is cheap. Anyway, You're right, you don't need 2* anymore (geez.. imagine what that's like on a 512GB system... heh...) but realistically, as I said, if you have 4GB of swap on a 256GB system and you're hitting swap at ALL, then you need to rethink your hardware strategy a bit...
By: rekha singh | 11 Mar 2010
I think it's a good idea to keep in mind the fact that the SWAP=2 * RAM SIZE rule has been around as long as I've worked with *NIX systems (which is since 1988) and probably much longer than that. At that time I worked What I find kind of humorous about the difference in result, though, is that both companies were recommending SWAP=2 * RAM. Which only goes to remind us that sysadmin is as much art as science. Bottom line, the amount of swap is related to the use, not to the amount of hardware you have on the machine. All you can do is set up the machine with something reasonable, start loading it and add swap if necessary. In the case of redhat, they seem to use a memory management system in which the OS grabs all the memory but will surrender it when needed. For that reason, I mondified our Nagios routines so they don't alarm on low
By: rekha singh | 11 Mar 2010
That's not so much Red Hat is it is Linux memory management in general. MemTotal: 4046472 kB FWIW, the Cached entry tells you how much of your ram is being used to simply cache recent data. That's what gets cleared out as real use increases. It doesn't, IIRC, include memory that's also cached in Swap. The SwapCached tells you how much of the data that's currently cached also resides in the swap partition.
By: rekha singh | 11 Mar 2010
|
