LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What should be the ideal memory amount for swap? (http://www.linuxquestions.org/questions/linux-newbie-8/what-should-be-the-ideal-memory-amount-for-swap-687007/)

dnskdas 11-29-2008 01:37 AM

What should be the ideal memory amount for swap?
 
Hi members,
This is my first post in this forum. I have a small question. In my institution computer, which is dual booting system with windowsXP, when I have installed fedora core 6 with a memory 2048 MB allocated to swap it seems to be very very slow in response in comparision to the earlier situation when it was allocated to be 1024 MB although in the earlier case total memory allocated for LINUX was also less. This time it is in total 36 GB, out of which I have allocated 512 MB to /boot, 10000 MB to /root, 2048 MB to <swap> and rest to /usr. The RAM is 256 MB. Is the sluggishness due to the memory allocation problem or something else ? Windows XP is running with normal speed.
-SKD

acid_kewpie 11-29-2008 01:53 AM

256mb is probably the main reason it's horrible, certainly the disk space is completely irrelevant, and actual amount of swap shouldn't matter. run "free -m" to show the current usage of memory, the more swap being used, the slower your system is going to run.

Tinkster 11-29-2008 01:53 AM

Hi,

And welcome to LQ!

More than twice the amount of RAM for swap is unusual,
to say the least. But I can't imagine it being more
sluggish with 2048 than it was with 1024 (unless you
were experiencing many OOM-killers with the smaller
SWAP)....

Of course, I've got no idea what FC's memory requirements
are at all ...


Cheers,
Tink

bapigoo9 11-29-2008 07:55 PM

Quote:

The RAM is 256 MB
Not that much RAM. What kernel are you running on your computer? It would be intereting to see what your swap usage is during running Linux. Does your distro have usage graphs?

claudius753 11-29-2008 08:14 PM

With only 256 MB of RAM, you may want to try a lighter distro such as puppy or at least switch to a lighter desktop such as Xfce instead of Gnome (Fedora default) or KDE. That should give you a nice speed boost.

thorkelljarl 11-29-2008 08:41 PM

You might also try opening a terminal and running "top", perhaps first running "man top" to get an idea what top shows.

There are lighter window managers, but puppy or vectorlinux or some other built for small capacity or older systems might give better results.

mohaas05 11-29-2008 09:05 PM

The general rule of thumb for swap is twice your RAM. So if you have 256Mb of RAM, assign 512MB for swap.

And don't be discouraged by the amount of RAM. I run GNOME just fine on 256MB and it runs quite well, even with basic compositing. KDE however, is another story.

Quakeboy02 11-29-2008 09:27 PM

Quote:

Originally Posted by mohaas05 (Post 3359164)
The general rule of thumb for swap is twice your RAM. So if you have 256Mb of RAM, assign 512MB for swap.

And what if you need to run a program that takes up 769MB of memory space? There is no cut and dried answer for how much swap space, though it is clearer with smaller memory footprints and slow processors. Still, it depends on what you're going to use the machine for. I would question the decision to run 256MB on a machine with this much disk storage. Memory is too cheap, anymore, to diddle around with 256MB of RAM; unless you're pretty sure that's all you'll need. In which case, you'd already know what your swap requirements would be.

The important thing to remember about swap is that it's slow: bone crushingly, boringly, bang your head against the wall slow. If your machine is swapping, the answer is not likely to be to add more swap space.

Tinkster 11-29-2008 11:16 PM

Quote:

Originally Posted by Quakeboy02 (Post 3359179)
And what if you need to run a program that takes up 769MB of memory space?

With 256MB RAM "running" a program that needs 769 is
wishful thinking ... crawling (grinding?) may describe
it, personally I'd stay clear of the program ;}

Quakeboy02 11-30-2008 12:08 AM

Quote:

Originally Posted by Tinkster (Post 3359212)
With 256MB RAM "running" a program that needs 769 is
wishful thinking ... crawling (grinding?) may describe
it, personally I'd stay clear of the program ;}

That was kinda the point of my whole diatribe. Desktop machines using a lot of swap equals misery. It doesn't matter whether it's 2 times RAM or 1 times RAM, it's still misery. We just don't do the sort of things on our desktop that they were doing when this 2 times RAM rule of thumb was the mainstay.

Hern_28 11-30-2008 12:44 AM

Lots of ram requirement.
 
Running a laptop with 196megs ram and a 256meg swap. Running something that uses that much memory on the laptop would grind it to a halt ( 400mhz processor + 196 ram and slow hard drive ) but if i need to recompile openoffice or something i just create a temporary file for swapping.

Laptop runs genome ( stripped ) or kde full pretty well.

Basically if you now that you need more swap then make it a little bigger than the normal 2xmemory. If you only need lotsa ram occasionally would just create a temporary swap and use that too till you finish. If this doesn't get your system where you want it could try a lighter distro or strip down the one that you are using.

ugge 11-30-2008 02:38 AM

Just for comparision, your RAM is about a thousand times faster than your harddisk.

salasi 11-30-2008 04:04 AM

Quote:

Originally Posted by Quakeboy02 (Post 3359245)
Desktop machines using a lot of swap equals misery. It doesn't matter whether it's 2 times RAM or 1 times RAM, it's still misery. We just don't do the sort of things on our desktop that they were doing when this 2 times RAM rule of thumb was the mainstay.

It is not necessarily the case that "using a lot of swap equals misery".

What equals misery, to use your phrase, is having lots of traffic to and from swap, so, in the case that you have several programs that are primarily held inactive in the background, the use of some swap may not be that bad for the performance of the apps that are in the foreground. (Not exactly good either, just not causing an appreciable additional slowdown.)

Of course, the performance will decrease when you have to get things back from swap, but there are special cases in which this can be easily tolerable.

But I agree with the general thrust of this thread that the rule of thumb for swap, back from the days in which 8 M of ram was an expensive thing, and the only people who had 16 were doing really high powered stuff (albeit slowly), is just useless these days.

If the OP really wants help in getting the computer to run more smoothly (as oppsed to just getting random "Well now I now what I should of done so that Linux would be faster than Windows, as it should be" excuses) then there will have to be real information here; as mentioned, a 'top' result would be a good start, as would some information on what you are trying to do and info on what/when exactly it runs slowly.

dnskdas 12-07-2008 04:22 AM

Thank you guys for all of your response. I actually have been very busy with some training work and presently out of station. I would analyse the situation after returning. I know that 256 MB RAM is not good and using a high memory demanding software is difficult with it. Actually I wanted to know that whether it becomes slower by just allotting more space to SWAP. At my home Ihave 512 MB RAM and it is working fine even on KDE desktop. Here I have allocated 1024 MB to SWAP.
-SKD


All times are GMT -5. The time now is 06:36 AM.