Author Topic: WHats your Swap Size?  (Read 1124 times)

Master of Reality

  • VIP
  • Member
  • ***
  • Posts: 4,249
  • Kudos: 177
    • http://www.bobhub.tk
WHats your Swap Size?
« Reply #15 on: 11 November 2002, 20:52 »
quote:
Originally posted by void main:


Having the swap on the least utilized drive would be best as you have it. I'm not sure if spreading the swap out across a utilized drive and a non-utilized drive would increase or decrease the performance. I guess it would depend on how utilized the drive is, but I am not sure of the logic that the kernel uses. I believe it to be much like RAID striping if using more than one swap partition at the same priority, but not sure.


mine is on the least utilized drive.. but the boot partition is also on that drive so it may not be as fast while booting (if while booting it uses the swap).
Disorder | Rating
Paranoid: Moderate
Schizoid: Moderate
Linux User #283518
'It takes more than a self-inflicted gunshot wound to the head to stop Bob'

DC

  • Member
  • **
  • Posts: 211
  • Kudos: 0
WHats your Swap Size?
« Reply #16 on: 12 November 2002, 00:16 »
I have 512MB physical RAM and 500-or-so MB swap (on the main 40 GB drive, the other one is less used but older/slower).

I always thought swap wasn't used in Linux unless it's needed, so it wouldn't slow stuff down, which explains that swap usage tends to stay low (almost always 0, rises to ~10MB during heavy disk usage like copying 5GB partitions).

Windows is different - it always seemed to use at least 150 swap.

[ November 12, 2002: Message edited by: DC ]

GS/CS d- s-: a--- C++ UL+ P+ L++>+++ E W++ N>+ o K- w-- O- M V? PS+>++ PE- Y+ PGP t+ 5+ X R tv+ b+++ DI+ D+ G++ e>++++ h! r- y
A quantummechanical wavefunction describing an unknown amount of bottles of beer on the wall
A quantummechanical wavefunction describing an unknown amount of bottles of beer on the wall
We take a measurement, the wavefunction will collapse, and one of the bottles of beer will fall

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
WHats your Swap Size?
« Reply #17 on: 12 November 2002, 01:38 »
quote:
Originally posted by The Master of Reality / B0B:

mine is on the least utilized drive.. but the boot partition is also on that drive so it may not be as fast while booting (if while booting it uses the swap).



You shouldn't be getting into swap while booting and the only thing the /boot partition for is the kernel which is loaded only in the earliest stage of the boot. This layout should have no effect on boot time.
Someone please remove this account. Thanks...

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
WHats your Swap Size?
« Reply #18 on: 12 November 2002, 01:48 »
quote:
Originally posted by DC:
I have 512MB physical RAM and 50-or-so MB swap (on the main 40 GB drive, the other one is less used but older/slower).

I always thought swap wasn't used in Linux unless it's needed, so it wouldn't slow stuff down, which explains that swap usage tends to stay low (almost always 0, rises to ~10MB during heavy disk usage like copying 5GB partitions).

Windows is different - it always seemed to use at least 150 swap.



I believe you have less swap than what you should have. I think you want at least 128MB but very possible 512MB of swap as the minimum. And swap space is there to help speed things up, not slow them down. Without swap space, RAM can not be used for efficient caching.

I also have 512MB of RAM and 512MB of swap. At this second I am showing ~65MB of RAM free, and ~56MB of swap used. I certainly don't have 450MB of program code running. A lot of my RAM is being used for caching which makes things faster. Some memory has been paged out to swap because it isn't being used so there is more RAM available for cache. At least that's the way I understand how the swap works. Add more swap and let your system do it's magic.
Someone please remove this account. Thanks...

LAGMAN

  • Newbie
  • *
  • Posts: 3
  • Kudos: 0
    • http://none at the moment
WHats your Swap Size?
« Reply #19 on: 12 November 2002, 13:57 »
I got 512MB of ram. and a 256MB swap, I never have seen the swap touched. most people will call me dumb for not doing the "unwritten swap drive rule." but hell, thats 768MB more space on my 30GIG I can put porn on! YAY!
Ever notice how dumb most network admins are? I dunno weather to laugh or cry.

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
WHats your Swap Size?
« Reply #20 on: 12 November 2002, 14:33 »
Yeah, and not having optimum performance is better for looking at porn anyway. The slower the better.  
Someone please remove this account. Thanks...

Calum

  • Global Moderator
  • Member
  • ***
  • Posts: 7,812
  • Kudos: 1000
    • Calum Carlyle's music
WHats your Swap Size?
« Reply #21 on: 12 November 2002, 14:52 »
well my swap space is 178Mb i think, or thereabouts, against 128Mb of RAM. I put the swap partition right at the edge of the hard drive, as per X11's advice (faster access times apparently).

Something bottlenecks inside my computer though, i don't know if it's the bus speed or the chip's internal speed or what, but something makes it transfer data slowly, and open up programs slowly. It just does things slowly for an 850Mhz computer. but that's another discussion. (and before a windoid should chime in, it behaves at least as slowly using windows)
visit these websites and make yourself happy forever:
It's my music! | My music on MySpace | Integrational Polytheism

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
WHats your Swap Size?
« Reply #22 on: 12 November 2002, 14:59 »
In your case you should probably would want a little more swap since you only have 128MB. 256MB should have been about right. Now I'm not saying that this will make your system twice as fast because I don't think it will. What are your readings from a few successive runs of this:

# /sbin/hdparm -t /dev/hda
Someone please remove this account. Thanks...

Calum

  • Global Moderator
  • Member
  • ***
  • Posts: 7,812
  • Kudos: 1000
    • Calum Carlyle's music
WHats your Swap Size?
« Reply #23 on: 12 November 2002, 15:09 »
i'll post tomorrow, not at home right now - posting from windows 2000 computer at work!  :(
visit these websites and make yourself happy forever:
It's my music! | My music on MySpace | Integrational Polytheism

Calum

  • Global Moderator
  • Member
  • ***
  • Posts: 7,812
  • Kudos: 1000
    • Calum Carlyle's music
WHats your Swap Size?
« Reply #24 on: 13 November 2002, 02:00 »
quote:
[root@localhost calum]# which hdparm
which: no hdparm in (/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin)
[root@localhost calum]#

i'll have to look for it on my install CDs, so bear with me please!  

[ November 12, 2002: Message edited by: [calum@localhost]$ ]

visit these websites and make yourself happy forever:
It's my music! | My music on MySpace | Integrational Polytheism

DC

  • Member
  • **
  • Posts: 211
  • Kudos: 0
WHats your Swap Size?
« Reply #25 on: 13 November 2002, 04:45 »
quote:
Originally posted by void main:


I believe you have less swap than what you should have. I think you want at least 128MB but very possible 512MB of swap as the minimum. And swap space is there to help speed things up, not slow them down. Without swap space, RAM can not be used for efficient caching.

I also have 512MB of RAM and 512MB of swap. At this second I am showing ~65MB of RAM free, and ~56MB of swap used. I certainly don't have 450MB of program code running. A lot of my RAM is being used for caching which makes things faster. Some memory has been paged out to swap because it isn't being used so there is more RAM available for cache. At least that's the way I understand how the swap works. Add more swap and let your system do it's magic.



Err... ooops. No idea how that 0 got lost in that post    (should be 500MB, corrected it)

Swap is not there to speed up things. Swap is there to let you run stuff that you would normally be unable to do due to lack of RAM. RAM can be used for efficient catching without swap - the ONLY case in which you need swap if you need x MB of mem and have x-n RAM (n=positive number). In that case, some mem is paged to disk to free up RAM for programs that need it more. This is SLOW, since disk is about 10000x as slow as RAM, so it can't possibly speed things up.
With enough mem, swap is simply not used and has no effect on the system whatsoever.

Anyway, I have yet to see swap usage go beyond 20 MB. As I said, swap is only used during real intensive usage, and I think it isn't really neccesary even then.
GS/CS d- s-: a--- C++ UL+ P+ L++>+++ E W++ N>+ o K- w-- O- M V? PS+>++ PE- Y+ PGP t+ 5+ X R tv+ b+++ DI+ D+ G++ e>++++ h! r- y
A quantummechanical wavefunction describing an unknown amount of bottles of beer on the wall
A quantummechanical wavefunction describing an unknown amount of bottles of beer on the wall
We take a measurement, the wavefunction will collapse, and one of the bottles of beer will fall

voidmain

  • VIP
  • Member
  • ***
  • Posts: 5,605
  • Kudos: 184
    • http://voidmain.is-a-geek.net/
WHats your Swap Size?
« Reply #26 on: 13 November 2002, 05:04 »
quote:
Originally posted by DC:
Swap is not there to speed up things. Swap is there to let you run stuff that you would normally be unable to do due to lack of RAM. RAM can be used for efficient catching without swap - the ONLY case in which you need swap if you need x MB of mem and have x-n RAM (n=positive number). In that case, some mem is paged to disk to free up RAM for programs that need it more. This is SLOW, since disk is about 10000x as slow as RAM, so it can't possibly speed things up.
With enough mem, swap is simply not used and has no effect on the system whatsoever.



That's what I used to think but it's not true that swap is only there to let you run programs that normally won't fit into memory. RAM is also used for file system caching, etc. Even if you have free RAM the system will swap unused program data to make more room for cache which will speed things up considerably if you do a lot of IO. It is true that if you do not have enough RAM to even hold the program code that you need to run your system will get very slow due to constant paging (and even worse if it is thrashing).

With 512MB of RAM it is very possible that you have enough that no swapping will occur and that is certainly optimal. But I also have 512MB of RAM and I usually have at least 100MB of swap in use. For instance, I just rebooted my desktop a little while ago and now I only have 312MB of my 512MB of physical RAM used and no swap. But last night I had over 400MB used and around 100MB of swap in use because over time things got cached in RAM and getting cache hits are much faster than having to grab things from disk again.

You also need to look at your "cached" and "buffered" stats. As soon as I start doing some more large data tasks more will get cached and some swapping will occur, even if my RAM is not 100% full. It will only swap portions that will not have a detrimental effect on performance (as long as I have enough RAM for that to happen). Making more room in RAM for cache will *increase* performance. Read over the Linux VM logic. Actually, here's a pretty good chapter in a performance tuning book that talks about Linux and Solaris swap setup, swapping and paging:

http://www.oreilly.com/catalog/spt2/chapter/ch04.html

[ November 12, 2002: Message edited by: void main ]

Someone please remove this account. Thanks...