SWAP size for Solaris v2.8

The System: Sun SparcServer 20 with 384 MB of  RAM, a 1GB boot drive and an internal 9GB drive (so, total, about 10 GB disk space on board). Installing Solaris v2.8 (10/00) with latest Recommended Patches and Maintenance Update #7.

I am confused as to how much SWAP space to allocate when laying out the disk space. I have seen varying recommendations, including:

=32 MB
=64 MB
=RAM + 32MB
=1.5 x RAM
=2 x RAM
=3 x RAM

So, what IS the story? How much SWAP space should I allocate?

The system will be a general-purpose machine, handling E-Mail, shell accounts, and web-service for 10-20 users. Nothing very strenuous, no massive Oracle installs, no heavy scripting. I suspect its hardest task will be dealing with spam, and perhaps the occasional PHP in a user's web-page.

On a tangent, should I allocate a specific amount of  physical disk space to /tmp, in an effort to prevent a system DOS attack where virtual memory is filled by writing to /tmp? Or should I not create a /tmp partition on physical disk and leave it to tmpfs?
LVL 34
Who is Participating?

Improve company productivity with a Business Account.Sign Up

Alf666Connect With a Mentor Commented:
Don't bother then. Get rid of tmpfs, use a 4-500 MB swap partition and you'll be just fine. You might be a little low on RAM, but anyways, if you fill up 386 MB RAM and 500 MB swap, then this is definitely not the right box :-)
TintinConnect With a Mentor Commented:
Assuming freespace is not an issue, just go for 2 x RAM.   Better to have a little too much than too little and having /tmp and swap share the space means for more efficient use of resources.
The size of the swap space is depands what appliaction software is running on the box (the
requirements of the system's software applications).

But you should allocate at least as the SAME size of the RAM for your system, to enable to save a worst-case crash dump.

I would recommended 2.5 X RAM when you have a large HD, and 1.5 X RAM for small HD.

Have a look at the following page to learn more about Solaris swap space:

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

PS, when the app use swap, the system would slow down a lot, if your system is using swap all
 the time, consider to add more RAM.
yuzh is totally right.

Swap space should not be considered for everyday use. RAM size is the only important issue.
In this case, assuming you have enough RAM, SWAP = RAM is usually enough.

On Solaris though, swap is used a lot as soon as a memory page has been unused for a while. So, don't get scared if you find it filled up

You should just be concerned if swap fills up and RAM is full. But you will have noticed slowdowns before.
PsiCopAuthor Commented:
Well, like I said, the system is going to be handling general end-user tasks (E-Mail, personal web-pages, clients of various sorts - IRC, MUD, telnet, FTP) for 10-20 users. Disk space IS at a premium.

Right now, I have SWAP=2 x RAM, but I would like to free up some disk space. I've got recommendations from =RAM to = 2.5 x RAM, so I'm leaning towards =1.5 RAM to free up a bit.

Anyone have any input concerning allocating a fixed amount of disk space to /tmp versus letting tmpfs use swap space?
I've done this more than often. This can slow down some apps that use /tmp, but it's no big deal.

Just don't mount /tmp as a tmpfs.

And, honestly, if you're concerned about the difference in disk space that the 2.5 -> 1.5 swap space will free up, it means you have lots of RAM and probably don't need more that 1 x RAM (provided you don't have tmpfs).
PsiCopAuthor Commented:
The System: Sun SparcServer 20 with 384 MB of  RAM, a 1GB boot drive and an internal 9GB drive (so, total, about 10 GB disk space on board). Installing Solaris v2.8 (10/00) with latest Recommended Patches and Maintenance Update #7.
PsiCopAuthor Commented:
"Get rid of tmpfs"

By this, do you mean allocate disk space specifically for /tmp? Any suggestions on the proper size for such a partition? 100 MB?

400-500 MB for SWAP works out to RAM x 1.25 - that seems to be a middle-of-the-road number.
yuzhConnect With a Mentor Commented:
I miss out after one night sleep.

Alf666's comment (comment ID: http: #10980125) make a good point. 400-500 MB for SWAP
is good enough, if you need anything more than 500MB swap, consider a hardware upgrade.
(any low end new Sun box can do a better job than an old SparcServer 20).

BTW, the SCSI disk is very cheap now, if you need disk space, why don't you just add another
disk for web pages/ftp storage, you can always move it to a new box when you get one!
> By this, do you mean allocate disk space specifically for /tmp?
> Any suggestions on the proper size for such a partition? 100 MB?

This should be fine for a low-end system.
Though my own /tmp tends to get a bit bigger :-))
But if you don't use it yourself, but let it free for the system, it should be largely enough.
Be careful though of the apps you are using. Some might tend to need a bit more space in /tmp.
I would rather go for 300M.

> 400-500 MB for SWAP works out to RAM x 1.25 - that seems to be a middle-of-the-road number.

Yes. This is totally arbitrary :-)
But you should be just fine with that.
ahoffmannConnect With a Mentor Commented:
>  Nothing very strenuous,  ..
in this case 250MB of swap is enough
if you have 400-500MB you're on a good way.

Keep in mind that Solaris comes with /tmp configured on the swap partition, means that /tmp and swap share the same physical memory, whis is usefull in most cases. Usefull in your case , according description, too.
The default configuration also cleans /tmp on every reboot (hence the name: temporary :-)

I'd configure a partition with 500-1000MB as tmpfs and /tmp mounted on that partition.
It's unusal that both, /tmp and swap grow simultaneously.
jwelterConnect With a Mentor Commented:
If I might just add;

For me, swap has always been hit and miss when developing a new system (or an old system for new uses).  If it were me, I would configure @ no less than 1:1 SWAP to RAM, and see how it performs.  You can always add more swap later... It is much more difficult to remove it.  Also, you will likely receive a performance bonus if you split the swap between both drives (if possible).

My two cents...

PsiCopAuthor Commented:
Yes, making some swap on each spindle is an old habit of mine, dating back to SunOS 4.1, which couldn't boot up without swap being available, so therefore I always put at least a little swap on every spindle, so if I lost one spindle I could still conceivably boot the system (perhaps off of CD if I had lost the spindle with /). This habit saved my bacon once, actually.

I know that swap is not strictly required by Solaris v2.x, tho - it can function without it.

Right now I'm leaning towards allocating about 512 MB of total swap, and letting /tmp reside as tmpfs in the swap space.
PsiCopAuthor Commented:
Thank you all for your input.

In the end, I made a total of 512 MB of swap, split scross the two drives, and did not specifically allocate disk space to /tmp.

So far, so good, but the machine has not entered production (soon, tho).

As for why I don't simply get a new box with larger HDDs, its the same tune everywhere - $$$$. I'm running on a very thin shoestring.
Hi PsiCop,

    Since your box is not under warranty, you can buy the SCSI HD from any PC shop, it is a
lot cheaper than get it from Sun, eg, 18GB - AU$250, 36GB - AU$300 (in US might be cheaper).

PsiCopAuthor Commented:
I thot about that, but I bought some 8 GB SCA-connector SCSI drives obstensibly were Sun-ready, but I never could get this server (OBP v2.25) to boot from them. That's the only reason I still have that old 1 GB Sun/Seagate drive in the system - I tried replacing it with an 8 GB drive and doing the whole install bootblock bit, but I could never get the system to boot from that drive (and no, I didn't make a huge / partition).
Have you update the OBP? I use big HD for a very old SPARC 5, and it
PsiCopAuthor Commented:
As I understand it, OBP v2.25 is the last one produced for the SparcStation 20. Someone please correct me if I'm wrong. I have no aversion to updating.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.