7

I have a computer with 8G RAM and a 128G SSD. I don't plan hibernating. What swap size would you recommend? Would you change any swappiness?

In the nearest future I'll compile programs (or even kernels), run some virtual machines (leaving at least 5G free for the system), maybe occasionally play some game.

10

You should be fine with just 2 or 4 Gb of swap size, or none at all (since you don't plan hibernating).

An often-quoted rule of thumb says that the swap partition should be twice the size of the RAM. This rule made sense on older systems to cope with the limited amount of RAM; nowadays your system, unless on heavy load, won't swap at all.

It mostly depends whether you're going to do a memory-intensive use of your machine; if this is the case, you might want to increase the amount of RAM instead.

Note that a SSD is subject to more wear and tear than a hard disk, and is limited by a number of rewrite cycles. This makes it not optimal to host a swap partition.

Edit: Also see this question: Linux, SSD and swap

  • 6
    A SSD is subject to wear, true. Still, you can write 1GB each day for over five years. So optimizing for swap usage is not that big of a deal. – k0pernikus Jul 30 '15 at 13:15
2

Assuming we are not rehashing Is swap an anachronism? conversations/debates, I would suggest you take a look at the archlinux wiki on the topic. As always it is a great resource for any distro and covers the basics as well as suggested performance tuning for ssd's.

The tldr; according the the arch wiki:

Swap space is generally recommended for users with less than 1 GB of RAM, but becomes more a matter of personal preference on systems with gratuitous amounts of physical RAM (though it is required for suspend-to-disk support).

1

I would recommend NOT creating a swap space. 8GB of RAM is more than enough memory, especially when using a light weight system such as GNU/Linux. My laptop has 4GB of RAM with no swap space and it has compiled it's fair share of kernels, as well as ran games with no decline in performance.

Swap spaces are more beneficial for those who do not have a lot of RAM.

  • 1
    Surely this is dependent on how one uses the system? – Kusalananda Sep 19 '17 at 16:19
1

It's fairly easy to have 8GB of RAM on a desktop, and old rules of thumb on swap partition size will give you a huge amount of virtual RAM, but it does depend on the software you are running.

So check what your computer is doing. There are graphical programs such as Task Manager and command-line programs such as free -h (I use that form of the command because it's easier for a human).

There are programs which struggle in 4GB of RAM. It isn't just the particular program, there is a lot of OS code that has to be there, and when you go to 8GB, you can get a little careless about what's running. If you don't need to swap, use the RAM.

I have noticed the 4GB struggle with Kerbal Space Program and the Firestorm viewer for Second Life. There are alternatives to Firestorm which don't need so much RAM. Same task, different demands, that's why you have to measure.

-1

There are many recommendations about the swap size i think.

One requirement i collected in the past is: if you plan to use oracle databases, the swap size needs to be twice the physical memory, or oracle cannot be installed.

Besides that, it totally depends on your needs. If you do lots of Graphical editing/ Photoshopping, then you will need lots of RAM, backed up by lots of swap Space.

For a normal user, a swap space in the size of the physical ram should be sufficient.

Have fun, Gerhard

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.