How much swap do you allocate for your Solaris server?

Solution 1:

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.

Solution 2:

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.