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.
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.
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.
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.
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.
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.