Author Topic: Swap - Size according to usage.  (Read 6706 times)

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Swap - Size according to usage.
« on: March 24, 2010, 05:45:42 PM »
There have been a considerable amount of posts about what size to use when creating a swap partition. The size of an individual's swap partition can be determined by the type of computer, and how the computer in question is intended to be used.

If you have a laptop, and intend to use hibernate, your swap must be large enough to hold everything present already in swap as well as everything in RAM at the time the machine goes into hibernation, hence the 2xRAM rule. For a desktop that never sees hibernation, it's probably mostly a waste of space, and the size really depends on how you use the computer. If you do a lot of video work, transcoding more than one file at a time, swap usage can be rather high, in relationship to RAM, so swap at least equal to RAM would not be out of line. If you mostly spend your time on the web, and typing documents and reports, and have 1 GB RAM, or more, you may not need swap at all.
« Last Edit: March 24, 2010, 05:49:33 PM by old-polack »
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6849
  • MLU
Re: Swap - Size according to usage.
« Reply #1 on: March 25, 2010, 07:02:07 AM »
Not being deliberately picky, but do want to point out that suspend to RAM and to disc can be very useful for Desktops too ........  I will use it when leaving the PC for an hour or so.
It is an option in the shut-down menu.

I thought this should be mentioned in view of this being in Tips and Tricks.

regards.
« Last Edit: March 25, 2010, 07:07:23 AM by JohnBoy »

uncleV

  • Guest
Re: Swap - Size according to usage.
« Reply #2 on: May 22, 2010, 02:47:42 AM »
Not being deliberately picky, but do want to point out that suspend to RAM and to disc can be very useful for Desktops too ........  I will use it when leaving the PC for an hour or so.
It is an option in the shut-down menu.

I thought this should be mentioned in view of this being in Tips and Tricks.

regards.

+1

It is convenient to pick up all the job you didn't finish yesterday.
« Last Edit: May 22, 2010, 03:48:07 AM by uncleV »

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Swap - Size according to usage.
« Reply #3 on: May 22, 2010, 05:53:40 AM »
If you have less than 2GB RAM, and you are creating a remaster of your system, you will need at least 2GB swap. With 512MB RAM, at least 3GB swap will be better.
As O-P says, "The size really depends on how you use the computer." -- And on how much RAM you have.

uncleV

  • Guest
Re: Swap - Size according to usage.
« Reply #4 on: May 22, 2010, 06:32:16 AM »
My RAM is 512+256 and I hibernate and successfully wake up with OOWriter (1 document of about 300K), FF (2-3 tabs opened), PDF-viewer Gimp and Terminal opened, LXDE 2010, swap being 1,5 GB.
« Last Edit: May 22, 2010, 06:37:29 AM by uncleV »

Offline menotu

  • PCLinuxOS Tester
  • Super Villain
  • *******
  • Posts: 15515
  • ┌∩┐(◕_◕)┌∩┐
Re: Swap - Size according to usage.
« Reply #5 on: July 07, 2010, 10:40:30 AM »
I use hibernate on my main desktop and, apart from the convenience, I find its the best way grab back all the memory that hasn't been properly released by some apps.
PCLinuxOS 32bit KDE 4.10.4; kernel-3.4.11-pclos1.bfs & 64bit 3.4.38bfs; NVidia GeForce 8400GS 1GB 310.19 driver

Sony Vaio SVE1513A4ESI Laptop, Intel Core i5, 2.6GHz, 6GB RAM, 750GB, 15.6" Intel HD Graphics 4000

tekkaman_01

  • Guest
Re: Swap - Size according to usage.
« Reply #6 on: July 10, 2010, 11:11:35 PM »
Would their ever be a reason to have too much swap space? I have 3Gb of Ram and created a 6Gb Swap, If I were to change it to like say 10Gb swap, would it be wrong other than a waste of Hard drive space? I don't plan on it, unless someone lets me know that it would actually make things faster or something, I just figured I would ask sense I am trying to learn as much as I can.

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: Swap - Size according to usage.
« Reply #7 on: July 10, 2010, 11:39:32 PM »
Would their ever be a reason to have too much swap space? I have 3Gb of Ram and created a 6Gb Swap, If I were to change it to like say 10Gb swap, would it be wrong other than a waste of Hard drive space? I don't plan on it, unless someone lets me know that it would actually make things faster or something, I just figured I would ask sense I am trying to learn as much as I can.

I don't know of any problems that can arise from too much swap, though there are some problems that can occur if you have too little swap. My current swap space, from this machine;

[root@littleboy ~]# swapon -s
Code: [Select]
Filename                                Type            Size    Used    Priority
/dev/sda2                               partition       1702880 2908    -1
/dev/sdc2                               partition       8096752 0       -2
/dev/sdd2                               partition       6008300 0       -3
/dev/sdb2                               partition       1959920 0       -4
« Last Edit: July 10, 2010, 11:42:04 PM by old-polack »
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

vjeko

  • Guest
Re: Swap - Size according to usage.
« Reply #8 on: September 27, 2010, 09:05:53 AM »
on big swap requirement, it would be much better to add ram modules (motherboard permitting with appropriate kernel) than to use hdd, since the drive read/write speed is quite different, and that would show during use. even using external drive, usb vs esata is quite big of a difference.
 

Offline Neal ManBear

  • Administrator
  • Super Villain
  • *****
  • Posts: 15829
  • LXDE! Coffee, Bacon and Cheesecake!
Re: Swap - Size according to usage.
« Reply #9 on: September 27, 2010, 09:22:36 AM »
In normal usage, swap is rarely accessed, if you have 2 or 3GB of RAM. If you're doing some resource intensive tasks (like editing large video files), you may want to add RAM and / or use a larger swap.

On my build box (3.5GB RAM), I have a 3GB swap partition. I set it up that way as a "just in case it is needed" thing. Even when I am remastering the system, the swap just sits there.

Swap should always be available, but the more RAM you have and the fewer processes you run at the same time, the less likely it is that swap will be accessed.

uncleV

  • Guest
Re: Swap - Size according to usage.
« Reply #10 on: September 27, 2010, 11:21:12 AM »
Couldn't see my swap used till now, never seen, except of opening the Windows pagefile.sys in OOwrighter... Was done in purpose to see swap used.

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: Swap - Size according to usage.
« Reply #11 on: September 27, 2010, 11:27:26 AM »
Swap can use multiple swap partitions, on multiple hard drives, and one can have their priorities set equal, to use them in a striped fashion, similar to raid 0, to speed up the writing to and and recovery of data from them.

[root@littleboy ~]# swapon -s
Code: [Select]
Filename                                Type            Size    Used    Priority
/dev/sda2                               partition       1702880 75400   3
/dev/sdc2                               partition       8096752 75396   3
/dev/sdd2                               partition       6008300 75508   3
« Last Edit: September 27, 2010, 09:21:56 PM by old-polack »
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6849
  • MLU
Re: Swap - Size according to usage.
« Reply #12 on: September 28, 2010, 02:43:25 AM »
Swap can use multiple swap partitions, on multiple hard drives, and one can have their priorities set equal, to use them in a striped fashion, similar to raid 0, to speed up the writing to and and recovery of data from them.

[root@littleboy ~]# swapon -s
Code: [Select]
Filename                                Type            Size    Used    Priority
/dev/sda2                               partition       1702880 75400   3
/dev/sdc2                               partition       8096752 75396   3
/dev/sdd2                               partition       6008300 75508   3


Any idea if this arrangement is good for Suspend to Disk?
As I understand it, S2D requires that the Swap space must be one contiguous space to work properly.
I had always interpreted this to mean a single Swap partition/file had to be of sufficient size for the operation.

This (edit) post has caused me to wonder if it is possible to use multiple smaller Swap partitions/files to make available sufficient space for the suspend operation.

Any info available appreciated   ;)

regards.
« Last Edit: September 28, 2010, 11:04:53 AM by JohnBoy »

Offline Old-Polack

  • Administrator
  • Super Villain
  • *****
  • Posts: 11688
  • ----IOFLU----
Re: Swap - Size according to usage.
« Reply #13 on: September 28, 2010, 10:31:24 AM »
Swap can use multiple swap partitions, on multiple hard drives, and one can have their priorities set equal, to use them in a striped fashion, similar to raid 0, to speed up the writing to and and recovery of data from them.

[root@littleboy ~]# swapon -s
Code: [Select]
Filename                                Type            Size    Used    Priority
/dev/sda2                               partition       1702880 75400   3
/dev/sdc2                               partition       8096752 75396   3
/dev/sdd2                               partition       6008300 75508   3


Any idea if this arrangement is good for Suspend to Disk?
As I understand it, S2D requires that the Swap space must be one contiguous space to work properly.
I had always interpreted this to mean a single Swap partition/file had to be of sufficient size for the operation.

This has caused me to wonder if it is possible to use multiple smaller Swap partitions/files to make available sufficient space for the suspend operation.

Any info available appreciated   ;)

regards.

Last I heard the swap designated resume, for use with suspend/hibernation needed to be one contiguous space of sufficient size to hold the data involved. In my case /dev/sdc2 is the one specified as being resume, and is ~8 GB.
Old-Polack

Of what use be there for joy, if not for the sharing thereof?



Lest we forget...

Offline Was_Just19

  • Hero Member
  • *****
  • Posts: 6849
  • MLU
Re: Swap - Size according to usage.
« Reply #14 on: September 28, 2010, 11:07:30 AM »
Swap can use multiple swap partitions, on multiple hard drives, and one can have their priorities set equal, to use them in a striped fashion, similar to raid 0, to speed up the writing to and and recovery of data from them.

[root@littleboy ~]# swapon -s
Code: [Select]
Filename                                Type            Size    Used    Priority
/dev/sda2                               partition       1702880 75400   3
/dev/sdc2                               partition       8096752 75396   3
/dev/sdd2                               partition       6008300 75508   3


Any idea if this arrangement is good for Suspend to Disk?
As I understand it, S2D requires that the Swap space must be one contiguous space to work properly.
I had always interpreted this to mean a single Swap partition/file had to be of sufficient size for the operation.

This has caused me to wonder if it is possible to use multiple smaller Swap partitions/files to make available sufficient space for the suspend operation.

Any info available appreciated   ;)

regards.

Last I heard the swap designated resume, for use with suspend/hibernation needed to be one contiguous space of sufficient size to hold the data involved. In my case /dev/sdc2 is the one specified as being resume, and is ~8 GB.

So although behaving in a striped fashion they will not be 'seen' in that manner, and so that arrangement is no good to get around the requirement .......  if I understand your post correctly.

Oh well!