LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Why size of swap space is 2x of RAM??? Why not 1.5x of RAM or 2.5x of RAM??? (https://www.linuxquestions.org/questions/linux-newbie-8/why-size-of-swap-space-is-2x-of-ram-why-not-1-5x-of-ram-or-2-5x-of-ram-911005/)

Saurav Ghosh 10-31-2011 12:28 AM

Why size of swap space is 2x of RAM??? Why not 1.5x of RAM or 2.5x of RAM???
 
Why size of swap space is 2x of RAM??? Why not 1.5x of RAM or 2.5x of RAM???

konsolelover 10-31-2011 12:47 AM

It's just a customary idea , not a rule.

johnsfine 10-31-2011 06:49 AM

It was a fairly stupid "rule of thumb" back when ram as a lot more expensive. Actual swap space requirements always depend on what you're doing with the system and don't correlate significantly with the amount of ram you have.

Now that people routinely (but not uniformly) buy much more ram than they really need, that 2X rule has shifted from fairly useless to totally useless.

If you can't figure out how much swap you should have (don't worry, most people are no better at figuring that out) a better blind rule is configure 2GB of swap regardless of ram size. If you have 0.5GB of ram, 2GB of swap. If you have 8GB of ram 2GB of swap.

Saurav Ghosh 10-31-2011 12:28 PM

Thank u...

elliott678 10-31-2011 12:39 PM

Quote:

Originally Posted by johnsfine (Post 4512401)
If you can't figure out how much swap you should have (don't worry, most people are no better at figuring that out) a better blind rule is configure 2GB of swap regardless of ram size. If you have 0.5GB of ram, 2GB of swap. If you have 8GB of ram 2GB of swap.

Unless you plan on hibernating, then the partition must be at least as much as your RAM.

Though, if you're careful, it is entirely possible to get away with no swap at all. I've never had a swap partition on my EeePC with 2gb of RAM. I even keep /tmp/, /var/log/ and my browser cache in tmpfs, which is in RAM.

singhjc 11-01-2011 03:29 AM

Hello ,


it is not a rule, it was just because mostly systems had less physical memory earlier so we had to made swap space just double of ram but now days system have sufficient physical memory around 1 GB or more then 1 GB mostly ,so there is no need to create 2 GB swap partition if you do create only 1 GB swap your system will work fairly without any issue.

for example my server has 8 GB RAM but swap space is only 2 GB and server is working fine since last 3 years.

catkin 11-01-2011 03:46 AM

An alternative is to swap to a file (in a file system) as opposed to dedicated partition(s). AFAIK the file stays at the maximum swap used size so is a good way of measuring it, perhaps to decide what size dedicated partition to use. If the system is using swap then it will probably use more swap later (computing load has a tendency to grow) so best to configure more than the system actually uses to allow room for future growth.

floppy_stuttgart 11-01-2011 03:49 AM

hello,
here are my thoughts.
depending of what you want to do, you dont need swap at all..
my desktop PC has 768 MB RAM. A LOT for the processor and tinycorelinux. And just for the principle of having it, 100 MB of swap (it was used 1 time when I had too much applications opened).
I run my tinycorelinux USB stick on different PCs direct in RAM (no swap, no HDD).
Using SWAP by these days is perhaps because
- you cannot increase the RAM (physical limitation in your HW),
- dont have more money for RAM,
- have the wrong linux (too big too fat)
.. forgot to buy RAM?


All times are GMT -5. The time now is 06:50 PM.