Skip to contentSkip to conversation

2.4 VM & swap question

DISCUSSION Tom Rini 4 participants 8 messages Jun 17, 2001

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

'lo all. I've got a question about swap and RAM requirements in 2.4. Now, when 2.4.0 was kicked out, the fact that you need swap=2xRAM was mentioned. But what I'm wondering is what exactly are the limits on this. Right now I've got an x86 box w/ 128ram and currently 256swap. When I had 128, I'd get low on ram/swap after some time in X, and doing this seems to 'fix' it, in 2.4.4. However, I've also got 2 PPC boxes, both with 256:256 in 2.4. One of which never has X up, but lots of other activity, and swap usage seems to be about the same as 2.2.x (right now 'free' says i'm ~40MB into swap, 18day+ uptime). The other box is a laptop and has X up when it's awake and that too doesn't seem to have any problem. So what exactly is the real minium swap ammount?

Signature · 2 lines
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
#1 lore raw
Quoted 11 lines · Tom Rini

'lo all. I've got a question about swap and RAM requirements in 2.4. Now, when 2.4.0 was kicked out, the fact that you need swap=2xRAM was mentioned. But what I'm wondering is what exactly are the limits on this. Right now I've got an x86 box w/ 128ram and currently 256swap. When I had 128, I'd get low on ram/swap after some time in X, and doing this seems to 'fix' it, in 2.4.4. However, I've also got 2 PPC boxes, both with 256:256 in 2.4. One of which never has X up, but lots of other activity, and swap usage seems to be about the same as 2.2.x (right now 'free' says i'm ~40MB into swap, 18day+ uptime). The other box is a laptop and has X up when it's awake and that too doesn't seem to have any problem. So what exactly is the real minium swap ammount?

It completely totally and absolutely depends on the kind of workloads you put your system under.

I have a database server with 1G phys and 1G swap. It uses 950+ MB for cache, as it should, and doesn't even *touch* swap. This is 2.4.5.

I have another box with 384MB phys and 1G swap, and it's usually a few hundred megs into swap. That's what long-running memory hogs and big compilers do.

There is no simple answer. swap = 2*phys may be reasonable for some desktop uses, I don't know. But there *is* *no* *simple* *answer*.

With the amount of work that's gone into just *understanding* why the VM behaves as it does (even after the VM rewrite that was done exactly in order to come up with a VM we could *understand*), it's beyond me how anyone can even begin to think that one can define a set of simple and exact rules for minimum or "optimal" (whatever that means) values for swap.

(if I sound pissed, don't worry, I'm not. I'm frustrated, that's different ;)

Signature · 6 lines
................................................................
:   [email protected]   : And I see the elder races,         :
:.........................: putrid forms of man                :
:   Jakob Østergaard      : See him rise and claim the earth,  :
:        OZ9ABN           : his downfall is at hand.           :
:.........................:............{Konkhra}...............:
author
#2 lore raw
In reply to Tom Rini
Quoted 13 lines · Jakob ?stergaard
Quoted 11 lines · Tom Rini

'lo all. I've got a question about swap and RAM requirements in 2.4. Now, when 2.4.0 was kicked out, the fact that you need swap=2xRAM was mentioned. But what I'm wondering is what exactly are the limits on this. Right now I've got an x86 box w/ 128ram and currently 256swap. When I had 128, I'd get low on ram/swap after some time in X, and doing this seems to 'fix' it, in 2.4.4. However, I've also got 2 PPC boxes, both with 256:256 in 2.4. One of which never has X up, but lots of other activity, and swap usage seems to be about the same as 2.2.x (right now 'free' says i'm ~40MB into swap, 18day+ uptime). The other box is a laptop and has X up when it's awake and that too doesn't seem to have any problem. So what exactly is the real minium swap ammount?

Quoted 2 lines

It completely totally and absolutely depends on the kind of workloads you put your system under.

Well, yes. :) But 2.4.x is much more swap-happy then 2.2.x was. I haven't changed my workload that much but the 256 swap became noticiably needed recently.

Quoted 2 lines

There is no simple answer. swap = 2*phys may be reasonable for some desktop uses, I don't know. But there *is* *no* *simple* *answer*.

Yes. The problem is the requirement has seemingly doubled recently.

Quoted 5 lines

With the amount of work that's gone into just *understanding* why the VM behaves as it does (even after the VM rewrite that was done exactly in order to come up with a VM we could *understand*), it's beyond me how anyone can even begin to think that one can define a set of simple and exact rules for minimum or "optimal" (whatever that means) values for swap.

Well, it's also been said that the 'need' for 2xswap was fixed by one of the probably-not-yet-in-linus'-tree VM patches. And that it's 'artificial'

Signature · 2 lines
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
#3 lore raw
In reply to Tom Rini
Quoted 11 lines · Tom Rini

'lo all. I've got a question about swap and RAM requirements in 2.4. Now, when 2.4.0 was kicked out, the fact that you need swap=2xRAM was mentioned. But what I'm wondering is what exactly are the limits on this. Right now I've got an x86 box w/ 128ram and currently 256swap. When I had 128, I'd get low on ram/swap after some time in X, and doing this seems to 'fix' it, in 2.4.4. However, I've also got 2 PPC boxes, both with 256:256 in 2.4. One of which never has X up, but lots of other activity, and swap usage seems to be about the same as 2.2.x (right now 'free' says i'm ~40MB into swap, 18day+ uptime). The other box is a laptop and has X up when it's awake and that too doesn't seem to have any problem. So what exactly is the real minium swap ammount?

I doubt there is a limit. I think 'it depends on what you're planning to do' is the correct answer. For a blank router, 32mb ram/64 swap can be enough, for a web/database server, you need more, etc.

author
#4 lore raw
In reply to Tom Rini
Quoted 13 lines · Dan Podeanu
Quoted 11 lines · Tom Rini

'lo all. I've got a question about swap and RAM requirements in 2.4. Now, when 2.4.0 was kicked out, the fact that you need swap=2xRAM was mentioned. But what I'm wondering is what exactly are the limits on this. Right now I've got an x86 box w/ 128ram and currently 256swap. When I had 128, I'd get low on ram/swap after some time in X, and doing this seems to 'fix' it, in 2.4.4. However, I've also got 2 PPC boxes, both with 256:256 in 2.4. One of which never has X up, but lots of other activity, and swap usage seems to be about the same as 2.2.x (right now 'free' says i'm ~40MB into swap, 18day+ uptime). The other box is a laptop and has X up when it's awake and that too doesn't seem to have any problem. So what exactly is the real minium swap ammount?

Quoted 3 lines

I doubt there is a limit. I think 'it depends on what you're planning to do' is the correct answer. For a blank router, 32mb ram/64 swap can be enough, for a web/database server, you need more, etc.

Yes, I know there's no hard and fast rule for the exact ammount of ram/swap one needs that will always work. However, in 2.2 for a 'workstation' one could usually quite happily get away with having 128:128 and never have much of a problem. with 2.4.0 and up this isn't the case. This has been the cause of many people complaining quite loudly about 2.4 VM sucking and having lots of OOM kills going about. It's also been called an 'aritificial limit' since one of the VM people had a patch to 'fix' this. What I'm trying to figure out is if this problem exists linearly or just with 'lower' ammounts of total physical ram. ie if I jump up to 512mb and don't have a webserver or database (ie I've got 512mb so I end up with a big disk cache) will I need to have 1gb of swap just to keep the VM happy? Will 256 be enough? Could I even live w/o swap?

Signature · 2 lines
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
#5 lore raw
In reply to Tom Rini
Quoted 4 lines

Yes, I know there's no hard and fast rule for the exact ammount of ram/swap one needs that will always work. However, in 2.2 for a 'workstation' one could usually quite happily get away with having 128:128 and never have much of a problem. with 2.4.0 and up this isn't the case. This has been the cause

Quoted 8 lines

of many people complaining quite loudly about 2.4 VM sucking and having lots of OOM kills going about. It's also been called an 'aritificial limit' since one of the VM people had a patch to 'fix' this. What I'm trying to figure out is if this problem exists linearly or just with 'lower' ammounts of total physical ram. ie if I jump up to 512mb and don't have a webserver or database (ie I've got 512mb so I end up with a big disk cache) will I need to have 1gb of swap just to keep the VM happy? Will 256 be enough? Could I even live w/o swap?

Probably you'd live with 512MB of swap. As for w/o swap? You need it atleast to hear the disks trashing and know you have to ctrl-c the damn process, if not anything else.

I have:

spiral:~# free
             total       used       free     shared    buffers     cached
Mem:        254572      89936     164636          0       4352      48016
-/+ buffers/cache:      37568     217004
Swap:       530136          0     530136

With X, netscape and a gcc running and doing quite fine.

author
#6 lore raw
In reply to Tom Rini
Quoted 13 lines · Dan Podeanu
Quoted 4 lines

Yes, I know there's no hard and fast rule for the exact ammount of ram/swap one needs that will always work. However, in 2.2 for a 'workstation' one could usually quite happily get away with having 128:128 and never have much of a problem. with 2.4.0 and up this isn't the case. This has been the cause

Quoted 8 lines

of many people complaining quite loudly about 2.4 VM sucking and having lots of OOM kills going about. It's also been called an 'aritificial limit' since one of the VM people had a patch to 'fix' this. What I'm trying to figure out is if this problem exists linearly or just with 'lower' ammounts of total physical ram. ie if I jump up to 512mb and don't have a webserver or database (ie I've got 512mb so I end up with a big disk cache) will I need to have 1gb of swap just to keep the VM happy? Will 256 be enough? Could I even live w/o swap?

Quoted 1 line

Probably you'd live with 512MB of swap.

Seeing as 256:256 seems to be doing fine on my other two machines, yes, it might. But since I'd repartition too (I hate swapfiles) I'd like to do it once and be done with it. I'd also like to know what exactly causes the original problem (Like I said, my workload hasn't changed nor my programs that much. And w/ twice my swap I get the same swap usage I used to get in 2.2/late 2.3..)

Signature · 2 lines
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
#7 lore raw
In reply to Tom Rini
Quoted 2 lines · you

I have a database server with 1G phys and 1G swap. It uses 950+ MB for cache, as it should, and doesn't even *touch* swap. This is 2.4.5.

I thought the new rule is:

	total_memory = max(physical, swap);

And the old rule was:

	total_memory = physical + swap;

Hence under a 1G physical and 1G swap setup, the kernel would never access swap.

Is this the case, or am I a couple of megabytes short in my understanding of things?

Al