Roger Barnes wrote:


I know that's the standard recommendation one sees for creating swap partitions, but I'm intrigued as to the reasons for your suggestion. How does reducing the swap:ram ratio improve performance? I expect the kernel would be conservative about using swap irrespective of how much there is.



When SWAP space is utilised by the system it is done so by writing snapshots of memory called pages. These pages
are written NOT IN contigous locations within the swap area and as a result when these pages are re-called the
system has to work harder to locate these pages on top of the overhead of the SLOW access of physical disk.
This is exacerbated by increasing the physical area over which the disk heads traversed. This is further exacerbated
if you SWAP SPACE resides in the same disk as your busy files.


The system is always looking for data in an area where data is fragmented. As the area of the SWAP space becomes
bigger this problem is even more exacerbated. This performance loss with big SWAP space becomes apparent as
DRAM becomes faster-and-faster but disk storage technology is not keeping up proportion-wise.


Some 20 years ago it does not matter even if one has large swap space because RAM speeds are not so much faster
than disk access speed.


I just say 1-to-1 mem-to-swap ratio because that is the rule-of-thumb recommendations. When I tune systems under my
control I try to allocate as little SWAP as I can get away with without making a system thrash. If you do not have software
with memory leak you will almost certainly have a buzzing system.


Secondly, by default i386 systems, which I assume your systems is, will only be able to utilize a SWAP SPACE
of NOT OVER 2GB due to file size limitations. Of course you can modify kernel params to say LARGE-FILE is
supported so you may utilise the full 4GB when required. But why would you need 4GB of swap when you have
1GB of memory.


My understanding is that having plenty of swap space isn't a bad thing if you can 
spare the space and are likely to make use of it.  I'd like to know whether that's a 
misconception that actually degrades performance, and why.



Yes, this is a misconception. When you want speed, do not use SWAP space. When you are after many loads or users
use SWAP space. If you want in-between then tune SWAP space.


I have actually experienced what you did and that is having large SWAP space but discovering the system
became slower for no benefit. It is a trade-off .



-- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to