Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm still seeing system administrators using the old rule of thumb that swap should be double the memory, even in servers with 32GB of memory.

These systems have relatively expensive disks (shipping with 200GB drives) and allocating 64GB of that to swap seems a bit excessive.

I was wondering how much swap do you allocate for your Solaris servers, and why?

I saw there were other similar questions, but mostly focused on Linux. For Solaris there is another consideration deciding on your swap space because the /tmp filesystem is usually shared with swap.

share|improve this question

5 Answers 5

up vote 5 down vote accepted

The swap = 2 * memory is coming from the old days when during a kernel crash the kernel dumped the memory to the swap device and you were able to check what happened after you rebooted your system. Nowadays for example linux is skipping this at all, and I don't run my system with enabled dump file setup. So, this double the size of the memory to get the swap is not valid anymore, because there is not unusual that you have 16/32/64GB of ram and then you obviously wasting disk space following this old story when the disk was much much bigger then the RAM. So long story short, if you don't want to dump and analyze kernel crashes in production there is no logical reason to keep this principle and just give your system couple of G swap, usually i give 2/4 G, because i want to avoid huge IO load caused by swapping.

share|improve this answer

It is recommended to have enough RAM for all of your application actively used memory to fit in it and still have enough space for allowing the various kernel managed caches and other dynamic buffers to keep performance optimal. Otherwise you'll have too much pagination and the system will underperform.

On the other hand, it is mandatory to have a swap large enough for all the memory reservation to be honored. Otherwise, your applications will randomly crash. This is not related to RAM usage. Be aware that Solaris, unlike Linux and others doesn't over-commit memory.

It is a bad practice not to allocate at all a swap area with Solaris as part of your RAM will just be wasted. It is common to have 50% of reserved but unused virtual memory so I would suggest at a rule of thumb to have a swap area sized between 50% and 100% of the RAM. There are specific uses where paginating a lot might make sense so larger swap spaces too.

share|improve this answer
    
I am dealing with an issue that I have a process that grows to about 40GB. I run on a Solaris machine with 128GB ram and 16GB swap configured. The process fails without any errors. Could this be because of insufficient swap? Where did you get that mandatory swap requirement from? –  James Dean Oct 21 '10 at 20:24
    
You do not provide enough details. A process can fail for plenty of reasons. What is your virtual memory usage when the process fails ? I didn't wrote having a swap is mandatory, just that it has to be large enough for all memory reservations to fit. No swap at all might be large enough if you have "too much" RAM. –  jlliagre Oct 21 '10 at 20:54
    
top shows almost no free memory and about 13 GB of the swap still free when the process starts allocating most of its memory. I am not sure if the memory is really not free or just all used for disk caching. (This is actually on-site at a customer I just get some top reports.) –  James Dean Oct 22 '10 at 15:01
    
Memory (RAM) used for disk caching can be reported as used or free depending on the filesystem. Also, better to stick with standard Solaris tools like vmstat and prstat instead of top which might give inconsistent values on Solaris. –  jlliagre Oct 22 '10 at 21:49

I would disagree with the argument that swap is no longer required. If you are using heavy applications, like, EDA, Space, Petroleum, Weather forecasting. The applications usually run of Physical Memory. So, it depends on the kind of applications your running, In short, there is unfortunately no single rule that fits everyone. You will have to decide on the swap size based on your application requirements.

share|improve this answer
1  
My main Solaris development system has 16GB of RAM, 16GB of swap, and I wish I had more of both-- but then I'm dealing with problem sets that are best categorized as 'freakishly huge'. Swap space on Solaris should be configured based on expected usage of the machine. –  Bill B Oct 22 '09 at 12:50

It is no longer necessary to have swap in Solaris. If you know that your system will run completely in memory then you can set it to zero. Unless disk space is really a problem set it to the largest you can get away with as you will need some in critical situation.

Solaris FAQ myths and facts

I normally set the value to be the same as RAM unless the system is likely to need a lot more.

share|improve this answer
2  
While I disagree with blanket statements like this, I would agree that it MAY NOT be necessary to have swap in Solaris- I found that some servers may well run fine within memory, and adding swap only increases the amount of time for a runaway app to crash while trying allocate the Universe. So, a better answer is, if your apps do not require more memory, you may not necessarily need swap in Solaris. +1 to bring you back from negative. –  kmarsh Oct 22 '09 at 13:12
    
Thanks. I remember being on a Solaris Sys Admin course and being told that it was not required any more. Would I set-up a system without space? No. I would use 2xRAM as I am an old time from SunOS 3 days ;) –  David Allan Finch Oct 22 '09 at 14:15
    
"trying to allocate the Universe." That's going to be my new log entry for when various research applications go into Sorceror's Apprentice mode. –  Bill B Oct 22 '09 at 15:08

This depends at lot on your applications.

Because Solaris doesn't not seem to be able to overcommit memory, you may have to add tons of swap even if it's not physically used.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.