Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a very basic doubt. I am sorry if its a very stupid question, but I am confused.
We know that its a best practice to give 1.5 times of RAM as SWAP Space. Its okay when we have small RAM of 8 -10 GB we can give max of 15GB as Swap space. But if we have more 60 -100 GB RAM then also do we need to give 1.5 times of the RAM as Swap.
If I am not wrong Swapping of (page-in and Page-out) large data will slowdown the server a lot.
Kindly suggest how much swap should we give if RAM is very high.
We know that its a best practice to give 1.5 times of RAM as SWAP Space.
Quote:
Kindly suggest how much swap should we give if RAM is very high.
There is no correlation between the amount of ram in a Linux system and the proper amount of swap space.
The amount of swap space you need depends on how the system is used. Most people setting up ordinary Linux systems have no way to even make a decent estimate of how much swap space they ought to have, so "experts" have made up silly rules (such as your 1.5 times ram size) to give the illusion that it wasn't just a guessed number.
Quote:
we have more 60 -100 GB RAM
Why do you have so much ram? If you have so much ram just because ram is inexpensive and your systems workload doesn't need nearly that much ram, then I suggest a swap size of 2GB. Even with lots of excess ram, systems that have reasonable hard drive space ought to have some swap space. 2GB is a nice size for swap for any system that has plenty of ram for its intended use.
But if your system will be used in a way that really needs the amount of ram you have, it might need significantly more than 2GB of swap space. That really depends on details of the use that could be very hard for even an expert to predict. There may be no method better than try it and see. My 2GB suggestion was based on excess ram leading to trivial use of swap. If the most swap space your system is ever likely to use is under 100MB, 2GB is still a wise safety factor. If you expect some real use of swap space, you might start the swap size at 4GB and watch the use occasionally. If you ever see less than 2GB of swap space free, increase the swap size. Obviously, try it and see is unsound for a critical production server. Without knowing the intended use level, only guesses are possible.
you're correct, technically it depends on application need that how much it usage. but if you have sufficient RAM for it than you don't require to make swap 1.5 times of RAM. you can decrease it.
there are some kernel swappiness parameters which also affect page-in and page-out.
Sorry for the mistake "we have more 60 - 100 GB RAM" I wanted to say our servers have RAM 60GB and 100GB.
These are newly brought servers and as thumb rule we were suggested to go with 90GB of swap for 60GB servers. I was not sure do we really require that much swap space initially and as em31amit suggested we can also add swap if required in future.
I wanted to check is there any suggested swap space for setting up at the time of installation on the server with large RAMs.
Years ago, IBM did a major study of virtual memory systems and performance. They concluded that "... virtual memory systems worked better with large amounts of physical memory ..."
If the kernel needs to allocate memory to a process, and free memory is not available, the kernel will identify processes which are "swappable" and move some memory contents to swap space marking that memory free. Now it has free memory to allocate to the process that needs or asks for more memory. When a swapped process next enters the run queue, the kernel needs free memory ... and the steps get repeated.
Given so much physical memory, you most likely do not require any swap space. There are utilities that will let you see what is happening for sure. When I really care about accurate sizes and I have lots of physical memory, I make a swap file that is 10-20% larger than all of my largest processes at run time. This is typically 4-8 GBytes.
Keep us posted on your progress and mark the thread SOLVED when you think you have all the answers you need.
Given so much physical memory, you most likely do not require any swap space. There are utilities that will let you see what is happening for sure. When I really care about accurate sizes and I have lots of physical memory, I make a swap file that is 10-20% larger than all of my largest processes at run time. This is typically 4-8 GBytes.
Thanks Saint !!
Finally, we are going to have 8GB Swap and will be monitoring the RAM utilization.
Finally, we are going to have 8GB Swap and will be monitoring the RAM utilization.
I hope you meant monitoring the swap utilization.
If you have plenty of ram, you still may have very little free ram, because the cache tends to use up most of the ram that isn't otherwise needed.
Typical long running service processes tend to use some swap space even if there is significant excess physical ram. So some use of swap space is not any indication of significant "memory pressure".
If you find a few GB of that 8GB swap gets used, then depending on your application, that might indicate some memory pressure that might deserve some attention.
If you find 6GB or more of the 8GB swap gets used, then while you are figuring out whether or what else might deserve adjustment, you should increase the swap space to have more safety margin.
Still just guessing with no clue of your intended use of the systems, but my best guess is you will see less than 100MB of your 8GB swap used.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.