System Administration Guide, Volume II
只搜尋這本書
以 PDF 格式下載這本書

Tuning Kernel Parameters

73

This chapter describes the procedures for tuning kernel parameters. This is a list of the step-by-step instructions in this chapter.
How to List the Kernel Parameterspage 1450
How to Change the Value of a Kernel Parameterpage 1451
How to Set the Value of a Kernel Module Variablepage 1451
How to Tune the Interprocess Communication Parameterspage 1454
How to Tune Memory Management Parameterspage 1455
How to Tune Miscellaneous Parameterspage 1456

· How to List the Kernel Parameters

Display the current kernel parameters values by using the sysdef command.

  # sysdef -i  
  * Hostid  
    53001b80  
  *  
  * sun4c Configuration  
  * Devices  
  packages (driver not attached)  
       disk-label (driver not attached)  
       deblocker (driver not attached)  
       obp-tftp (driver not attached)  
                .  
                .  
                .  
  * Loadable Objects  
  drv/arp  
       hard link:  strmod/arp  
  drv/bpp  
                .  
                .  
                .  
  * System Configuration  
   swap files  
  swapfile             dev  swaplo blocks   free  
  /dev/dsk/c0t1d0s1   32,9       8 205352 205352  
  *  
  * Tunable Parameters  
    561152maximum memory allowed in buffer cache (bufhwm)  
       426maximum number of processes (v.v_proc)  
        99maximum global priority in sys class (MAXCLSYSPRI)  
                 .  
                 .  
                 .  
  * Utsname Tunables  
  *    5.4  release (REL)  
    minnie  node name (NODE)  
     SunOS  system name (SYS)  
   prefcs3  version (VER)  
                 .  
                 .  
                 .  

· How to Change the Value of a Kernel Parameter

  1. Become root.

  2. Add a line to the /etc/system file in the form:

    set parameter=value

  3. Reboot the system.

    The kernel parses the /etc/system file during autoconfiguration and overrides the default value for the parameters specified in this file.

Example--Changing the Value of a Kernel Parameter

The following line in the /etc/system file sets the value of the max_nprocs to 500 parameter.
set max_nprocs=500

· How to Set the Value of a Kernel Module Variable

  1. Become root.

  2. Add a line to the /etc/system file in the form:

    set module_name:variable=value

  3. Reboot the system.

    The kernel parses the /etc/system file during autoconfiguration and overrides the default value for the parameters specified in this file.

Example--Setting the Value of a Kernel Module Variable

The following line in the /etc/system file sets the value of the msginfo_msgmap parameter in the msgsys module to 150.
set msgsys:msginfo_msgmap=150

Buffer Cache Parameters

The bufhwm parameter specifies the maximum size for buffer cache memory usage expressed in units of 1K bytes. The default is 2% of physical memory. Use sar(1M) to measure the buffer cache statistics.

UFS File System Parameters

Table 73-1 describes the tunable UFS parameters.
Table 73-1
ParameterDescription
ufs_ninodeMaximum size of the inode table
(default = max_nprocs + 16 + maxusers+ 64)
ncsizeNumber of dnlc entries (default = max_nprocs+16+maxusers + 64); dnlc is the directory-name lookup cache.

STREAMS Parameters

Table 73-2 describes the tunable STREAMS parameters.
Table 73-2
ParameterDefaultDescription
nstrpush9The maximum number of STREAMS pushes allowed.
strmsgsz0The maximum size for the STREAMS message that a user can create. A value of 0 indicates no upper bound. This parameter may disappear entirely in a future release.
strctlsz1024The maximum size of the ctl part of a message.
strthresh0The maximum amount of dynamic memory that the STREAMS subsystem can consume, in bytes. Once this threshold is passed, any pushes, opens, and writes on a STREAMS devices will fail for non-root processes. A value of 0 means no limit.
sadcnt16Number of sad devices.

Interprocess Communication (IPC(TM)) Parameters

Table 73-3 describes the tunable interprocess communication parameters.
Table 73-3
Parameter TypeParameterDefaultDescription
Message Queuemsginfo_msgmap100Number of entries in the message map
msginfo_msgmax2048Maximum message size
msginfo_msgmnb4096Maximum bytes on queue
msginfo_msgmni50Number of message queue identifiers
msginfo_msgssz8Segment size of a message (should be a multiple of the word size)
msginfo_msgtql40Number of system message headers
msginfo_msgseg1024Number of message segments (must be < 32768)
Semaphore Facilityseminfo_semmap10Number of entries in the semaphore map
seminfo_semmni10Number of semaphore identifiers
seminfo_semmns60Number of semaphores in the system
seminfo_semmnu30Number of undo structures in the system
seminfo_semmsl25Maximum number of semaphores, per id
seminfo_semopm10Maximum number of operations, per semaphore call
seminfo_semume10Maximum number of undo entries, per process
seminfo_semvmx32767Semaphore maximum value
seminfo_semaem16384Maximum value for adjustment on exit
Shared Memoryshminfo_shmmax1048576Maximum shared memory segment size
shminfo_shmmin1Minimum shared memory segment size
shminfo_shmmni100Number of shared memory identifiers
shminfo_shmseg6Segments, per process

· How to Tune the Interprocess Communication Parameters

  1. Become root.

  2. Add a line to the /etc/system file using the syntax described in Table 73-4.

Table 73-4
Parameter TypeParameterTuning Syntax
Message Queuemsgsysset msgsys:msginfo_variable=value
Semaphore Facilitysemsysset semsys:seminfo_variable=value
Shared Memoryshmsysset shmsys:shminfo_variable=value
  1. Reboot the system.

    The kernel parses the /etc/system file during autoconfiguration and overrides the default value for the parameters specified in this file.

Memory Management Parameters

Table 73-5 describes the tunable memory management parameters.
Table 73-5
ParameterDefaultDescription
lotsfreescaled based on physical memoryIf freemem drops below lotsfree, the system starts to steal pages from processes.
tune_t_fsflushr30Rate at which fsflush is run, in seconds
tune_t_minarmem25The minimum available resident (not swappable) memory needed to avoid deadlock, in pages
tune_t_minasmem25The minimum available swappable memory needed to avoid deadlock, in pages
tune_t_flckrec512The maximum number of active frlocks

Note - Since the Solaris 2.4 release, the tune_t_gpgslo parameter has been replaced by a more complicated criteria for swapping based on the number of runnable threads. More information on this new criteria will be available for the Solaris 2.5 FCS release.

The freemem parameter is defined in pages. Utilities like vmstat translates freemem into bytes from pages.

· How to Tune Memory Management Parameters

  1. Become root.

  2. Add a line to the /etc/system file using the following syntax.

set tune:variable=value

  1. Reboot the system.

    The kernel parses the /etc/system file during autoconfiguration and overrides the default value for the parameters specified in this file.

Miscellaneous Parameters

Table 73-6 describes tunable miscellaneous parameters.
Table 73-6
ParameterDefaultDescription
lwp_default_stksize8192Size of the kernel stack for lwps. Do not adjust this value unless there is a kernel overflow. The value is expressed in bytes and must be a multiple of PAGESIZE bytes.
npty48Total number of 4.x pseudo-ttys configured
pt_cnt48Total number of 5.x pseudo-ttys configured

· How to Tune Miscellaneous Parameters

  1. Become root.

  2. Add a line to the /etc/system file using the following syntax.

    set parameter=value

  3. Reboot the system.

    If you changed device related kernel parameters, you need to use the -r option when booting the system. When the system boots, the kernel parses the /etc/system file during autoconfiguration and overrides the default value for the parameters specified in this file.

Example--Tuning Miscellaneous Parameters

The following line in the /etc/system file sets the value of the pt_cnt parameter to 200.
set pt_cnt=200