Physical RAM and SWAP Memory
Hi,
How can we find out as to at what point does SWAP Memory come to play its role? Or in other words, as we know, when RAM is being utilized and the the OS (Unix / Linux in our scenerio) needs more memory to run applications or commands then it makes use of the SWAP Memory. But when can we say that now SWAP is being used or what percentage of the Physical RAM is determined after which the system must use the SWAP Memory? Configuration Example: Physical RAM: 1 GB SWAP Partition: 2 GB OS: RHEL 5 (or any UNIX OS) Now, when can we say that SWAP would be utilized or upto what percentage of the available RAM no SWAP would be required? Also, what level of RAM and SWAP should we set as "Crtitical" in a production enviroment? For example, 90%? Also, do we always need this configuration: RAM Size * 2 = SWAP? |
you can say that swap would be used when you are requiring more than 1gb of active memory.
You don't need 2 times at all. That's a very very old rule of thumbs. Generally on a dedicated function server you should *NEVER* need swap, if you do, you are doing something wrong. Performance will degrade significantly if you are repeatedly swapping pages in and out, so the ideal should always be to never use it in the first place. And if you don't ever use it, you clearly don't need twice as much as physical memory. www.linuxatemyram.com |
Quote:
|
Quote:
Thanks for the insight! |
Quote:
|
Quote:
Unless you are short of disk space, you should have swap space set to significantly more than you ever expect to need. That way if you ever have an unexpectedly high memory load your system will just slow down a little rather than failing. Quote:
Quote:
In your example of 1GB ram and 2GB of swap, you should probably think of that as up to .5GB of swap for actual use and 1.5GB swap as reserve for rare unexpected incidents. If you notice more than .5GB swap in use, you don't have enough swap space (or depending on swap in rate, you may not have enough ram). Quote:
It depends on the mix of anonymous vs. file mapped memory use. No matter how much file mapped memory use you have, non of that use will ever go into the swap file. If your anonymous memory use gets to 3/4 or more of ram, you will almost certainly need swap space. But even at a lower level of anonymous memory use if the file mapped use is more active than some of the anonymous use, the kernel may be able to make the system faster by swapping out stale anonymous memory to allow more memory use by file mappings. There are also rare cases where an individual process requests far more anonymous memory than it actually uses, causing the system to need swap space to exist even though it never actually uses that swap space. Quote:
Depending of the services you are running the benefits may be trivial to moderate. That doesn't qualify as "need" but generally qualifies as a good idea. On the Linux servers where I work, the typical swap partition size is many GB. The typical amount of used swap space is 150MB. The typical swap in rate is zero. These are systems with 3GB to 12GB of ram, so the performance benefits of kicking out 150MB of stale anonymous memory are pretty small (but not zero). The big swap space is there because the memory loads are not directly managed. Different activities that each take most of ram typically run at different times, but could accidentally run at the same time. If that happens we want the system merely slower, not broken. |
All times are GMT -5. The time now is 10:35 PM. |