Solved

SWAP size for Solaris v2.8

Posted on 2004-05-02
19
3,278 Views
Last Modified: 2013-12-21
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
=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?
0
Comment
Question by:PsiCop
  • 7
  • 5
  • 4
  • +3
19 Comments
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 50 total points
ID: 10973828
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.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 10974017
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:
http://www.itworld.com/Comp/2378/swol-0496-perf/

http://www.alise.lv/ALISE/technolog.nsf/0/59136f9072dc58d8422569fa0057b095?OpenDocument
0
 
LVL 38

Expert Comment

by:yuzh
ID: 10974023
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.
0
 
LVL 9

Expert Comment

by:Alf666
ID: 10977039
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
rapidly.

You should just be concerned if swap fills up and RAM is full. But you will have noticed slowdowns before.
0
 
LVL 34

Author Comment

by:PsiCop
ID: 10978713
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?
0
 
LVL 9

Expert Comment

by:Alf666
ID: 10980034
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).
0
 
LVL 34

Author Comment

by:PsiCop
ID: 10980063
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.
0
 
LVL 9

Accepted Solution

by:
Alf666 earned 200 total points
ID: 10980125
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 :-)
0
 
LVL 34

Author Comment

by:PsiCop
ID: 10980351
"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.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 38

Assisted Solution

by:yuzh
yuzh earned 150 total points
ID: 10982836
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!
0
 
LVL 9

Expert Comment

by:Alf666
ID: 10985138
> 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.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 50 total points
ID: 10986237
>  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.
0
 
LVL 3

Assisted Solution

by:jwelter
jwelter earned 50 total points
ID: 10986495
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...

Jay
0
 
LVL 34

Author Comment

by:PsiCop
ID: 10986637
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.
0
 
LVL 34

Author Comment

by:PsiCop
ID: 11036314
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.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 11036351
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).

   
0
 
LVL 34

Author Comment

by:PsiCop
ID: 11040039
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).
0
 
LVL 38

Expert Comment

by:yuzh
ID: 11040634
Have you update the OBP? I use big HD for a very old SPARC 5, and it
works
0
 
LVL 34

Author Comment

by:PsiCop
ID: 11040952
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.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now