IntelliJ Java IDE
The moose likes General Computing and the fly likes What's optimal swap/virtual memory size? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » General Computing
Reply Bookmark "What Watch "What New topic
Author

What's optimal swap/virtual memory size?

Rafael Lee
Greenhorn

Joined: Sep 06, 2003
Posts: 23
I have a 10 gig laptop with virtual/swap setting (by windows) at 2 gig. Should the swap really this big? I have increased RAM to 512 MB. What are conditions to lower or increase the swap size?
Oftentimes I find my hard disk running (LED lighting) continuously, and meanwhile seem to make some programs run slightly slower (although still tolerable). I don't know if swap size has something to do with this. Lately I've been limiting HD usage to 70% (around 3 gig free) but the situation still persists.
Gregg Bolinger
Sheriff

Joined: Jul 11, 2001
Posts: 15040

I am sure it is not the same in Windows and Linux, but I know Linux typically wants it's SWAP to be the same size as the amount of RAM you have to be the most optimal.
I am not sure why Windows would require a 2 gig swap space except for the pure fact that it is Microsoft and they know nothing of optimization and performance.


My Blog | DZone Articles
Gregg Bolinger
Sheriff

Joined: Jul 11, 2001
Posts: 15040

I just looked at my Laptop that has XP on it. I have a 40 gig HD and 256 MB RAM and my SWAP size is 384 MB. Did you manually set yours to 2 GIG?
Ashok Mash
Ranch Hand

Joined: Oct 13, 2000
Posts: 1936
I am assuming that you are refering to Virtual memmory here, and for a machine running Windows, with 512MB RAM, generally advised swap size is 512MB to 1024MB.
My box has 512MB RAM and its using about 765 MB of 1024 MB set aside for it. Also another quick tip is to set this virtual memory in a partition other than where Windows is installed.
HTH.


[ flickr ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I always thought a swap file that was 1.5x the memory was god, but someone stressed you needed 2.5x. I tend to average it out at 2x.
I always set this to a fixed swap size then use a swap file defragger to place it in one continuous file. Personally I think this would have a greater impact than trying to optimise the file size, and this advice is based on absolutely no proof at all
Dave


[ JavaRanch FAQ ][ Book Promotions ][ DbTamer ][ BumperStickers ][ JavaRanch Badges ]
Anupam Sinha
Ranch Hand

Joined: Apr 13, 2003
Posts: 1088
A fixed size swap file is a better idea as it will not create any fragmentation.
Rafael Lee
Greenhorn

Joined: Sep 06, 2003
Posts: 23
<quote from Gregg>
I just looked at my Laptop that has XP on it. I have a 40 gig HD and 256 MB RAM and my SWAP size is 384 MB. Did you manually set yours to 2 GIG?
</quote>
No, it seemed to be default. I'll try to experiment on reducing it to a fixed 1.5x-2x factor, which seem to be the average from the responses
Thanks to all.
 
 
subject: What's optimal swap/virtual memory size?
 
Threads others viewed
Box running out of memmory and tomcat doesn't use swap
memory arguments to prevent OOM exception
Problem running weblogic 8.1 on Vmware win2000
Maximum Ram on 64 bit ubuntu
INIT: id "x" respwaning too fast- disabled for 5 minites
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture