In years past, the recommended amount of swap space increased linearly with the amount of RAM in the system. But because the amount of memory in modern systems has increased into the hundreds of gigabytes, it is now recognized that the amount of swap space that a system needs is a function of the memory workload running on that system. However, given that swap space is usually designated at install time, and that it can be difficult to determine beforehand the memory workload of a system, we recommend determining system swap using the following table.
SimonRichter Yes that's the idea. Swappiness of 60 is probably too agressive on modern systems though, since that means you're starting to swap out when you still have several gigs of free memory.
There are a few different aspects to your question. How Linux uses swap even more simplified Once you have used up enough memory that there is not enough left for a smooth-running cache, Linux may decide to re-allocate some unused application memory from RAM to swap.
But how can swap speed up my system? Doesn't swapping slow things down? Once data is in swap, when does it come out again? I also like to keep 2GiB swap on my computers. If something goes bad - memory leaks, etc.
It's a safety net as well as a performance tool. This is because I use the netbook for a lot more that it was intended for and my programs frequently require more than 2GB of memory.
Since Linux behaves very poorly in out-of-memory situations, I prefer to have a large safety net. And I have plenty of disk space. I've got 2GB in there now, and internet sources suggest that 2GB is the actual maximum. Thus the need for these sorts of workarounds. I'd recommend first doing more analysis of what on that server is using up that 1TB and wanting more, and addressing that. Swapping is a symptom of a potential problem well, low memory rather than a cause and adjusting swappiness in that setting would be like re-arranging deck chairs on the titanic.
It's wise to have swap in case it's needed sometimes, but if you're typically seeing many gigabytes swapped on a server something isn't right. For a server with relatively even load, you'd be aiming for little or no swap actually being used. Show 4 more comments. Here it is:! No swap is in use. Eliah Kagan k 51 51 gold badges silver badges bronze badges. Scott Severance Scott Severance 13k 8 8 gold badges 47 47 silver badges 74 74 bronze badges.
You might want to modernize it a bit by changing MB to MiB in the outputs. I wrote a similar script without all the good safety tests you include. On my old notebook where swap was used heavily, it would take awhile to run - a minute or two, but didn't hurt anything.
Once in awhile it would fail because there wasn't enough free memory for it to run, but that didn't cause any additional problems. I had to reboot to clear things up when that happened. It had to do with what looked like a memory leak in Transmission since fixed, I believe and having only 2GiB ram.
If something has been moved to swap and it remains in swap, that's normally a good thing - it means the data is not actually being used, and it's freed up some of your RAM for other stuff, resulting in a potential boost in speed. What has lead you to believe that this data shouldn't be in swap and should be taking up more valuable RAM instead? Usually the kernel's pretty good at knowing what is unused, and which can safely remain in swap to free up RAM.
The evidence is in performance. For example, bringing up menus or switching programs can be slow due to swapping, as can Compos visoal effects. This slowness is cured by toggling the swap, thus demonstrating that at least in some situations the kernel's optimization algorithms are suboptimal.
I can't argue with repeated experience. I didn't had much time to look into this complete question and its answer but I Favorited it to read it when I get some free time. Sure, but that doesn't address the problem of what to do once memory is freed and stuff is still in swap despite there now being enough free memory. The kernel won't pull it out of swap until it's needed, which can cause major issues with system responsiveness. Consider when the system menu is all swapped out: it doesn't get swapped back in until you click the menu button, which means you suddenly have to wait a while for the menu to pop up.
That's why manually pulling it out of swap at an opportune time can improve system responsiveness. Your new swap partition is now online along with the previously existing swap partition. You can use the free or top commands to verify this.
If your disk setup uses LVM, changing swap space will be fairly easy. Again, this assumes that space is available in the volume group in which the current swap volume is located. By default, the installation procedures for Fedora Linux in an LVM environment create the swap partition as a logical volume.
This makes it easy because you can simply increase the size of the swap volume. First, verify that swap exists and is a logical volume using the lvs command list logical volume. You can see that the current swap size is 8GB. In this case, we want to add 2GB to this swap volume. First, stop existing swap. You may have to terminate running programs if swap space is in use. Now verify the new swap space is present with the list block devices command.
Again, a reboot is not required. You can also use the swapon -s command, or top , free , or any of several other commands to verify this. Note that the different commands display or require as input the device special file in different forms. This article was originally published in September and has been updated with additional information by the editor.
It used to be that swap space was something you did need to think about with some memory-intensive processes. Nowadays, with computers have a lot of RAM, and fast processors, it's of no great concern. You can see this by running some application that monitors your system and watch the swap usage under heavy load. It's hard to see a dent in swap. I see heavy swap usage even on systems with large amounts of RAM when doing nightly backups based on rsync.
Many other times the swap usage is minimal but still present. It depends in large part upon your environment whether you see heavy swap usage or not. My opinion - yes, I have a lot of those - is that from a technical standpoint swap was never intended to be a long-term substitute for having enough RAM.
It was intended to eliminate the possibility of a hard crash when RAM was used up. So it just became normal to run with lots of swap space. If you don't add swap soon, the server will crash.
You can't use "swapoff -a" since this command will move all swap data to RAM. The command will fail because RAM can't accommodate the all memory contents of swap. On this situation you can add a swap file or partition. You are correct; you can add swap space without turning off the existing swap space. Also, preallocating the swap file as you have makes the swap file a bit faster than allocating it when it is needed. The scenario I used is a bit more ideal than yours.
As with almost everything Linux there are many options for everything you might need to do. The one that works best for you is clearly the one you should use. I need to get your opinion about VPN and Linux relation. Definitely, that is not the case. When prompted to mount the file system, select Skip.
What is Swap Space? Adding Swap Space 5. Removing Swap Space 5.
0コメント