Jump to content

Do I need more than 2GB of Swap?

My Desktop Linux SATA SSD is set to 2GB Swap Partition. I built this back in Mid 2013 since I have 16GB of RAM. Recently I have been wondering if I should have or need more.

 

The most demanding stuff I do with my Rig is play Games. Sometimes I use GIMP but nothing major. From time to time there is playing around with Blender, but it is rare.

Link to comment
Share on other sites

Link to post
Share on other sites

linux will tell you how much swap you have remaining, if you dont run out of ram, its fine. if you use the swap all the time heavily consider upgrading to 32 instead of wearing out that poor ssd.

Link to comment
Share on other sites

Link to post
Share on other sites

I stopped using swap partitions quite a long time ago. Heck I started creating temporary partitions in RAM for unnecessary stuff I don't need to be kept across boot. This is on machines with both 16 and 32 GB of RAM. 

Link to comment
Share on other sites

Link to post
Share on other sites

34 minutes ago, whm1974 said:

My Desktop Linux SATA SSD is set to 2GB Swap Partition. I built this back in Mid 2013 since I have 16GB of RAM. Recently I have been wondering if I should have or need more.

 

The most demanding stuff I do with my Rig is play Games. Sometimes I use GIMP but nothing major. From time to time there is playing around with Blender, but it is rare.

Depends on your use case. I often hit my swap even though I have 64gb of ram.

Just keep an eye on your ram/swap usage and you will know if you even need it at all.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, RONOTHAN## said:

Swap is used when you run out of RAM. If you aren't running out of RAM in your system, you don't need a swap. 2GB should be fine.

Swap is also used for system suspend and hibernation.

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, 10leej said:

Swap is also used for system suspend and hibernation.

As I have two SSDs I am not going to use Hibernation.

Link to comment
Share on other sites

Link to post
Share on other sites

6 minutes ago, 10leej said:

Swap is also used for system suspend and hibernation.

You can suspend to ram.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

15 minutes ago, 10leej said:

True, but you can also suspend to disk

I did pay a pretty penny back 2013 for my 2 1 TB SDDs, I'm sure you can understand I why don't want to do that.

Link to comment
Share on other sites

Link to post
Share on other sites

I forgot it's a desktop, hibernation and sleep don't really matter in this case lol

 

Just leave some system monitor open in the background and check both the ram and swap usage once in a while, then you should be able to decide if you need it or not.

FX6300 @ 4.2GHz | Gigabyte GA-78LMT-USB3 R2 | Hyper 212x | 3x 8GB + 1x 4GB @ 1600MHz | Gigabyte 2060 Super | Corsair CX650M | LG 43UK6520PSA
ASUS X550LN | i5 4210u | 12GB
Lenovo N23 Yoga

Link to comment
Share on other sites

Link to post
Share on other sites

6 hours ago, whm1974 said:

I did pay a pretty penny back 2013 for my 2 1 TB SDDs, I'm sure you can understand I why don't want to do that.

suspend to disk is 1 write of the hundreds of thousands and better prevents data loss since disk is nonvolatile compared to system memory. So no I don't.

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, 10leej said:

suspend to disk is 1 write of the hundreds of thousands and better prevents data loss since disk is nonvolatile compared to system memory. So no I don't.

I want wear out the Cells Flash uses.

Link to comment
Share on other sites

Link to post
Share on other sites

11 hours ago, whm1974 said:

I want wear out the Cells Flash uses.

It's a 2013 ssd, so no matter what plan for a new one. However remmeber that linux does run checks on ssd's and will mount it read only when the flash cells finally give the kernel a bad report.

Link to comment
Share on other sites

Link to post
Share on other sites

Give this a read. Swap isn't just overflow, the kernel can use it as a sort of cache for better memory management. Like if a block of memory is likely going to be needed, but can't be freed because it's being used by an idle process, it will be sent to swap. If that block of memory ends up needing to be used, it will be safely over written because it's copied to swap. That's just an over simplification.

https://chrisdown.name/2018/01/02/in-defence-of-swap.html

 

Edit: And to answer your question, 2GB is plenty for your average person using an SSD. Maybe make that 1GB and turn down vm.swappiness if you have an HDD though.

lumpy chunks

 

Expand to help Bunny reach world domination

(\__/)
(='.'=) This is Bunny. Copy Bunny into your signature to
(")_(") help him on his way to world domination.

 -Rakshit Jain

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, LloydLynx said:

Give this a read. Swap isn't just overflow, the kernel can use it as a sort of cache for better memory management. Like if a block of memory is likely going to be needed, but can't be freed because it's being used by an idle process, it will be sent to swap. If that block of memory ends up needing to be used, it will be safely over written because it's copied to swap. That's just an over simplification.

https://chrisdown.name/2018/01/02/in-defence-of-swap.html

 

Edit: And to answer your question, 2GB is plenty for your average person using an SSD. Maybe make that 1GB and turn down vm.swappiness if you have an HDD though.

With my Laptop I set the Swap to 4GB due only having 4GB of RAM.

Link to comment
Share on other sites

Link to post
Share on other sites

Good comments here, especially one by @LloydLynx. As a rule of thumb, don't worry too much about swap (whether you have it or not). It doesn't make a lot of difference these days for most users. It never hurts to have swap, though. If you often leave idle processes running, you will get more data cached in the RAM by having swap. There is no one-size-fits-all answer, but it could be ~the size of RAM used by idle processes on your system, or if you need suspend-to-disk, the size needed for suspending.

 

As for wearing down SSD's: this is really not a problem and hasn't been for a while (a decade?). Only the very few first generation SSD could be worn out in a typical home/office use scenario, but these days even if one would trash away on the disk with constant small writes, it will probably be obsolete because of other reasons before it starts to fail because of too much writes. The cells are more durable and wear leveling is more intelligent than it used to be.

Edited by Wild Penquin
A few TYPOs / brainfarts
Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, Wild Penquin said:

Good comments here, especially one by @LloydLynx. As a rule of thumb, don't worry too much about swap (whether you have it or not). It doesn't make a lot of difference these days for most users. It never hurts to have swap, though. If you often leave idle processes running, you will get more data cached in the RAM by having swap. There is no one-size-fits-all answer, but it could be ~the size of RAM used by idle processes on your system, or if you need suspend-to-disk, the size needed for suspending.

 

As for wearing down SSD's: this is really not a problem and hasn't been for a while (a decade?). Only the very few first generation SSD could be worn out in a typical home/office use scenario, but these days even if one would trash away on the disk with constant small writes, it will probably be obsolete because of other reasons before it starts to fail because of too much writes. The cells are more durable and wear leveling is more intelligent than it used to be.

Thanks. Any benefit to increasing RAM from 16 to 32 as far as in not using Swap?

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, whm1974 said:

Thanks. Any benefit to increasing RAM from 16 to 32 as far as in not using Swap?

The reply is same as for the swap question: there is no one-size-fits-all answer.

 

It depends on what applications you run and how many of them at the same time. If you use regular office applications, a web browser and gaming, then no (as a rule of thumb). If you do video editing, CAD, run IDEs or have a home server in addition to all of the above... then the answer is maybe.

 

Look at your RAM usage in your worst case scenario you find likely. That should be enough to give an idea, if adding more RAM is worth it.

Edited by Wild Penquin
Link to comment
Share on other sites

Link to post
Share on other sites

I have 16GB of RAM and use 32GB of Swap because it doesn't slow anything down to have it I have disk space to spare and it means I can use up to 48GB of RAM and my system is still okay. 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×