Can you have too much swap?I have 16GB RAM. Do I need 32GB swap?Ubuntu is quickly running out of RAM, and my computer is starting to freeze. What command will solve this?Google Chrome will take up my memory to the point where it causes my computer to freeze to a near halt. What can I do to prevent this?Is there a maximum size at which a swap file can function?How do I check system health?How to decide on Swap sizeCan you use an SD card for swap in Ubuntu 12.04?Swap space too littleSwap partition showing unknown. Can I format it to ntfs or ext4 for keeping my files or this will cause problems to system? I don't need swap spaceRoot Partition using too much spaceIs swap area required? Can we install Ubuntu without a swap area?swap partition vs swap fileCan you move the swap FILE in 17.04 to an encrypted home directory or get rid of it completely?Resize Linux swap /Solaris and give main memory more space?Will multiple swap space's be effective?

Do I need to be arrogant to get ahead?

How Could an Airship Be Repaired Mid-Flight

Why does Bach not break the rules here?

Welcoming 2019 Pi day: How to draw the letter π?

How to create the Curved texte?

How to read the value of this capacitor?

Who is flying the vertibirds?

A link redirect to http instead of https: how critical is it?

Is a party consisting of only a bard, a cleric, and a warlock functional long-term?

Life insurance that covers only simultaneous/dual deaths

Look at your watch and tell me what time is it. vs Look at your watch and tell me what time it is

Why one should not leave fingerprints on bulbs and plugs?

How to write cleanly even if my character uses expletive language?

Use of undefined constant bloginfo

Is it normal that my co-workers at a fitness company criticize my food choices?

How to terminate ping <dest> &

Can a druid choose the size of its wild shape beast?

Unexpected result from ArcLength

How difficult is it to simply disable/disengage the MCAS on Boeing 737 Max 8 & 9 Aircraft?

Do these spellcasting foci from Xanathar's Guide to Everything have to be held in a hand?

How can you use ICE tables to solve multiple coupled equilibria?

What exactly is this small puffer fish doing and how did it manage to accomplish such a feat?

Python if-else code style for reduced code for rounding floats

If curse and magic is two sides of the same coin, why the former is forbidden?



Can you have too much swap?


I have 16GB RAM. Do I need 32GB swap?Ubuntu is quickly running out of RAM, and my computer is starting to freeze. What command will solve this?Google Chrome will take up my memory to the point where it causes my computer to freeze to a near halt. What can I do to prevent this?Is there a maximum size at which a swap file can function?How do I check system health?How to decide on Swap sizeCan you use an SD card for swap in Ubuntu 12.04?Swap space too littleSwap partition showing unknown. Can I format it to ntfs or ext4 for keeping my files or this will cause problems to system? I don't need swap spaceRoot Partition using too much spaceIs swap area required? Can we install Ubuntu without a swap area?swap partition vs swap fileCan you move the swap FILE in 17.04 to an encrypted home directory or get rid of it completely?Resize Linux swap /Solaris and give main memory more space?Will multiple swap space's be effective?













14















I was just wondering if you can have a swap partition that is too big. If yes, when is a swap partition too big? What are the downsides/ill-effects of having a swap partition that's too big (even if I have plenty of disk space)?



If no, what are the benefits of having more than the recommended swap space?










share|improve this question



















  • 5





    The apparent downside is that you waste disk space. OTOH: if you have "too much" swap (say 30GB on a 4GB system), then misbehaving apps will get an out-of-memory far later and that will slow down your system. Orderly behaving apps (without memory leaks) will simply not use it. (I admit, this is a simplified view.)

    – PerlDuck
    Mar 18 '18 at 15:45











  • I agree with @PerlDuck - "too much swap" just uses disc space. You system will be slow if it starts using swap , in that case either run less apps, lighter weight apps, or get more RAM

    – Panther
    Mar 18 '18 at 15:49











  • I know, so if you have enough RAM, other then using too much diskspace are there any downsides ? Except offcourse "misbehaving" apps as PerlDuck said.

    – An0n
    Mar 18 '18 at 15:50







  • 1





    VTD All the questions in the Edit justifies changing close reason from duplicate to off topic as too broad. OP is obviously miffed but meta or a chat room is a better place for discussion.

    – WinEunuuchs2Unix
    Mar 24 '18 at 2:35







  • 3





    In case people are unsure of what @PerlDuck (and Panther) are talking about, note that even if you had effectively unlimited disk space, having more space to swap to will make processes that ought to just be terminated, and which otherwise would be swiftly terminated automatically, slow the system down to a crawl for a long time first. PerlDuck's comment would, I think, also work as an answer. If we end up reopening this question, perhaps an answer can be added about the drawbacks of having far more swap than necessary. Because there are drawbacks.

    – Eliah Kagan
    Mar 26 '18 at 13:04
















14















I was just wondering if you can have a swap partition that is too big. If yes, when is a swap partition too big? What are the downsides/ill-effects of having a swap partition that's too big (even if I have plenty of disk space)?



If no, what are the benefits of having more than the recommended swap space?










share|improve this question



















  • 5





    The apparent downside is that you waste disk space. OTOH: if you have "too much" swap (say 30GB on a 4GB system), then misbehaving apps will get an out-of-memory far later and that will slow down your system. Orderly behaving apps (without memory leaks) will simply not use it. (I admit, this is a simplified view.)

    – PerlDuck
    Mar 18 '18 at 15:45











  • I agree with @PerlDuck - "too much swap" just uses disc space. You system will be slow if it starts using swap , in that case either run less apps, lighter weight apps, or get more RAM

    – Panther
    Mar 18 '18 at 15:49











  • I know, so if you have enough RAM, other then using too much diskspace are there any downsides ? Except offcourse "misbehaving" apps as PerlDuck said.

    – An0n
    Mar 18 '18 at 15:50







  • 1





    VTD All the questions in the Edit justifies changing close reason from duplicate to off topic as too broad. OP is obviously miffed but meta or a chat room is a better place for discussion.

    – WinEunuuchs2Unix
    Mar 24 '18 at 2:35







  • 3





    In case people are unsure of what @PerlDuck (and Panther) are talking about, note that even if you had effectively unlimited disk space, having more space to swap to will make processes that ought to just be terminated, and which otherwise would be swiftly terminated automatically, slow the system down to a crawl for a long time first. PerlDuck's comment would, I think, also work as an answer. If we end up reopening this question, perhaps an answer can be added about the drawbacks of having far more swap than necessary. Because there are drawbacks.

    – Eliah Kagan
    Mar 26 '18 at 13:04














14












14








14


1






I was just wondering if you can have a swap partition that is too big. If yes, when is a swap partition too big? What are the downsides/ill-effects of having a swap partition that's too big (even if I have plenty of disk space)?



If no, what are the benefits of having more than the recommended swap space?










share|improve this question
















I was just wondering if you can have a swap partition that is too big. If yes, when is a swap partition too big? What are the downsides/ill-effects of having a swap partition that's too big (even if I have plenty of disk space)?



If no, what are the benefits of having more than the recommended swap space?







16.04 partitioning ram swap disk-usage






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 '18 at 12:30









Zanna

51k13138242




51k13138242










asked Mar 18 '18 at 15:39









An0nAn0n

919120




919120







  • 5





    The apparent downside is that you waste disk space. OTOH: if you have "too much" swap (say 30GB on a 4GB system), then misbehaving apps will get an out-of-memory far later and that will slow down your system. Orderly behaving apps (without memory leaks) will simply not use it. (I admit, this is a simplified view.)

    – PerlDuck
    Mar 18 '18 at 15:45











  • I agree with @PerlDuck - "too much swap" just uses disc space. You system will be slow if it starts using swap , in that case either run less apps, lighter weight apps, or get more RAM

    – Panther
    Mar 18 '18 at 15:49











  • I know, so if you have enough RAM, other then using too much diskspace are there any downsides ? Except offcourse "misbehaving" apps as PerlDuck said.

    – An0n
    Mar 18 '18 at 15:50







  • 1





    VTD All the questions in the Edit justifies changing close reason from duplicate to off topic as too broad. OP is obviously miffed but meta or a chat room is a better place for discussion.

    – WinEunuuchs2Unix
    Mar 24 '18 at 2:35







  • 3





    In case people are unsure of what @PerlDuck (and Panther) are talking about, note that even if you had effectively unlimited disk space, having more space to swap to will make processes that ought to just be terminated, and which otherwise would be swiftly terminated automatically, slow the system down to a crawl for a long time first. PerlDuck's comment would, I think, also work as an answer. If we end up reopening this question, perhaps an answer can be added about the drawbacks of having far more swap than necessary. Because there are drawbacks.

    – Eliah Kagan
    Mar 26 '18 at 13:04













  • 5





    The apparent downside is that you waste disk space. OTOH: if you have "too much" swap (say 30GB on a 4GB system), then misbehaving apps will get an out-of-memory far later and that will slow down your system. Orderly behaving apps (without memory leaks) will simply not use it. (I admit, this is a simplified view.)

    – PerlDuck
    Mar 18 '18 at 15:45











  • I agree with @PerlDuck - "too much swap" just uses disc space. You system will be slow if it starts using swap , in that case either run less apps, lighter weight apps, or get more RAM

    – Panther
    Mar 18 '18 at 15:49











  • I know, so if you have enough RAM, other then using too much diskspace are there any downsides ? Except offcourse "misbehaving" apps as PerlDuck said.

    – An0n
    Mar 18 '18 at 15:50







  • 1





    VTD All the questions in the Edit justifies changing close reason from duplicate to off topic as too broad. OP is obviously miffed but meta or a chat room is a better place for discussion.

    – WinEunuuchs2Unix
    Mar 24 '18 at 2:35







  • 3





    In case people are unsure of what @PerlDuck (and Panther) are talking about, note that even if you had effectively unlimited disk space, having more space to swap to will make processes that ought to just be terminated, and which otherwise would be swiftly terminated automatically, slow the system down to a crawl for a long time first. PerlDuck's comment would, I think, also work as an answer. If we end up reopening this question, perhaps an answer can be added about the drawbacks of having far more swap than necessary. Because there are drawbacks.

    – Eliah Kagan
    Mar 26 '18 at 13:04








5




5





The apparent downside is that you waste disk space. OTOH: if you have "too much" swap (say 30GB on a 4GB system), then misbehaving apps will get an out-of-memory far later and that will slow down your system. Orderly behaving apps (without memory leaks) will simply not use it. (I admit, this is a simplified view.)

– PerlDuck
Mar 18 '18 at 15:45





The apparent downside is that you waste disk space. OTOH: if you have "too much" swap (say 30GB on a 4GB system), then misbehaving apps will get an out-of-memory far later and that will slow down your system. Orderly behaving apps (without memory leaks) will simply not use it. (I admit, this is a simplified view.)

– PerlDuck
Mar 18 '18 at 15:45













I agree with @PerlDuck - "too much swap" just uses disc space. You system will be slow if it starts using swap , in that case either run less apps, lighter weight apps, or get more RAM

– Panther
Mar 18 '18 at 15:49





I agree with @PerlDuck - "too much swap" just uses disc space. You system will be slow if it starts using swap , in that case either run less apps, lighter weight apps, or get more RAM

– Panther
Mar 18 '18 at 15:49













I know, so if you have enough RAM, other then using too much diskspace are there any downsides ? Except offcourse "misbehaving" apps as PerlDuck said.

– An0n
Mar 18 '18 at 15:50






I know, so if you have enough RAM, other then using too much diskspace are there any downsides ? Except offcourse "misbehaving" apps as PerlDuck said.

– An0n
Mar 18 '18 at 15:50





1




1





VTD All the questions in the Edit justifies changing close reason from duplicate to off topic as too broad. OP is obviously miffed but meta or a chat room is a better place for discussion.

– WinEunuuchs2Unix
Mar 24 '18 at 2:35






VTD All the questions in the Edit justifies changing close reason from duplicate to off topic as too broad. OP is obviously miffed but meta or a chat room is a better place for discussion.

– WinEunuuchs2Unix
Mar 24 '18 at 2:35





3




3





In case people are unsure of what @PerlDuck (and Panther) are talking about, note that even if you had effectively unlimited disk space, having more space to swap to will make processes that ought to just be terminated, and which otherwise would be swiftly terminated automatically, slow the system down to a crawl for a long time first. PerlDuck's comment would, I think, also work as an answer. If we end up reopening this question, perhaps an answer can be added about the drawbacks of having far more swap than necessary. Because there are drawbacks.

– Eliah Kagan
Mar 26 '18 at 13:04






In case people are unsure of what @PerlDuck (and Panther) are talking about, note that even if you had effectively unlimited disk space, having more space to swap to will make processes that ought to just be terminated, and which otherwise would be swiftly terminated automatically, slow the system down to a crawl for a long time first. PerlDuck's comment would, I think, also work as an answer. If we end up reopening this question, perhaps an answer can be added about the drawbacks of having far more swap than necessary. Because there are drawbacks.

– Eliah Kagan
Mar 26 '18 at 13:04











6 Answers
6






active

oldest

votes


















7














No



At first glance you cannot have too much swap because you can see swap
as a way to increase RAM. Actually it doesn't increase RAM, it just
pretends to: If you have 8 GB of real RAM and a swap space of, say, 24
GB configured, then your programs can allocate and use up to 8+24=32 GB
of memory which sounds good at first.



But



If you run applications that either have memory leaks or aren't really
made for running with 8 GB of memory (think of video editing, for
example), then these applications will start to use that swap space,
and swap is slow. The more swap space is actively in use by these
applications, the more the system is busy with just moving memory around
to and from the disk. This will drastically slow down the overall system's
responsiveness and lead to a bad user experience.



Eventually -- when swap space is exhausted -- some applications
will face an out-of-memory situation and be killed by the kernel's
OOM_Killer.



From wiki:




The typical OOM case in modern computers happens when the operating
system is unable to create any more virtual memory, because all of
its potential backing devices have been filled.




Conclusion



Hence, one drawback of having too much swap space is: the more you
have, the later this OOM situation occurs and the longer you will have
to suffer from a lagging and unresponsive system.



Another apparent downside of course is wasting disk space but that might
not be so important nowadays.






share|improve this answer























  • +1 for the consideration of the edge case. Personally, I'm not a big swap fan as hibernation is for bears and my systems are kept far too busy for that. ;-) Cheers.

    – Elder Geek
    Apr 8 '18 at 16:05











  • @ElderGeek LOL. Actually Eliah Kagan made me turn my simple comment into an answer. He convinced me that the aforementioned downside of having too much swap is a crucial thing and might be important to others. I'm with you and have little swap configured (2GB with 8GB RAM) and it almost never gets touched.

    – PerlDuck
    Apr 8 '18 at 16:23











  • I have had similar results with similar settings, I wish the 2x swap rumor would finally die.

    – Elder Geek
    Apr 10 '18 at 20:08


















5














There’s no direct drawback to large swap space. With the way it is managed by the kernel an increase of the amount of swap space above what is sufficient has no or a negligible impact on performance.



The only downside of “too much” swap space is that you can’t use that space for storage.






share|improve this answer




















  • 1





    @An0n: I think it would be a pretty big downside to allocate all the ~6 TB currently connected to my machine as swap space. Where would I put all my music…?

    – David Foerster
    Mar 19 '18 at 22:25






  • 2





    @An0n: What good is a computer if all it can do is boot and then not store any useful data? That sounds more like an expensive space heater.

    – David Foerster
    Mar 19 '18 at 22:30







  • 1





    @An0n: Sure, I assumed as much but you're missing the point. I think we can agree that to be useful a computer must be able to reach a usable system state (incl. being able to boot) and have access to storage that the user can use for her personal data. That requires that it be not occupied by swap space.

    – David Foerster
    Mar 19 '18 at 22:40







  • 2





    Of course it's relative. Just like "too much" is relative. If I have a bootable system and I allocate all my free space as swap space then it's no longer useful to me because of the lack of free space until I change its system configuration in a way that ends in more free space. In that sense the swap space would be "too much" during that time renders the system useless during that time. Anyway, I'm not here to argue semantics of words with you.

    – David Foerster
    Mar 19 '18 at 23:26






  • 1





    @An0n To underline the point here, swap space is space you can't use for anything else. Disk storage space costs money. If your disk space is limited (mine is only 32GB), you want to keep as much of it as possible free to install programs and write files with your stuff in them, like music. People generally try to keep swap to a minimum for that reason, and no other reason. Swap is something the system might need to keep running efficiently, that is otherwise of no value to the user. In general, we want our system to use only the necessary resources, and leave us plenty to play with.

    – Zanna
    Mar 24 '18 at 15:48



















4














You won't feel any other downsides other than less space on your disk, I think that nowadays the conception of 2x the amount of ram is outdated in the majority of systems. I usually recommend to use the same size of your ram for swap memory in laptops though in order to give you the opportunity to hibernate your pc without losing any data due to the volatile nature of RAM.



The only cases where I would consider using more than 1x the size of RAM for the swap partition is when you think you are going to upgrade your RAM size in a short time. Or if you plan to use a system where you will store in a sort of cache the amount of memory used by programs not used at the very same moment.



Hope my point was clear enough, and I repeat I don't think you will experience any problem for having too much swap memory.



Have a nice day!






share|improve this answer




















  • 2





    I do not use swap at all if RAM > 2-4 Gb on a single user desktop.

    – Panther
    Mar 18 '18 at 19:00






  • 1





    @Panther Why not ? And its not about how or when you use it. Its about the size and the usage.

    – An0n
    Mar 19 '18 at 23:01






  • 2





    Have you considered the impact of memory leaks?

    – Elder Geek
    Apr 8 '18 at 16:13











  • @ElderGeek Hi, no i did not consider it. I like your answer, i didn't know about memory leaks problem!

    – zurg
    Apr 10 '18 at 17:02


















2














How much SWAP does hibernation really need?



It's a misconception that you need RAM x 2 for SWAP size when you use hibernation. The swap size needs to be the size of used RAM not Installed RAM. Generally swap size needs to be 2/5th of installed RAM. To find out the bare-minimum amount of RAM needed for use:



$ cat /sys/power/image_size
3153907712


On this 8 GB RAM machine 3 GB minimum is needed to hibernate.



You can tweak the values in image_size for a smaller swap size with risk of failure. You can tweak it for a larger swap size and possibly speeding up the hibernation speed.



Reference: https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate




16 MB RAM in 1995, different rules for 16 GB RAM in 2018



In the days when you had 16 MB Ram, x 2 for 32 MB swap on your 720 MB hard drive made sense. A little RAM and HDD history in this 1995 Washington Post article.



23 years later some technical articles from that 1995 (although I didn't find any) might be found to mislead new users. I did however find a 2007 article recommending SWAP = RAM x 2.



Back in 1995 32 MB Swap out of 760 MB HDD was 4% of HDD. Indeed the swap partition may have been used a lot in 1995. Today in 2018, 16 GB RAM x 2 for 32 GB SWAP on your 256 GB SSD doesn't make the same sense as it is taking 13% of SSD. Today my 8 GB SWAP partition isn't being used at all unless I force it to fill it up when testing OOM-Killer: Google Chrome will take up my memory to the point where it causes my computer to freeze to a near halt. What can I do to prevent this?.






share|improve this answer

























  • +1 for pointing out the misconception of the often touted 2x rule which is total bunk.

    – Elder Geek
    Apr 8 '18 at 16:09











  • @ElderGeek Thank you. I added a history section on when 16 MB RAM times 2 for 32 MB SWAP may have made sense.

    – WinEunuuchs2Unix
    Apr 8 '18 at 17:22











  • Another thing to consider is SSD versus HDD. Do we want plenty of read/writes on SSD bringing it quicker to failure in that part of the SSD (or is this a myth)? On my system 32GB ram I used 2GB of velociraptor Drive for SWAP but with no intention for hibernation, still not sure if this is ok, possibly I could have had no swap??? But if I was hibernating maybe 4GB would be enough, but chances are I would be using 20GB of browser, and then 4GB would not be enough???

    – NZ Dev
    Jan 29 at 3:03











  • @NZDev I have my swap on SSD but it is seldom used. Last time I checked it was still 100% life left after 1 year of use. To see percentage of life left: askubuntu.com/questions/1038701/how-do-i-check-system-health/…

    – WinEunuuchs2Unix
    Jan 29 at 12:46


















1














What is SWAP:



Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.



Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.



Swap should equal 2x physical RAM.




Advantages:



Provides overflow space when your memory fills up completely
Can move rarely-needed items away from your high-speed memory
Allows you to hibernate



Disadvantages:



Takes up space on your hard drive as SWAP partitions do not resize dynamically
Can increase wear and tear to your hard drive
Does not necessarily improve performance (see below)




When SWAP Partitions "Don’t Help" as in "not worthy comparing to extra storage" :



If your Harddrive has only 5400 RPM and you have little RAM lets say > 2GB.
Why ? Because the system constantly wanted to access the SWAP partition, it will eventually become very slow. Even though you now have space in the memory, everything in the SWAP partition need to be moved back over. Because the system will go slow, allot stays in the SWAP partition. This can only be fixed with a reboot. Which will take a while anyway because the system need to remove everything from the SWAP partition before shutting down.




**Conclussion: **



If you would like to be able to hibernate your computer, then you should have a SWAP partition. The size of this partition should be the size of your installed memory, plus an additional 10-25% to leave room for any items that were already moved over into the SWAP partition.



If you just want a small performance boost (and you have at least a 7200rpm hard drive), then you can add a SWAP partition if you want, but it’s not needed unless you have less than 4GB of installed memory. The size of this can be whatever you’d like. However I recommend 2x the RAM as a pinpoint. IF you have enoug storage space.



If you have a 5400rpm hard drive, then you shouldn’t create a SWAP partition simply because the bottleneck will make your computer worse off. However, if you absolutely want to have SWAP, then you can still create a partition using the same sizing guidelines outlined above – but change the swappiness value to something much lower.





My OPINION:



However in any case if you use Ubuntu as your Main OS for daily use I recommend 2x the size of the RAM. Because you don't install Ubuntu just because you have a old computer. But because you want to use the system as your Main OS.



Rather buy some extra hardware if needed instead of adjusting the system partitions to keep it running.
If you buy a game you also make sure your system is "up to date" instead of adjusting the settings to make it "Playable".



You can better have some extra space, SWAP, speed, power instead of having too short or need to resize everything later on. Because you need SWAP or space, bought RAM? Or need to buy ram fast because one memory slot or stick broke.






share|improve this answer























  • Re: your Conclusion It just does not make sense, or another way to put it is where do we draw the line. eg RAM 8GB plus 16GB swap: What if I use the 8GB of RAM and 9GB of swap, then there is still not enough room to hibernate. So what gives? In other words no matter what size you make it, you can still use it all and more. So why is Swap file not given 2 dedicated spaces 1 as Virtual memory and the other as hibernation space which would be the sum or the other 2. It just does not stack up for me and no one has ever answered this question.

    – NZ Dev
    Jan 29 at 3:07



















0














There is an overhead, indeed, but is very small; for every on-disk "page" there's a reference counter, and there's a couple of structs associated with every swap area; this is in kernel memory, so can't be paged. It's between 2 and 16 MB every 4 GB, depending on the architecture. The rest is fairly dynamic, thus dependant on usage.



So you can have plenty, but keep in mind the paged address space itself imposes some overhead on the RAM, and on top of that there's some tracking going on for swapped pages, so it doesn't scale very far; even if imposing quite some overhead, filesystems are far more efficient than the swap areas when it comes to handling larger areas as the vfs can offload structural information to disk (normally at least page tables can't be swapped, because of hardware limitations, and the vmm is likely using non-swappable memory for all it's bookkeeping).



I can't think of any other downside, OTOH having too little swap can cause fragmentation when swapping pages, which means more seeking. When having a lot, after certain point there will be no improvements either.



Swapping is generally a last resource (hibernation aside), so you'll probably not benefit from having more swap space than RAM, specially if you have over 4GB of RAM, and sometimes even as big as RAM is too much (think 64 GB).






share|improve this answer

























  • Sorry, your last statement/sentence is confusing, otherwise a good add-on to the above.

    – NZ Dev
    Jan 29 at 3:22











  • @NZDev is it better now?

    – Ismael Luceno
    19 mins ago










Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1017021%2fcan-you-have-too-much-swap%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























6 Answers
6






active

oldest

votes








6 Answers
6






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














No



At first glance you cannot have too much swap because you can see swap
as a way to increase RAM. Actually it doesn't increase RAM, it just
pretends to: If you have 8 GB of real RAM and a swap space of, say, 24
GB configured, then your programs can allocate and use up to 8+24=32 GB
of memory which sounds good at first.



But



If you run applications that either have memory leaks or aren't really
made for running with 8 GB of memory (think of video editing, for
example), then these applications will start to use that swap space,
and swap is slow. The more swap space is actively in use by these
applications, the more the system is busy with just moving memory around
to and from the disk. This will drastically slow down the overall system's
responsiveness and lead to a bad user experience.



Eventually -- when swap space is exhausted -- some applications
will face an out-of-memory situation and be killed by the kernel's
OOM_Killer.



From wiki:




The typical OOM case in modern computers happens when the operating
system is unable to create any more virtual memory, because all of
its potential backing devices have been filled.




Conclusion



Hence, one drawback of having too much swap space is: the more you
have, the later this OOM situation occurs and the longer you will have
to suffer from a lagging and unresponsive system.



Another apparent downside of course is wasting disk space but that might
not be so important nowadays.






share|improve this answer























  • +1 for the consideration of the edge case. Personally, I'm not a big swap fan as hibernation is for bears and my systems are kept far too busy for that. ;-) Cheers.

    – Elder Geek
    Apr 8 '18 at 16:05











  • @ElderGeek LOL. Actually Eliah Kagan made me turn my simple comment into an answer. He convinced me that the aforementioned downside of having too much swap is a crucial thing and might be important to others. I'm with you and have little swap configured (2GB with 8GB RAM) and it almost never gets touched.

    – PerlDuck
    Apr 8 '18 at 16:23











  • I have had similar results with similar settings, I wish the 2x swap rumor would finally die.

    – Elder Geek
    Apr 10 '18 at 20:08















7














No



At first glance you cannot have too much swap because you can see swap
as a way to increase RAM. Actually it doesn't increase RAM, it just
pretends to: If you have 8 GB of real RAM and a swap space of, say, 24
GB configured, then your programs can allocate and use up to 8+24=32 GB
of memory which sounds good at first.



But



If you run applications that either have memory leaks or aren't really
made for running with 8 GB of memory (think of video editing, for
example), then these applications will start to use that swap space,
and swap is slow. The more swap space is actively in use by these
applications, the more the system is busy with just moving memory around
to and from the disk. This will drastically slow down the overall system's
responsiveness and lead to a bad user experience.



Eventually -- when swap space is exhausted -- some applications
will face an out-of-memory situation and be killed by the kernel's
OOM_Killer.



From wiki:




The typical OOM case in modern computers happens when the operating
system is unable to create any more virtual memory, because all of
its potential backing devices have been filled.




Conclusion



Hence, one drawback of having too much swap space is: the more you
have, the later this OOM situation occurs and the longer you will have
to suffer from a lagging and unresponsive system.



Another apparent downside of course is wasting disk space but that might
not be so important nowadays.






share|improve this answer























  • +1 for the consideration of the edge case. Personally, I'm not a big swap fan as hibernation is for bears and my systems are kept far too busy for that. ;-) Cheers.

    – Elder Geek
    Apr 8 '18 at 16:05











  • @ElderGeek LOL. Actually Eliah Kagan made me turn my simple comment into an answer. He convinced me that the aforementioned downside of having too much swap is a crucial thing and might be important to others. I'm with you and have little swap configured (2GB with 8GB RAM) and it almost never gets touched.

    – PerlDuck
    Apr 8 '18 at 16:23











  • I have had similar results with similar settings, I wish the 2x swap rumor would finally die.

    – Elder Geek
    Apr 10 '18 at 20:08













7












7








7







No



At first glance you cannot have too much swap because you can see swap
as a way to increase RAM. Actually it doesn't increase RAM, it just
pretends to: If you have 8 GB of real RAM and a swap space of, say, 24
GB configured, then your programs can allocate and use up to 8+24=32 GB
of memory which sounds good at first.



But



If you run applications that either have memory leaks or aren't really
made for running with 8 GB of memory (think of video editing, for
example), then these applications will start to use that swap space,
and swap is slow. The more swap space is actively in use by these
applications, the more the system is busy with just moving memory around
to and from the disk. This will drastically slow down the overall system's
responsiveness and lead to a bad user experience.



Eventually -- when swap space is exhausted -- some applications
will face an out-of-memory situation and be killed by the kernel's
OOM_Killer.



From wiki:




The typical OOM case in modern computers happens when the operating
system is unable to create any more virtual memory, because all of
its potential backing devices have been filled.




Conclusion



Hence, one drawback of having too much swap space is: the more you
have, the later this OOM situation occurs and the longer you will have
to suffer from a lagging and unresponsive system.



Another apparent downside of course is wasting disk space but that might
not be so important nowadays.






share|improve this answer













No



At first glance you cannot have too much swap because you can see swap
as a way to increase RAM. Actually it doesn't increase RAM, it just
pretends to: If you have 8 GB of real RAM and a swap space of, say, 24
GB configured, then your programs can allocate and use up to 8+24=32 GB
of memory which sounds good at first.



But



If you run applications that either have memory leaks or aren't really
made for running with 8 GB of memory (think of video editing, for
example), then these applications will start to use that swap space,
and swap is slow. The more swap space is actively in use by these
applications, the more the system is busy with just moving memory around
to and from the disk. This will drastically slow down the overall system's
responsiveness and lead to a bad user experience.



Eventually -- when swap space is exhausted -- some applications
will face an out-of-memory situation and be killed by the kernel's
OOM_Killer.



From wiki:




The typical OOM case in modern computers happens when the operating
system is unable to create any more virtual memory, because all of
its potential backing devices have been filled.




Conclusion



Hence, one drawback of having too much swap space is: the more you
have, the later this OOM situation occurs and the longer you will have
to suffer from a lagging and unresponsive system.



Another apparent downside of course is wasting disk space but that might
not be so important nowadays.







share|improve this answer












share|improve this answer



share|improve this answer










answered Apr 1 '18 at 14:46









PerlDuckPerlDuck

7,16611536




7,16611536












  • +1 for the consideration of the edge case. Personally, I'm not a big swap fan as hibernation is for bears and my systems are kept far too busy for that. ;-) Cheers.

    – Elder Geek
    Apr 8 '18 at 16:05











  • @ElderGeek LOL. Actually Eliah Kagan made me turn my simple comment into an answer. He convinced me that the aforementioned downside of having too much swap is a crucial thing and might be important to others. I'm with you and have little swap configured (2GB with 8GB RAM) and it almost never gets touched.

    – PerlDuck
    Apr 8 '18 at 16:23











  • I have had similar results with similar settings, I wish the 2x swap rumor would finally die.

    – Elder Geek
    Apr 10 '18 at 20:08

















  • +1 for the consideration of the edge case. Personally, I'm not a big swap fan as hibernation is for bears and my systems are kept far too busy for that. ;-) Cheers.

    – Elder Geek
    Apr 8 '18 at 16:05











  • @ElderGeek LOL. Actually Eliah Kagan made me turn my simple comment into an answer. He convinced me that the aforementioned downside of having too much swap is a crucial thing and might be important to others. I'm with you and have little swap configured (2GB with 8GB RAM) and it almost never gets touched.

    – PerlDuck
    Apr 8 '18 at 16:23











  • I have had similar results with similar settings, I wish the 2x swap rumor would finally die.

    – Elder Geek
    Apr 10 '18 at 20:08
















+1 for the consideration of the edge case. Personally, I'm not a big swap fan as hibernation is for bears and my systems are kept far too busy for that. ;-) Cheers.

– Elder Geek
Apr 8 '18 at 16:05





+1 for the consideration of the edge case. Personally, I'm not a big swap fan as hibernation is for bears and my systems are kept far too busy for that. ;-) Cheers.

– Elder Geek
Apr 8 '18 at 16:05













@ElderGeek LOL. Actually Eliah Kagan made me turn my simple comment into an answer. He convinced me that the aforementioned downside of having too much swap is a crucial thing and might be important to others. I'm with you and have little swap configured (2GB with 8GB RAM) and it almost never gets touched.

– PerlDuck
Apr 8 '18 at 16:23





@ElderGeek LOL. Actually Eliah Kagan made me turn my simple comment into an answer. He convinced me that the aforementioned downside of having too much swap is a crucial thing and might be important to others. I'm with you and have little swap configured (2GB with 8GB RAM) and it almost never gets touched.

– PerlDuck
Apr 8 '18 at 16:23













I have had similar results with similar settings, I wish the 2x swap rumor would finally die.

– Elder Geek
Apr 10 '18 at 20:08





I have had similar results with similar settings, I wish the 2x swap rumor would finally die.

– Elder Geek
Apr 10 '18 at 20:08













5














There’s no direct drawback to large swap space. With the way it is managed by the kernel an increase of the amount of swap space above what is sufficient has no or a negligible impact on performance.



The only downside of “too much” swap space is that you can’t use that space for storage.






share|improve this answer




















  • 1





    @An0n: I think it would be a pretty big downside to allocate all the ~6 TB currently connected to my machine as swap space. Where would I put all my music…?

    – David Foerster
    Mar 19 '18 at 22:25






  • 2





    @An0n: What good is a computer if all it can do is boot and then not store any useful data? That sounds more like an expensive space heater.

    – David Foerster
    Mar 19 '18 at 22:30







  • 1





    @An0n: Sure, I assumed as much but you're missing the point. I think we can agree that to be useful a computer must be able to reach a usable system state (incl. being able to boot) and have access to storage that the user can use for her personal data. That requires that it be not occupied by swap space.

    – David Foerster
    Mar 19 '18 at 22:40







  • 2





    Of course it's relative. Just like "too much" is relative. If I have a bootable system and I allocate all my free space as swap space then it's no longer useful to me because of the lack of free space until I change its system configuration in a way that ends in more free space. In that sense the swap space would be "too much" during that time renders the system useless during that time. Anyway, I'm not here to argue semantics of words with you.

    – David Foerster
    Mar 19 '18 at 23:26






  • 1





    @An0n To underline the point here, swap space is space you can't use for anything else. Disk storage space costs money. If your disk space is limited (mine is only 32GB), you want to keep as much of it as possible free to install programs and write files with your stuff in them, like music. People generally try to keep swap to a minimum for that reason, and no other reason. Swap is something the system might need to keep running efficiently, that is otherwise of no value to the user. In general, we want our system to use only the necessary resources, and leave us plenty to play with.

    – Zanna
    Mar 24 '18 at 15:48
















5














There’s no direct drawback to large swap space. With the way it is managed by the kernel an increase of the amount of swap space above what is sufficient has no or a negligible impact on performance.



The only downside of “too much” swap space is that you can’t use that space for storage.






share|improve this answer




















  • 1





    @An0n: I think it would be a pretty big downside to allocate all the ~6 TB currently connected to my machine as swap space. Where would I put all my music…?

    – David Foerster
    Mar 19 '18 at 22:25






  • 2





    @An0n: What good is a computer if all it can do is boot and then not store any useful data? That sounds more like an expensive space heater.

    – David Foerster
    Mar 19 '18 at 22:30







  • 1





    @An0n: Sure, I assumed as much but you're missing the point. I think we can agree that to be useful a computer must be able to reach a usable system state (incl. being able to boot) and have access to storage that the user can use for her personal data. That requires that it be not occupied by swap space.

    – David Foerster
    Mar 19 '18 at 22:40







  • 2





    Of course it's relative. Just like "too much" is relative. If I have a bootable system and I allocate all my free space as swap space then it's no longer useful to me because of the lack of free space until I change its system configuration in a way that ends in more free space. In that sense the swap space would be "too much" during that time renders the system useless during that time. Anyway, I'm not here to argue semantics of words with you.

    – David Foerster
    Mar 19 '18 at 23:26






  • 1





    @An0n To underline the point here, swap space is space you can't use for anything else. Disk storage space costs money. If your disk space is limited (mine is only 32GB), you want to keep as much of it as possible free to install programs and write files with your stuff in them, like music. People generally try to keep swap to a minimum for that reason, and no other reason. Swap is something the system might need to keep running efficiently, that is otherwise of no value to the user. In general, we want our system to use only the necessary resources, and leave us plenty to play with.

    – Zanna
    Mar 24 '18 at 15:48














5












5








5







There’s no direct drawback to large swap space. With the way it is managed by the kernel an increase of the amount of swap space above what is sufficient has no or a negligible impact on performance.



The only downside of “too much” swap space is that you can’t use that space for storage.






share|improve this answer















There’s no direct drawback to large swap space. With the way it is managed by the kernel an increase of the amount of swap space above what is sufficient has no or a negligible impact on performance.



The only downside of “too much” swap space is that you can’t use that space for storage.







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 9 '18 at 16:04

























answered Mar 19 '18 at 16:05









David FoersterDavid Foerster

28.5k1366112




28.5k1366112







  • 1





    @An0n: I think it would be a pretty big downside to allocate all the ~6 TB currently connected to my machine as swap space. Where would I put all my music…?

    – David Foerster
    Mar 19 '18 at 22:25






  • 2





    @An0n: What good is a computer if all it can do is boot and then not store any useful data? That sounds more like an expensive space heater.

    – David Foerster
    Mar 19 '18 at 22:30







  • 1





    @An0n: Sure, I assumed as much but you're missing the point. I think we can agree that to be useful a computer must be able to reach a usable system state (incl. being able to boot) and have access to storage that the user can use for her personal data. That requires that it be not occupied by swap space.

    – David Foerster
    Mar 19 '18 at 22:40







  • 2





    Of course it's relative. Just like "too much" is relative. If I have a bootable system and I allocate all my free space as swap space then it's no longer useful to me because of the lack of free space until I change its system configuration in a way that ends in more free space. In that sense the swap space would be "too much" during that time renders the system useless during that time. Anyway, I'm not here to argue semantics of words with you.

    – David Foerster
    Mar 19 '18 at 23:26






  • 1





    @An0n To underline the point here, swap space is space you can't use for anything else. Disk storage space costs money. If your disk space is limited (mine is only 32GB), you want to keep as much of it as possible free to install programs and write files with your stuff in them, like music. People generally try to keep swap to a minimum for that reason, and no other reason. Swap is something the system might need to keep running efficiently, that is otherwise of no value to the user. In general, we want our system to use only the necessary resources, and leave us plenty to play with.

    – Zanna
    Mar 24 '18 at 15:48













  • 1





    @An0n: I think it would be a pretty big downside to allocate all the ~6 TB currently connected to my machine as swap space. Where would I put all my music…?

    – David Foerster
    Mar 19 '18 at 22:25






  • 2





    @An0n: What good is a computer if all it can do is boot and then not store any useful data? That sounds more like an expensive space heater.

    – David Foerster
    Mar 19 '18 at 22:30







  • 1





    @An0n: Sure, I assumed as much but you're missing the point. I think we can agree that to be useful a computer must be able to reach a usable system state (incl. being able to boot) and have access to storage that the user can use for her personal data. That requires that it be not occupied by swap space.

    – David Foerster
    Mar 19 '18 at 22:40







  • 2





    Of course it's relative. Just like "too much" is relative. If I have a bootable system and I allocate all my free space as swap space then it's no longer useful to me because of the lack of free space until I change its system configuration in a way that ends in more free space. In that sense the swap space would be "too much" during that time renders the system useless during that time. Anyway, I'm not here to argue semantics of words with you.

    – David Foerster
    Mar 19 '18 at 23:26






  • 1





    @An0n To underline the point here, swap space is space you can't use for anything else. Disk storage space costs money. If your disk space is limited (mine is only 32GB), you want to keep as much of it as possible free to install programs and write files with your stuff in them, like music. People generally try to keep swap to a minimum for that reason, and no other reason. Swap is something the system might need to keep running efficiently, that is otherwise of no value to the user. In general, we want our system to use only the necessary resources, and leave us plenty to play with.

    – Zanna
    Mar 24 '18 at 15:48








1




1





@An0n: I think it would be a pretty big downside to allocate all the ~6 TB currently connected to my machine as swap space. Where would I put all my music…?

– David Foerster
Mar 19 '18 at 22:25





@An0n: I think it would be a pretty big downside to allocate all the ~6 TB currently connected to my machine as swap space. Where would I put all my music…?

– David Foerster
Mar 19 '18 at 22:25




2




2





@An0n: What good is a computer if all it can do is boot and then not store any useful data? That sounds more like an expensive space heater.

– David Foerster
Mar 19 '18 at 22:30






@An0n: What good is a computer if all it can do is boot and then not store any useful data? That sounds more like an expensive space heater.

– David Foerster
Mar 19 '18 at 22:30





1




1





@An0n: Sure, I assumed as much but you're missing the point. I think we can agree that to be useful a computer must be able to reach a usable system state (incl. being able to boot) and have access to storage that the user can use for her personal data. That requires that it be not occupied by swap space.

– David Foerster
Mar 19 '18 at 22:40






@An0n: Sure, I assumed as much but you're missing the point. I think we can agree that to be useful a computer must be able to reach a usable system state (incl. being able to boot) and have access to storage that the user can use for her personal data. That requires that it be not occupied by swap space.

– David Foerster
Mar 19 '18 at 22:40





2




2





Of course it's relative. Just like "too much" is relative. If I have a bootable system and I allocate all my free space as swap space then it's no longer useful to me because of the lack of free space until I change its system configuration in a way that ends in more free space. In that sense the swap space would be "too much" during that time renders the system useless during that time. Anyway, I'm not here to argue semantics of words with you.

– David Foerster
Mar 19 '18 at 23:26





Of course it's relative. Just like "too much" is relative. If I have a bootable system and I allocate all my free space as swap space then it's no longer useful to me because of the lack of free space until I change its system configuration in a way that ends in more free space. In that sense the swap space would be "too much" during that time renders the system useless during that time. Anyway, I'm not here to argue semantics of words with you.

– David Foerster
Mar 19 '18 at 23:26




1




1





@An0n To underline the point here, swap space is space you can't use for anything else. Disk storage space costs money. If your disk space is limited (mine is only 32GB), you want to keep as much of it as possible free to install programs and write files with your stuff in them, like music. People generally try to keep swap to a minimum for that reason, and no other reason. Swap is something the system might need to keep running efficiently, that is otherwise of no value to the user. In general, we want our system to use only the necessary resources, and leave us plenty to play with.

– Zanna
Mar 24 '18 at 15:48






@An0n To underline the point here, swap space is space you can't use for anything else. Disk storage space costs money. If your disk space is limited (mine is only 32GB), you want to keep as much of it as possible free to install programs and write files with your stuff in them, like music. People generally try to keep swap to a minimum for that reason, and no other reason. Swap is something the system might need to keep running efficiently, that is otherwise of no value to the user. In general, we want our system to use only the necessary resources, and leave us plenty to play with.

– Zanna
Mar 24 '18 at 15:48












4














You won't feel any other downsides other than less space on your disk, I think that nowadays the conception of 2x the amount of ram is outdated in the majority of systems. I usually recommend to use the same size of your ram for swap memory in laptops though in order to give you the opportunity to hibernate your pc without losing any data due to the volatile nature of RAM.



The only cases where I would consider using more than 1x the size of RAM for the swap partition is when you think you are going to upgrade your RAM size in a short time. Or if you plan to use a system where you will store in a sort of cache the amount of memory used by programs not used at the very same moment.



Hope my point was clear enough, and I repeat I don't think you will experience any problem for having too much swap memory.



Have a nice day!






share|improve this answer




















  • 2





    I do not use swap at all if RAM > 2-4 Gb on a single user desktop.

    – Panther
    Mar 18 '18 at 19:00






  • 1





    @Panther Why not ? And its not about how or when you use it. Its about the size and the usage.

    – An0n
    Mar 19 '18 at 23:01






  • 2





    Have you considered the impact of memory leaks?

    – Elder Geek
    Apr 8 '18 at 16:13











  • @ElderGeek Hi, no i did not consider it. I like your answer, i didn't know about memory leaks problem!

    – zurg
    Apr 10 '18 at 17:02















4














You won't feel any other downsides other than less space on your disk, I think that nowadays the conception of 2x the amount of ram is outdated in the majority of systems. I usually recommend to use the same size of your ram for swap memory in laptops though in order to give you the opportunity to hibernate your pc without losing any data due to the volatile nature of RAM.



The only cases where I would consider using more than 1x the size of RAM for the swap partition is when you think you are going to upgrade your RAM size in a short time. Or if you plan to use a system where you will store in a sort of cache the amount of memory used by programs not used at the very same moment.



Hope my point was clear enough, and I repeat I don't think you will experience any problem for having too much swap memory.



Have a nice day!






share|improve this answer




















  • 2





    I do not use swap at all if RAM > 2-4 Gb on a single user desktop.

    – Panther
    Mar 18 '18 at 19:00






  • 1





    @Panther Why not ? And its not about how or when you use it. Its about the size and the usage.

    – An0n
    Mar 19 '18 at 23:01






  • 2





    Have you considered the impact of memory leaks?

    – Elder Geek
    Apr 8 '18 at 16:13











  • @ElderGeek Hi, no i did not consider it. I like your answer, i didn't know about memory leaks problem!

    – zurg
    Apr 10 '18 at 17:02













4












4








4







You won't feel any other downsides other than less space on your disk, I think that nowadays the conception of 2x the amount of ram is outdated in the majority of systems. I usually recommend to use the same size of your ram for swap memory in laptops though in order to give you the opportunity to hibernate your pc without losing any data due to the volatile nature of RAM.



The only cases where I would consider using more than 1x the size of RAM for the swap partition is when you think you are going to upgrade your RAM size in a short time. Or if you plan to use a system where you will store in a sort of cache the amount of memory used by programs not used at the very same moment.



Hope my point was clear enough, and I repeat I don't think you will experience any problem for having too much swap memory.



Have a nice day!






share|improve this answer















You won't feel any other downsides other than less space on your disk, I think that nowadays the conception of 2x the amount of ram is outdated in the majority of systems. I usually recommend to use the same size of your ram for swap memory in laptops though in order to give you the opportunity to hibernate your pc without losing any data due to the volatile nature of RAM.



The only cases where I would consider using more than 1x the size of RAM for the swap partition is when you think you are going to upgrade your RAM size in a short time. Or if you plan to use a system where you will store in a sort of cache the amount of memory used by programs not used at the very same moment.



Hope my point was clear enough, and I repeat I don't think you will experience any problem for having too much swap memory.



Have a nice day!







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 19 '18 at 16:35









Jeff

734419




734419










answered Mar 18 '18 at 16:01









zurgzurg

6917




6917







  • 2





    I do not use swap at all if RAM > 2-4 Gb on a single user desktop.

    – Panther
    Mar 18 '18 at 19:00






  • 1





    @Panther Why not ? And its not about how or when you use it. Its about the size and the usage.

    – An0n
    Mar 19 '18 at 23:01






  • 2





    Have you considered the impact of memory leaks?

    – Elder Geek
    Apr 8 '18 at 16:13











  • @ElderGeek Hi, no i did not consider it. I like your answer, i didn't know about memory leaks problem!

    – zurg
    Apr 10 '18 at 17:02












  • 2





    I do not use swap at all if RAM > 2-4 Gb on a single user desktop.

    – Panther
    Mar 18 '18 at 19:00






  • 1





    @Panther Why not ? And its not about how or when you use it. Its about the size and the usage.

    – An0n
    Mar 19 '18 at 23:01






  • 2





    Have you considered the impact of memory leaks?

    – Elder Geek
    Apr 8 '18 at 16:13











  • @ElderGeek Hi, no i did not consider it. I like your answer, i didn't know about memory leaks problem!

    – zurg
    Apr 10 '18 at 17:02







2




2





I do not use swap at all if RAM > 2-4 Gb on a single user desktop.

– Panther
Mar 18 '18 at 19:00





I do not use swap at all if RAM > 2-4 Gb on a single user desktop.

– Panther
Mar 18 '18 at 19:00




1




1





@Panther Why not ? And its not about how or when you use it. Its about the size and the usage.

– An0n
Mar 19 '18 at 23:01





@Panther Why not ? And its not about how or when you use it. Its about the size and the usage.

– An0n
Mar 19 '18 at 23:01




2




2





Have you considered the impact of memory leaks?

– Elder Geek
Apr 8 '18 at 16:13





Have you considered the impact of memory leaks?

– Elder Geek
Apr 8 '18 at 16:13













@ElderGeek Hi, no i did not consider it. I like your answer, i didn't know about memory leaks problem!

– zurg
Apr 10 '18 at 17:02





@ElderGeek Hi, no i did not consider it. I like your answer, i didn't know about memory leaks problem!

– zurg
Apr 10 '18 at 17:02











2














How much SWAP does hibernation really need?



It's a misconception that you need RAM x 2 for SWAP size when you use hibernation. The swap size needs to be the size of used RAM not Installed RAM. Generally swap size needs to be 2/5th of installed RAM. To find out the bare-minimum amount of RAM needed for use:



$ cat /sys/power/image_size
3153907712


On this 8 GB RAM machine 3 GB minimum is needed to hibernate.



You can tweak the values in image_size for a smaller swap size with risk of failure. You can tweak it for a larger swap size and possibly speeding up the hibernation speed.



Reference: https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate




16 MB RAM in 1995, different rules for 16 GB RAM in 2018



In the days when you had 16 MB Ram, x 2 for 32 MB swap on your 720 MB hard drive made sense. A little RAM and HDD history in this 1995 Washington Post article.



23 years later some technical articles from that 1995 (although I didn't find any) might be found to mislead new users. I did however find a 2007 article recommending SWAP = RAM x 2.



Back in 1995 32 MB Swap out of 760 MB HDD was 4% of HDD. Indeed the swap partition may have been used a lot in 1995. Today in 2018, 16 GB RAM x 2 for 32 GB SWAP on your 256 GB SSD doesn't make the same sense as it is taking 13% of SSD. Today my 8 GB SWAP partition isn't being used at all unless I force it to fill it up when testing OOM-Killer: Google Chrome will take up my memory to the point where it causes my computer to freeze to a near halt. What can I do to prevent this?.






share|improve this answer

























  • +1 for pointing out the misconception of the often touted 2x rule which is total bunk.

    – Elder Geek
    Apr 8 '18 at 16:09











  • @ElderGeek Thank you. I added a history section on when 16 MB RAM times 2 for 32 MB SWAP may have made sense.

    – WinEunuuchs2Unix
    Apr 8 '18 at 17:22











  • Another thing to consider is SSD versus HDD. Do we want plenty of read/writes on SSD bringing it quicker to failure in that part of the SSD (or is this a myth)? On my system 32GB ram I used 2GB of velociraptor Drive for SWAP but with no intention for hibernation, still not sure if this is ok, possibly I could have had no swap??? But if I was hibernating maybe 4GB would be enough, but chances are I would be using 20GB of browser, and then 4GB would not be enough???

    – NZ Dev
    Jan 29 at 3:03











  • @NZDev I have my swap on SSD but it is seldom used. Last time I checked it was still 100% life left after 1 year of use. To see percentage of life left: askubuntu.com/questions/1038701/how-do-i-check-system-health/…

    – WinEunuuchs2Unix
    Jan 29 at 12:46















2














How much SWAP does hibernation really need?



It's a misconception that you need RAM x 2 for SWAP size when you use hibernation. The swap size needs to be the size of used RAM not Installed RAM. Generally swap size needs to be 2/5th of installed RAM. To find out the bare-minimum amount of RAM needed for use:



$ cat /sys/power/image_size
3153907712


On this 8 GB RAM machine 3 GB minimum is needed to hibernate.



You can tweak the values in image_size for a smaller swap size with risk of failure. You can tweak it for a larger swap size and possibly speeding up the hibernation speed.



Reference: https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate




16 MB RAM in 1995, different rules for 16 GB RAM in 2018



In the days when you had 16 MB Ram, x 2 for 32 MB swap on your 720 MB hard drive made sense. A little RAM and HDD history in this 1995 Washington Post article.



23 years later some technical articles from that 1995 (although I didn't find any) might be found to mislead new users. I did however find a 2007 article recommending SWAP = RAM x 2.



Back in 1995 32 MB Swap out of 760 MB HDD was 4% of HDD. Indeed the swap partition may have been used a lot in 1995. Today in 2018, 16 GB RAM x 2 for 32 GB SWAP on your 256 GB SSD doesn't make the same sense as it is taking 13% of SSD. Today my 8 GB SWAP partition isn't being used at all unless I force it to fill it up when testing OOM-Killer: Google Chrome will take up my memory to the point where it causes my computer to freeze to a near halt. What can I do to prevent this?.






share|improve this answer

























  • +1 for pointing out the misconception of the often touted 2x rule which is total bunk.

    – Elder Geek
    Apr 8 '18 at 16:09











  • @ElderGeek Thank you. I added a history section on when 16 MB RAM times 2 for 32 MB SWAP may have made sense.

    – WinEunuuchs2Unix
    Apr 8 '18 at 17:22











  • Another thing to consider is SSD versus HDD. Do we want plenty of read/writes on SSD bringing it quicker to failure in that part of the SSD (or is this a myth)? On my system 32GB ram I used 2GB of velociraptor Drive for SWAP but with no intention for hibernation, still not sure if this is ok, possibly I could have had no swap??? But if I was hibernating maybe 4GB would be enough, but chances are I would be using 20GB of browser, and then 4GB would not be enough???

    – NZ Dev
    Jan 29 at 3:03











  • @NZDev I have my swap on SSD but it is seldom used. Last time I checked it was still 100% life left after 1 year of use. To see percentage of life left: askubuntu.com/questions/1038701/how-do-i-check-system-health/…

    – WinEunuuchs2Unix
    Jan 29 at 12:46













2












2








2







How much SWAP does hibernation really need?



It's a misconception that you need RAM x 2 for SWAP size when you use hibernation. The swap size needs to be the size of used RAM not Installed RAM. Generally swap size needs to be 2/5th of installed RAM. To find out the bare-minimum amount of RAM needed for use:



$ cat /sys/power/image_size
3153907712


On this 8 GB RAM machine 3 GB minimum is needed to hibernate.



You can tweak the values in image_size for a smaller swap size with risk of failure. You can tweak it for a larger swap size and possibly speeding up the hibernation speed.



Reference: https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate




16 MB RAM in 1995, different rules for 16 GB RAM in 2018



In the days when you had 16 MB Ram, x 2 for 32 MB swap on your 720 MB hard drive made sense. A little RAM and HDD history in this 1995 Washington Post article.



23 years later some technical articles from that 1995 (although I didn't find any) might be found to mislead new users. I did however find a 2007 article recommending SWAP = RAM x 2.



Back in 1995 32 MB Swap out of 760 MB HDD was 4% of HDD. Indeed the swap partition may have been used a lot in 1995. Today in 2018, 16 GB RAM x 2 for 32 GB SWAP on your 256 GB SSD doesn't make the same sense as it is taking 13% of SSD. Today my 8 GB SWAP partition isn't being used at all unless I force it to fill it up when testing OOM-Killer: Google Chrome will take up my memory to the point where it causes my computer to freeze to a near halt. What can I do to prevent this?.






share|improve this answer















How much SWAP does hibernation really need?



It's a misconception that you need RAM x 2 for SWAP size when you use hibernation. The swap size needs to be the size of used RAM not Installed RAM. Generally swap size needs to be 2/5th of installed RAM. To find out the bare-minimum amount of RAM needed for use:



$ cat /sys/power/image_size
3153907712


On this 8 GB RAM machine 3 GB minimum is needed to hibernate.



You can tweak the values in image_size for a smaller swap size with risk of failure. You can tweak it for a larger swap size and possibly speeding up the hibernation speed.



Reference: https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate




16 MB RAM in 1995, different rules for 16 GB RAM in 2018



In the days when you had 16 MB Ram, x 2 for 32 MB swap on your 720 MB hard drive made sense. A little RAM and HDD history in this 1995 Washington Post article.



23 years later some technical articles from that 1995 (although I didn't find any) might be found to mislead new users. I did however find a 2007 article recommending SWAP = RAM x 2.



Back in 1995 32 MB Swap out of 760 MB HDD was 4% of HDD. Indeed the swap partition may have been used a lot in 1995. Today in 2018, 16 GB RAM x 2 for 32 GB SWAP on your 256 GB SSD doesn't make the same sense as it is taking 13% of SSD. Today my 8 GB SWAP partition isn't being used at all unless I force it to fill it up when testing OOM-Killer: Google Chrome will take up my memory to the point where it causes my computer to freeze to a near halt. What can I do to prevent this?.







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 8 '18 at 17:20

























answered Apr 1 '18 at 0:53









WinEunuuchs2UnixWinEunuuchs2Unix

46.6k1190182




46.6k1190182












  • +1 for pointing out the misconception of the often touted 2x rule which is total bunk.

    – Elder Geek
    Apr 8 '18 at 16:09











  • @ElderGeek Thank you. I added a history section on when 16 MB RAM times 2 for 32 MB SWAP may have made sense.

    – WinEunuuchs2Unix
    Apr 8 '18 at 17:22











  • Another thing to consider is SSD versus HDD. Do we want plenty of read/writes on SSD bringing it quicker to failure in that part of the SSD (or is this a myth)? On my system 32GB ram I used 2GB of velociraptor Drive for SWAP but with no intention for hibernation, still not sure if this is ok, possibly I could have had no swap??? But if I was hibernating maybe 4GB would be enough, but chances are I would be using 20GB of browser, and then 4GB would not be enough???

    – NZ Dev
    Jan 29 at 3:03











  • @NZDev I have my swap on SSD but it is seldom used. Last time I checked it was still 100% life left after 1 year of use. To see percentage of life left: askubuntu.com/questions/1038701/how-do-i-check-system-health/…

    – WinEunuuchs2Unix
    Jan 29 at 12:46

















  • +1 for pointing out the misconception of the often touted 2x rule which is total bunk.

    – Elder Geek
    Apr 8 '18 at 16:09











  • @ElderGeek Thank you. I added a history section on when 16 MB RAM times 2 for 32 MB SWAP may have made sense.

    – WinEunuuchs2Unix
    Apr 8 '18 at 17:22











  • Another thing to consider is SSD versus HDD. Do we want plenty of read/writes on SSD bringing it quicker to failure in that part of the SSD (or is this a myth)? On my system 32GB ram I used 2GB of velociraptor Drive for SWAP but with no intention for hibernation, still not sure if this is ok, possibly I could have had no swap??? But if I was hibernating maybe 4GB would be enough, but chances are I would be using 20GB of browser, and then 4GB would not be enough???

    – NZ Dev
    Jan 29 at 3:03











  • @NZDev I have my swap on SSD but it is seldom used. Last time I checked it was still 100% life left after 1 year of use. To see percentage of life left: askubuntu.com/questions/1038701/how-do-i-check-system-health/…

    – WinEunuuchs2Unix
    Jan 29 at 12:46
















+1 for pointing out the misconception of the often touted 2x rule which is total bunk.

– Elder Geek
Apr 8 '18 at 16:09





+1 for pointing out the misconception of the often touted 2x rule which is total bunk.

– Elder Geek
Apr 8 '18 at 16:09













@ElderGeek Thank you. I added a history section on when 16 MB RAM times 2 for 32 MB SWAP may have made sense.

– WinEunuuchs2Unix
Apr 8 '18 at 17:22





@ElderGeek Thank you. I added a history section on when 16 MB RAM times 2 for 32 MB SWAP may have made sense.

– WinEunuuchs2Unix
Apr 8 '18 at 17:22













Another thing to consider is SSD versus HDD. Do we want plenty of read/writes on SSD bringing it quicker to failure in that part of the SSD (or is this a myth)? On my system 32GB ram I used 2GB of velociraptor Drive for SWAP but with no intention for hibernation, still not sure if this is ok, possibly I could have had no swap??? But if I was hibernating maybe 4GB would be enough, but chances are I would be using 20GB of browser, and then 4GB would not be enough???

– NZ Dev
Jan 29 at 3:03





Another thing to consider is SSD versus HDD. Do we want plenty of read/writes on SSD bringing it quicker to failure in that part of the SSD (or is this a myth)? On my system 32GB ram I used 2GB of velociraptor Drive for SWAP but with no intention for hibernation, still not sure if this is ok, possibly I could have had no swap??? But if I was hibernating maybe 4GB would be enough, but chances are I would be using 20GB of browser, and then 4GB would not be enough???

– NZ Dev
Jan 29 at 3:03













@NZDev I have my swap on SSD but it is seldom used. Last time I checked it was still 100% life left after 1 year of use. To see percentage of life left: askubuntu.com/questions/1038701/how-do-i-check-system-health/…

– WinEunuuchs2Unix
Jan 29 at 12:46





@NZDev I have my swap on SSD but it is seldom used. Last time I checked it was still 100% life left after 1 year of use. To see percentage of life left: askubuntu.com/questions/1038701/how-do-i-check-system-health/…

– WinEunuuchs2Unix
Jan 29 at 12:46











1














What is SWAP:



Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.



Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.



Swap should equal 2x physical RAM.




Advantages:



Provides overflow space when your memory fills up completely
Can move rarely-needed items away from your high-speed memory
Allows you to hibernate



Disadvantages:



Takes up space on your hard drive as SWAP partitions do not resize dynamically
Can increase wear and tear to your hard drive
Does not necessarily improve performance (see below)




When SWAP Partitions "Don’t Help" as in "not worthy comparing to extra storage" :



If your Harddrive has only 5400 RPM and you have little RAM lets say > 2GB.
Why ? Because the system constantly wanted to access the SWAP partition, it will eventually become very slow. Even though you now have space in the memory, everything in the SWAP partition need to be moved back over. Because the system will go slow, allot stays in the SWAP partition. This can only be fixed with a reboot. Which will take a while anyway because the system need to remove everything from the SWAP partition before shutting down.




**Conclussion: **



If you would like to be able to hibernate your computer, then you should have a SWAP partition. The size of this partition should be the size of your installed memory, plus an additional 10-25% to leave room for any items that were already moved over into the SWAP partition.



If you just want a small performance boost (and you have at least a 7200rpm hard drive), then you can add a SWAP partition if you want, but it’s not needed unless you have less than 4GB of installed memory. The size of this can be whatever you’d like. However I recommend 2x the RAM as a pinpoint. IF you have enoug storage space.



If you have a 5400rpm hard drive, then you shouldn’t create a SWAP partition simply because the bottleneck will make your computer worse off. However, if you absolutely want to have SWAP, then you can still create a partition using the same sizing guidelines outlined above – but change the swappiness value to something much lower.





My OPINION:



However in any case if you use Ubuntu as your Main OS for daily use I recommend 2x the size of the RAM. Because you don't install Ubuntu just because you have a old computer. But because you want to use the system as your Main OS.



Rather buy some extra hardware if needed instead of adjusting the system partitions to keep it running.
If you buy a game you also make sure your system is "up to date" instead of adjusting the settings to make it "Playable".



You can better have some extra space, SWAP, speed, power instead of having too short or need to resize everything later on. Because you need SWAP or space, bought RAM? Or need to buy ram fast because one memory slot or stick broke.






share|improve this answer























  • Re: your Conclusion It just does not make sense, or another way to put it is where do we draw the line. eg RAM 8GB plus 16GB swap: What if I use the 8GB of RAM and 9GB of swap, then there is still not enough room to hibernate. So what gives? In other words no matter what size you make it, you can still use it all and more. So why is Swap file not given 2 dedicated spaces 1 as Virtual memory and the other as hibernation space which would be the sum or the other 2. It just does not stack up for me and no one has ever answered this question.

    – NZ Dev
    Jan 29 at 3:07
















1














What is SWAP:



Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.



Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.



Swap should equal 2x physical RAM.




Advantages:



Provides overflow space when your memory fills up completely
Can move rarely-needed items away from your high-speed memory
Allows you to hibernate



Disadvantages:



Takes up space on your hard drive as SWAP partitions do not resize dynamically
Can increase wear and tear to your hard drive
Does not necessarily improve performance (see below)




When SWAP Partitions "Don’t Help" as in "not worthy comparing to extra storage" :



If your Harddrive has only 5400 RPM and you have little RAM lets say > 2GB.
Why ? Because the system constantly wanted to access the SWAP partition, it will eventually become very slow. Even though you now have space in the memory, everything in the SWAP partition need to be moved back over. Because the system will go slow, allot stays in the SWAP partition. This can only be fixed with a reboot. Which will take a while anyway because the system need to remove everything from the SWAP partition before shutting down.




**Conclussion: **



If you would like to be able to hibernate your computer, then you should have a SWAP partition. The size of this partition should be the size of your installed memory, plus an additional 10-25% to leave room for any items that were already moved over into the SWAP partition.



If you just want a small performance boost (and you have at least a 7200rpm hard drive), then you can add a SWAP partition if you want, but it’s not needed unless you have less than 4GB of installed memory. The size of this can be whatever you’d like. However I recommend 2x the RAM as a pinpoint. IF you have enoug storage space.



If you have a 5400rpm hard drive, then you shouldn’t create a SWAP partition simply because the bottleneck will make your computer worse off. However, if you absolutely want to have SWAP, then you can still create a partition using the same sizing guidelines outlined above – but change the swappiness value to something much lower.





My OPINION:



However in any case if you use Ubuntu as your Main OS for daily use I recommend 2x the size of the RAM. Because you don't install Ubuntu just because you have a old computer. But because you want to use the system as your Main OS.



Rather buy some extra hardware if needed instead of adjusting the system partitions to keep it running.
If you buy a game you also make sure your system is "up to date" instead of adjusting the settings to make it "Playable".



You can better have some extra space, SWAP, speed, power instead of having too short or need to resize everything later on. Because you need SWAP or space, bought RAM? Or need to buy ram fast because one memory slot or stick broke.






share|improve this answer























  • Re: your Conclusion It just does not make sense, or another way to put it is where do we draw the line. eg RAM 8GB plus 16GB swap: What if I use the 8GB of RAM and 9GB of swap, then there is still not enough room to hibernate. So what gives? In other words no matter what size you make it, you can still use it all and more. So why is Swap file not given 2 dedicated spaces 1 as Virtual memory and the other as hibernation space which would be the sum or the other 2. It just does not stack up for me and no one has ever answered this question.

    – NZ Dev
    Jan 29 at 3:07














1












1








1







What is SWAP:



Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.



Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.



Swap should equal 2x physical RAM.




Advantages:



Provides overflow space when your memory fills up completely
Can move rarely-needed items away from your high-speed memory
Allows you to hibernate



Disadvantages:



Takes up space on your hard drive as SWAP partitions do not resize dynamically
Can increase wear and tear to your hard drive
Does not necessarily improve performance (see below)




When SWAP Partitions "Don’t Help" as in "not worthy comparing to extra storage" :



If your Harddrive has only 5400 RPM and you have little RAM lets say > 2GB.
Why ? Because the system constantly wanted to access the SWAP partition, it will eventually become very slow. Even though you now have space in the memory, everything in the SWAP partition need to be moved back over. Because the system will go slow, allot stays in the SWAP partition. This can only be fixed with a reboot. Which will take a while anyway because the system need to remove everything from the SWAP partition before shutting down.




**Conclussion: **



If you would like to be able to hibernate your computer, then you should have a SWAP partition. The size of this partition should be the size of your installed memory, plus an additional 10-25% to leave room for any items that were already moved over into the SWAP partition.



If you just want a small performance boost (and you have at least a 7200rpm hard drive), then you can add a SWAP partition if you want, but it’s not needed unless you have less than 4GB of installed memory. The size of this can be whatever you’d like. However I recommend 2x the RAM as a pinpoint. IF you have enoug storage space.



If you have a 5400rpm hard drive, then you shouldn’t create a SWAP partition simply because the bottleneck will make your computer worse off. However, if you absolutely want to have SWAP, then you can still create a partition using the same sizing guidelines outlined above – but change the swappiness value to something much lower.





My OPINION:



However in any case if you use Ubuntu as your Main OS for daily use I recommend 2x the size of the RAM. Because you don't install Ubuntu just because you have a old computer. But because you want to use the system as your Main OS.



Rather buy some extra hardware if needed instead of adjusting the system partitions to keep it running.
If you buy a game you also make sure your system is "up to date" instead of adjusting the settings to make it "Playable".



You can better have some extra space, SWAP, speed, power instead of having too short or need to resize everything later on. Because you need SWAP or space, bought RAM? Or need to buy ram fast because one memory slot or stick broke.






share|improve this answer













What is SWAP:



Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. While swap space can help machines with a small amount of RAM, it should not be considered a replacement for more RAM. Swap space is located on hard drives, which have a slower access time than physical memory.



Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files.



Swap should equal 2x physical RAM.




Advantages:



Provides overflow space when your memory fills up completely
Can move rarely-needed items away from your high-speed memory
Allows you to hibernate



Disadvantages:



Takes up space on your hard drive as SWAP partitions do not resize dynamically
Can increase wear and tear to your hard drive
Does not necessarily improve performance (see below)




When SWAP Partitions "Don’t Help" as in "not worthy comparing to extra storage" :



If your Harddrive has only 5400 RPM and you have little RAM lets say > 2GB.
Why ? Because the system constantly wanted to access the SWAP partition, it will eventually become very slow. Even though you now have space in the memory, everything in the SWAP partition need to be moved back over. Because the system will go slow, allot stays in the SWAP partition. This can only be fixed with a reboot. Which will take a while anyway because the system need to remove everything from the SWAP partition before shutting down.




**Conclussion: **



If you would like to be able to hibernate your computer, then you should have a SWAP partition. The size of this partition should be the size of your installed memory, plus an additional 10-25% to leave room for any items that were already moved over into the SWAP partition.



If you just want a small performance boost (and you have at least a 7200rpm hard drive), then you can add a SWAP partition if you want, but it’s not needed unless you have less than 4GB of installed memory. The size of this can be whatever you’d like. However I recommend 2x the RAM as a pinpoint. IF you have enoug storage space.



If you have a 5400rpm hard drive, then you shouldn’t create a SWAP partition simply because the bottleneck will make your computer worse off. However, if you absolutely want to have SWAP, then you can still create a partition using the same sizing guidelines outlined above – but change the swappiness value to something much lower.





My OPINION:



However in any case if you use Ubuntu as your Main OS for daily use I recommend 2x the size of the RAM. Because you don't install Ubuntu just because you have a old computer. But because you want to use the system as your Main OS.



Rather buy some extra hardware if needed instead of adjusting the system partitions to keep it running.
If you buy a game you also make sure your system is "up to date" instead of adjusting the settings to make it "Playable".



You can better have some extra space, SWAP, speed, power instead of having too short or need to resize everything later on. Because you need SWAP or space, bought RAM? Or need to buy ram fast because one memory slot or stick broke.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 31 '18 at 20:28









An0nAn0n

919120




919120












  • Re: your Conclusion It just does not make sense, or another way to put it is where do we draw the line. eg RAM 8GB plus 16GB swap: What if I use the 8GB of RAM and 9GB of swap, then there is still not enough room to hibernate. So what gives? In other words no matter what size you make it, you can still use it all and more. So why is Swap file not given 2 dedicated spaces 1 as Virtual memory and the other as hibernation space which would be the sum or the other 2. It just does not stack up for me and no one has ever answered this question.

    – NZ Dev
    Jan 29 at 3:07


















  • Re: your Conclusion It just does not make sense, or another way to put it is where do we draw the line. eg RAM 8GB plus 16GB swap: What if I use the 8GB of RAM and 9GB of swap, then there is still not enough room to hibernate. So what gives? In other words no matter what size you make it, you can still use it all and more. So why is Swap file not given 2 dedicated spaces 1 as Virtual memory and the other as hibernation space which would be the sum or the other 2. It just does not stack up for me and no one has ever answered this question.

    – NZ Dev
    Jan 29 at 3:07

















Re: your Conclusion It just does not make sense, or another way to put it is where do we draw the line. eg RAM 8GB plus 16GB swap: What if I use the 8GB of RAM and 9GB of swap, then there is still not enough room to hibernate. So what gives? In other words no matter what size you make it, you can still use it all and more. So why is Swap file not given 2 dedicated spaces 1 as Virtual memory and the other as hibernation space which would be the sum or the other 2. It just does not stack up for me and no one has ever answered this question.

– NZ Dev
Jan 29 at 3:07






Re: your Conclusion It just does not make sense, or another way to put it is where do we draw the line. eg RAM 8GB plus 16GB swap: What if I use the 8GB of RAM and 9GB of swap, then there is still not enough room to hibernate. So what gives? In other words no matter what size you make it, you can still use it all and more. So why is Swap file not given 2 dedicated spaces 1 as Virtual memory and the other as hibernation space which would be the sum or the other 2. It just does not stack up for me and no one has ever answered this question.

– NZ Dev
Jan 29 at 3:07












0














There is an overhead, indeed, but is very small; for every on-disk "page" there's a reference counter, and there's a couple of structs associated with every swap area; this is in kernel memory, so can't be paged. It's between 2 and 16 MB every 4 GB, depending on the architecture. The rest is fairly dynamic, thus dependant on usage.



So you can have plenty, but keep in mind the paged address space itself imposes some overhead on the RAM, and on top of that there's some tracking going on for swapped pages, so it doesn't scale very far; even if imposing quite some overhead, filesystems are far more efficient than the swap areas when it comes to handling larger areas as the vfs can offload structural information to disk (normally at least page tables can't be swapped, because of hardware limitations, and the vmm is likely using non-swappable memory for all it's bookkeeping).



I can't think of any other downside, OTOH having too little swap can cause fragmentation when swapping pages, which means more seeking. When having a lot, after certain point there will be no improvements either.



Swapping is generally a last resource (hibernation aside), so you'll probably not benefit from having more swap space than RAM, specially if you have over 4GB of RAM, and sometimes even as big as RAM is too much (think 64 GB).






share|improve this answer

























  • Sorry, your last statement/sentence is confusing, otherwise a good add-on to the above.

    – NZ Dev
    Jan 29 at 3:22











  • @NZDev is it better now?

    – Ismael Luceno
    19 mins ago















0














There is an overhead, indeed, but is very small; for every on-disk "page" there's a reference counter, and there's a couple of structs associated with every swap area; this is in kernel memory, so can't be paged. It's between 2 and 16 MB every 4 GB, depending on the architecture. The rest is fairly dynamic, thus dependant on usage.



So you can have plenty, but keep in mind the paged address space itself imposes some overhead on the RAM, and on top of that there's some tracking going on for swapped pages, so it doesn't scale very far; even if imposing quite some overhead, filesystems are far more efficient than the swap areas when it comes to handling larger areas as the vfs can offload structural information to disk (normally at least page tables can't be swapped, because of hardware limitations, and the vmm is likely using non-swappable memory for all it's bookkeeping).



I can't think of any other downside, OTOH having too little swap can cause fragmentation when swapping pages, which means more seeking. When having a lot, after certain point there will be no improvements either.



Swapping is generally a last resource (hibernation aside), so you'll probably not benefit from having more swap space than RAM, specially if you have over 4GB of RAM, and sometimes even as big as RAM is too much (think 64 GB).






share|improve this answer

























  • Sorry, your last statement/sentence is confusing, otherwise a good add-on to the above.

    – NZ Dev
    Jan 29 at 3:22











  • @NZDev is it better now?

    – Ismael Luceno
    19 mins ago













0












0








0







There is an overhead, indeed, but is very small; for every on-disk "page" there's a reference counter, and there's a couple of structs associated with every swap area; this is in kernel memory, so can't be paged. It's between 2 and 16 MB every 4 GB, depending on the architecture. The rest is fairly dynamic, thus dependant on usage.



So you can have plenty, but keep in mind the paged address space itself imposes some overhead on the RAM, and on top of that there's some tracking going on for swapped pages, so it doesn't scale very far; even if imposing quite some overhead, filesystems are far more efficient than the swap areas when it comes to handling larger areas as the vfs can offload structural information to disk (normally at least page tables can't be swapped, because of hardware limitations, and the vmm is likely using non-swappable memory for all it's bookkeeping).



I can't think of any other downside, OTOH having too little swap can cause fragmentation when swapping pages, which means more seeking. When having a lot, after certain point there will be no improvements either.



Swapping is generally a last resource (hibernation aside), so you'll probably not benefit from having more swap space than RAM, specially if you have over 4GB of RAM, and sometimes even as big as RAM is too much (think 64 GB).






share|improve this answer















There is an overhead, indeed, but is very small; for every on-disk "page" there's a reference counter, and there's a couple of structs associated with every swap area; this is in kernel memory, so can't be paged. It's between 2 and 16 MB every 4 GB, depending on the architecture. The rest is fairly dynamic, thus dependant on usage.



So you can have plenty, but keep in mind the paged address space itself imposes some overhead on the RAM, and on top of that there's some tracking going on for swapped pages, so it doesn't scale very far; even if imposing quite some overhead, filesystems are far more efficient than the swap areas when it comes to handling larger areas as the vfs can offload structural information to disk (normally at least page tables can't be swapped, because of hardware limitations, and the vmm is likely using non-swappable memory for all it's bookkeeping).



I can't think of any other downside, OTOH having too little swap can cause fragmentation when swapping pages, which means more seeking. When having a lot, after certain point there will be no improvements either.



Swapping is generally a last resource (hibernation aside), so you'll probably not benefit from having more swap space than RAM, specially if you have over 4GB of RAM, and sometimes even as big as RAM is too much (think 64 GB).







share|improve this answer














share|improve this answer



share|improve this answer








edited 21 mins ago

























answered Apr 1 '18 at 0:39









Ismael LucenoIsmael Luceno

1245




1245












  • Sorry, your last statement/sentence is confusing, otherwise a good add-on to the above.

    – NZ Dev
    Jan 29 at 3:22











  • @NZDev is it better now?

    – Ismael Luceno
    19 mins ago

















  • Sorry, your last statement/sentence is confusing, otherwise a good add-on to the above.

    – NZ Dev
    Jan 29 at 3:22











  • @NZDev is it better now?

    – Ismael Luceno
    19 mins ago
















Sorry, your last statement/sentence is confusing, otherwise a good add-on to the above.

– NZ Dev
Jan 29 at 3:22





Sorry, your last statement/sentence is confusing, otherwise a good add-on to the above.

– NZ Dev
Jan 29 at 3:22













@NZDev is it better now?

– Ismael Luceno
19 mins ago





@NZDev is it better now?

– Ismael Luceno
19 mins ago

















draft saved

draft discarded
















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1017021%2fcan-you-have-too-much-swap%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»