Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 22 Dec 2014, 20:21
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Linux swap partition
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [30 Posts]   Goto page: 1, 2 Next
Author Message
RussA


Joined: 02 Dec 2005
Posts: 27
Location: New Jersey, USA

PostPosted: Fri 29 Dec 2006, 09:40    Post subject:  Linux swap partition
Subject description: Does size matter?
 

No matter what they say it does. I was just wondering if there is a rule of thumb. Is there a min, max, fixed size, or is it proportional to ram.

Thanks,
Russ
Back to top
View user's profile Send private message 
JohnMc

Joined: 07 Apr 2006
Posts: 118

PostPosted: Fri 29 Dec 2006, 11:16    Post subject: old rule  

When I was an young sys admin back in the 80's the general rule was that a swap file should be no less than 1/4th the size of the main ram size. But those were days when ram was very expensive and disk packs the same.

With PCs and commodity pricing for drives what's it matter? If I build a Puppy box for HD install I just build 1- 1gb partition for swap and let it be finished. Smallest HD I find around the house right now is a 10GB drive. Small triffle to pay to just not fret about it. Wink
Back to top
View user's profile Send private message 
RussA


Joined: 02 Dec 2005
Posts: 27
Location: New Jersey, USA

PostPosted: Fri 29 Dec 2006, 11:54    Post subject:  

Thanks John, I agree. I was just thinking from a performance perspective.

Russ
Back to top
View user's profile Send private message 
Sage

Joined: 04 Oct 2005
Posts: 4833
Location: GB

PostPosted: Fri 29 Dec 2006, 12:08    Post subject:  

Yes! Traditionally, 'doze uses a variable swap size, which it mixes with your regular files (where do they get these guys?!), but never more than twice the main RAM. All the major distros observe the same [2 x main] formula by default. From experiment, I have found that a maximum swap size equal to main memory is a good solution for Puppy provided:
a) not running excessively large apps or several large ones simultaneously
b) maximum of 256Mb swap for x86 single core cpu
c) for machines with very low memory, eg 48Mb, try to restrict swap space to one or 1.25x main, regardless. If apps won't run under these conditions, change the HW, eg add RAM, if possible. Even quite small swap space (<main) is worth installing on ancient kit with low resources.
Although we've had several detailed discussions about this subject previously (SEARCH), some correspondents are plain wrong, some lack practical experience and others provide theoretical background. What I say is based on solid practical experimentation. Overdo the swap space and you risk thrashing your HD to an early demise. You will have the pleasure of listening to this process.
Like everything else, there are exceptions, but sticking to the above is the best expedient unless one is very skilled in the art.
One interesting exception is to provide a (probably very old) small HD as swap only when running as a live CD. A 210Mb drive seems ideal and speeds things along nicely. Don't forget to format it. Even better would be to recycle an ex-laptop 2.5" unit of similar capacity - small, quiet, cool and modest power demand.
Back to top
View user's profile Send private message 
RussA


Joined: 02 Dec 2005
Posts: 27
Location: New Jersey, USA

PostPosted: Fri 29 Dec 2006, 13:33    Post subject:  

Thanks Sage,
Just what I was looking for, I noticed the swap partition makes a big difference. I’m kind of the go to guy when friends and family need their pc’s fixed. A fresh Puppy boot disk sure cuts down on the tech support time and calls. Smile

Russ
Back to top
View user's profile Send private message 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: Fri 29 Dec 2006, 14:09    Post subject:  

Sage is right on the money.

Swap is not meant to be used as RAM, but as "emergency" RAM. If you end up using it as much as RAM your computer will be so inefficient it will be practically useless.

I think that the rules of Swap size based on RAM size or HDD size are missleading. I think it's better to think of it based on, guess what: Swapping.

In my job as performance and capacity manager, one of the measurements we use as an indicator of the system Capacity is the ratio between Page input/Sec and RAM utilization. Optimally a system would have a high RAM utilization with minimal Page input/Sec. meaning that it has all the data it needs in real RAM and does not need to use swap at all.

If you have low memory (in relation to the apps you are using)

Even if you have multiple applications loaded If only use one application at a time, your ratio may be low as you would not be swapping too frequently. In that case It would be OK to have a larger Swap than memory as you'll have there the applications that you are not currently using and your RAM would be mostly used for the application you are using so here size matters.

If you are switching too frequently between applications, your ratio may be high as you would be swapping every time you switch to a different application. There your performance would be bad regardless of the size of the Swap partition, so size does not matter at all.

So the size of the Swap depends on how you use your computer. I guess that the only rule of thumb here is that you should use your computer according to its capacity.

Think of Swap as emergency RAM not as dynamically usable RAM. My favourite analogy is a work table (RAM) and drawers (Swap).

- If you are just writing one paper at a time, the size of the table does not matter, you can keep the rest of the papers on the drawers until you need them.

- If you are preparing your taxes youbetter have a large table or you will be wasting time taking the papers in and out of the drawers.

So size your Swap according to the usage and plan the usage according to the amount of RAM.

How to know if you are over taxing your computer? play by ear. literally. If you hear your HDD trashing constantly that means that your computer is constantly swapping. If you don't hear your HDD trashing constantly but every now and then you run out of memory, then increase the size of the Swap.

Or as Sage sugested, be generous with the Swap size and if you hear your HDD trashing constantly then either change your usage patterns (don't switch frequently between apps) or increase RAM.

_________________
http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
Back to top
View user's profile Send private message Visit poster's website 
Yaverot


Joined: 21 Dec 2005
Posts: 93

PostPosted: Fri 29 Dec 2006, 14:14    Post subject:  

Thank you Sage, the "right amount of swap" is a hard question to find good answers to, Windows or Linux. I have (someplace) a couple articles that basically say "You have to determine the correct amount of swap space, since it depends on what you do with your system how much RAM etc." With part 2 being "Here are the tools, how to use them & how to run the tests". They're for 9x era Windows.

It seams weird to me that the rule is "twice your RAM" in most cases. Isn't the point of buying more RAM so that you aren't using as much swap (swap being incredably slow in comparison to RAM). At some point you may be more demanding on your system and then need to increase swap/buy more RAM. But how often do you get "out of RAM" warnings? How much more often do you get "out of drive space"?

I can think of three times I've had to deal with a RAM limit:
1. attempting to load a mouse & netcard driver under DOS & use a program that wanted 620k of conventional RAM (ie ignoring everything above 640k, like that 2nd MB).
2. recently I was building gcc in a virtual machine. because I forgot the swapon command and I set the machine up with little ram.
3. Bootable CDs (puppy, gnewsense, freenas) that aren't always clear on how much ram they need to boot. Some are easier to find that info than others.

So having real numbers (with reasons) is a great help.

_________________
There is a yellow one that won't accept the black one
That won't accept the red one that won't accept the white one
And different strokes for different folks
Back to top
View user's profile Send private message Visit poster's website 
WhoDo


Joined: 11 Jul 2006
Posts: 4441
Location: Lake Macquarie NSW Australia

PostPosted: Fri 29 Dec 2006, 17:58    Post subject:  

I'm with Sage and rarsa on this, but I'd like to make a couple of small but important points:
    1. Puppy is designed to load and run on older, ram-challenged PC's so swap IS an issue that can't always be avoided by simply adding RAM - of course the latter is the better choice, wherever possible.
    2. For Puppy, 1x or 2x RAM is acceptable; usually 1x above 128Mb and 2x below that but never more than a maximum of 256Mb - Puppy is highly unlikely to use any more than that amount. If it does, get more RAM or a new PC or both.
    3. Big swap partitions are a waste of space and may be injurious to the health of an older drive.
    4,. For the average user, if you have 512Mb RAM or more your swap partition is superfluous in Puppy, and most other distros. It simply won't ever be used so why waste the space?

Hope that helps.
Back to top
View user's profile Send private message 
PaulBx1

Joined: 16 Jun 2006
Posts: 2308
Location: Wyoming, USA

PostPosted: Fri 29 Dec 2006, 20:31    Post subject:  

One final point: if you are thinking about using an encrypted pup_save, the only current workable solution (see the encryption threads) does not encrypt swap, which means anything you want to keep private may end up in cleartext on your swap partition. This is a gaping security hole. Smile

Solution is to turn swap off entirely. This obviously pushes people in the direction of adding more ram...

Some day we may have an encryption solution that includes swap, but it will probably be a while.
Back to top
View user's profile Send private message 
rcrsn51


Joined: 05 Sep 2006
Posts: 9376
Location: Stratford, Ontario

PostPosted: Sat 30 Dec 2006, 09:47    Post subject:  

Here is some data to confirm Sage's point. On a machine with 128 MB of memory and no swap partition, Puppy automatically created a 100 MB swapfile. When I ran the 'free' command, about half of the swap memory would be in use, but there was never a lot of hard drive thrashing. I then added another stick of memory for a total of 256 MB. Now the swap memory is rarely used at all, even with several applications open. For the average user, Puppy seems to be pretty good at determining its swap memory needs.
Back to top
View user's profile Send private message 
JohnMc

Joined: 07 Apr 2006
Posts: 118

PostPosted: Sat 30 Dec 2006, 11:22    Post subject: OT  

In our environment here @ work we had 250,000 pc's all running some version of Windows. Practically all of them are ghosted. We have toyed with the idea that switching to some version of linux as the costs for Vista are too steep. Looking at the variety of ways we use all this compute power the concensus was a 1Gb swap. It will end up being a goldilocks kind of story with maybe 25% of the machines being mismatched.

But our bigger problem from a corporate perspective is the labor. It costs too much to tweak each machine. So if we do this we will clone them to a base and only tweak critical machines based on exceptions.

At a personal level, I use a corporate laptop with puppy (CD/usb setup). It's got 1Gb of memory in it. In puppy mode? It runs like a solid state machine and the HD never spins it seems. In WinDoz mode? I can hear the hard drive spin as needed. Which is often.

Would I be able to get management to go to puppy? Probably not. Crying or Very sad
Back to top
View user's profile Send private message 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: Sat 30 Dec 2006, 14:50    Post subject: Re: OT  

JohnMc wrote:
Would I be able to get management to go to puppy? Probably not. Crying or Very sad
Would it be even advisable? absolutelly not. Is it desirable? I don't think so.

As much as I like Puppy for what I do, it is not a "one size fits all".

(I know that John knows but for the rest ...) Corporations require enterprise wide management applications such as directory services, remote ghosting, sw/hw inventory discovery, SMS push, different network protocols, etc.

For the people that complain that the "big distros" are too bloated, It may just be that they are on the "one size fits all" mentality. SE linux and firewalls and directory services are a must in some environments, rarelly they are required at home.

_________________
http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
Back to top
View user's profile Send private message Visit poster's website 
CatmanDru

Joined: 07 Sep 2006
Posts: 91
Location: OR, USA

PostPosted: Tue 30 Jan 2007, 16:18    Post subject:  

Thanx for the very good, detailed and informative discussion/info on swap partition size. I would like to bring up a few ideas so others can give feedback. Please bear in mind these are for users who dont mind a little, or a lot of, complexity. Also please remember that I, and others, use 'old' computers and squeezing more efficiency is worth a bit of effort.

1. One is the idea of using a few 'small' multiple swap partitions spread accross the disc surface. A regular poster mentioned that in some situations (uses of computers) this results in better performance. I think the situation involved small, frequent swaps combined with frequent access to non-swap partitions and maybe non-sequential data. One general point was to reduce the time & physical space the HD heads needed to move to get to a swap partition thereby increasing performance. a) What would the use conditions be that would make small, multiple swaps advantageous? b) How advantageous would this setup be?

2. What do people think of the idea of having 2 swap partitions for different needs and just mounting/unmounting as needed. The 'default' swap for most common use is/would be autoloaded if it is the first on the drive*. The second swap, or both, could be mounted when appropriate for the computer's less common uses or 'styles of use'. For example a bare-minimum size swap to decrease drive access/thrash (and increase performance?). Another swap could be mounted to make a larger total swap space when running excessively large apps or several large ones simultaneously.

Im interested in part because on this machine when setting up the hard drive i was reading conflicting information about swap size and was having trouble deciding but I just wanted to set it up so i made 2 swap partitions (200 & 300) which i figured i could play/experiment with and later modify into less swap(s) or swap and an additional OS partition. It seemed less problematic to start large and later shrink than to start small and later resize partitions Shocked to make more swap space.

*personal experience.

Last edited by CatmanDru on Tue 30 Jan 2007, 17:21; edited 2 times in total
Back to top
View user's profile Send private message 
rarsa


Joined: 29 May 2005
Posts: 3053
Location: Kitchener, Ontario, Canada

PostPosted: Tue 30 Jan 2007, 16:26    Post subject:  

I'd say that if in your environment you are worried by swap performance, then Puppy is probably not the distro for you.
_________________
http://rarsa.blogspot.com Covering my eclectic thoughts
http://www.kwlug.org/blog/48 Covering my Linux How-to
Back to top
View user's profile Send private message Visit poster's website 
Gn2


Joined: 16 Oct 2006
Posts: 936
Location: virtual - Veni vidi, nihil est adpulerit

PostPosted: Tue 30 Jan 2007, 19:28    Post subject:  

I strongly concur with Rarsa's assessment:

A = Taylor size to proven need

B - Be just as cognizant of placement of all partitions, Esp Swap (drive head movement - seek, read/write In/out times)

C- Be aware that for temp use -swap files may be created, deleted
as need arises.

D - Strongly advise (for those with proven need only)
Use TMPFS & set niceness factor !

E - Use of a larger ( than required) Swap partition will NOT cause hard drive thrashing !

That ONLY occurs if physcial RAM is insufficient and tasks are VERY memory intensive.

In summation:
Use of tmpfs dynamically sizes space needs > pages in/out only portions, upon load demand from user syscall interupts.

Puppy is NOT a recommended plalform for those user requirements.
Puppy would not be a suitable match for many other .... just as relevant considerations under those circumstances.
> It doesn't (default include) other utilities, equally as important
to tasking involved.

Frequently that scenario will involve EVMS, quotas and shared resources - &/or remote administration, team Mgt.
Example : I habitually create three 2GIG swap partitions, toggle on/off as need arises

However, my physical RAM is large enough -& tested under abnormally LARGE simultaneous copy loads -
And while concurrently backgrounding (man nice) compiling of large Apps - the CPU often hits sustained 98% load factors - swap still not used.

= Puppy is ill suited platform for non-common usage.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [30 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1028s ][ Queries: 12 (0.0042s) ][ GZIP on ]