How Big Should It Be?

Team-Fly    

Solaris™ Operating Environment Boot Camp
By David Rhodes, Dominic Butler
Table of Contents
Chapter 7.  Swap Space


The exact amount of swap space required is dependent on many factors, one of the most important being the requirements of the application(s) you are running on the server.

Many applications and databases have specific swap requirements and will describe in great detail how you should calculate the size based on the number of users, size of database, likely rate of transactions, and so forth. If you will be running an application or database on one of your servers, you should follow the guidance of the application installation guide rather than anything recommended in this chapter.

When Solaris is installed, it will create a swap partition based on the amount of memory installed in the computer. The rules it uses are shown in Table 7.2.

Table 7.2. Default Swap Space Sizes (Solaris 7)

Installed Memory (MB)

Swap Space Size (MB)

1664

32

64128

64

128512

128

Greater than 512

512

This means that the maximum swap size that Solaris 7 will create during an automated install is 512 MB. (For Solaris 8, the maximum size created will be 256 MB rather than 512 MB, but all other values are as per the Solaris 7 table). This may be enough for the system, but it may not. It is much better to spend some time checking this out, rather than just accepting the default and leaving things to chance.

As already mentioned, the most important factor in sizing swap correctly is likely to be the applications that will be run on the server. On top of this, the following points may also prove useful in determining if you have enough swap space or not:

  • When the system crashes, a crash dump will be written to the swap device. The size of the crash is not fixed, but in the worst case it could be as large as the entire installed memory. Therefore, if you want to guarantee that you will always have enough swap to hold a system crash dump, you should make swap at least as large as the system memory.

  • We saw in Chapter 6, "The Filesystem and Its Contents," that /tmp is actually memory-resident, but it also makes use of the swap partition. If you know that the system will make heavy use of /tmp, then you may want to increase the size of swap to compensate for the space that may be lost to /tmp.

The 2 GB Swap Limit

If you are running the 32-bit version of Solaris, only the first 2 GB of a swap partition can be used. Therefore, if you need to have a swap space larger than this you will need to create multiple swap partitions. The 64-bit version of Solaris can support a single swap space up to 2**63-1 (which, when converted into English, means quite a lot more than 2 GB). It's also worth noting that swap space is crudely "striped." This means that if multiple swap locations are defined, they will be used in rotation. This effectively distributes the load evenly across the swap sites. Because of this, it's not a good idea to place separate swap locations on the same disk, as it will be detrimental to performance.

You can tell if your system is running the 32-bit or the 64-bit version of Solaris by running the isainfo command:

 hydrogen# isainfo v 64-bit sparcv9 applications 32-bit sparc applications hydrogen# 

The above output shows that the system is running 64-bit Solaris (what it is actually saying is that the operating system can support both 32-bit and 64-bit applications). If you get the output shown below, then you have a system running 32-bit Solaris:

 hydrogen# isainfo v 32-bit sparc applications hydrogen# 

In addition to there being a maximum size for swap, there is also a minimum size (though you are unlikely to ever want to create a swap partition as small as this). The minimum size exists because the first page of swap is never used. The reason for this is to allow the swap partition to be placed at the start of a disk while ensuring that the disk's VTOC does not get overwritten. This means that to actually have something that can be used, each swap partition should be at least two pages in size. The size of a memory page is not fixed but can be determined on any Solaris server by using the pagesize command, as follows (the output is shown in bytes).

 hydrogen# pagesize 8192 hydrogen# 

    Team-Fly    
    Top
     



    Solaris Operating Environment Boot Camp
    Solaris Operating Environment Boot Camp
    ISBN: 0130342874
    EAN: 2147483647
    Year: 2002
    Pages: 301

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net