"UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." -- Doug Gwyn
In Solaris 2.x, there is no need to rebuild the kernel after changing some kernel parameters. Here are some commonly encountered tuning problems and how to fix them. For more details, read the man pages and/or answerbook.
In Solaris 2.3 there is more info in the Tuning Kernel Parameters section. Sun simply hasn't gotten around to documenting all of it. The kernel still sees many, many changes every release and keeping the documentation in sync with that is a daunting task. Some of the knobs in the kernel are not documented on purpose, I think. Just as people start punching random button and turing random knobs when they can't get a machine to work, they'll start to switch on/off all kinds of stuff in the kernel giving only half a chance..
The name of some basic parameters that are defined in
/etc/system.
One of the most commonly asked parameters: set pt_cnt = <n> * number of SysV ptys Personnaly recommended: (for Solaris 2.3, 2.4)Specially the maximum number of child processes by user id and the maximum number of open files (system wide and by user id).
set nfs:nfs_portmon = 1 * for increased fileserver security.(for Solaris 2.5 and above)
set nfssrv:nfs_portmon = 1 * for increased fileserver security.
Run crash and have a look at the output of the var command; there is a structure v in your kernel that holds all the tunable parameters. The definition is in /usr/include/sys/var.h And there is another structure rlimits which lists the resource limits; see the definition in /usr/include/sys/resource.h BTW: I do not know of a "clean" way to change these values yet. It seems to be impossible to set a field of a structure using /etc/system. All I can do so far is patching the kerning with adb.
adb -k /dev/ksyms /dev/mem (You don't get a prompt). To check a parameter (e.g. maxusers): maxusers/D maxusers/XThe first gives the decimal, the second the hex value. Depending on the variable, you might need different commands (do a man adb).
set maxusers=16
You can also disable the loading of modules here. After you are done, you have to do a halt and a 'boot -r' (the touch /reconfigure seems to be broken in some cases), than a reboot (I'm not quite sure if this is needed but since you already restarted the machine, an additional restart should not hurt).
Still needed: what are the useful kernel parameters? The maxusers is obviously one of them, while
s_cache_flushpagectxprobably is not.
Changing the maxusers on the system
Guess the correct value. Put it into /etc/system. The file is self descriptive, e.g. to increase the maxusers, insert:
set maxusers=16
You can also disable the loading of modules here. After you are done, you have to do a halt and a 'boot -r' (the touch /reconfigure seems to be broken in some cases), than a reboot (I'm not quite sure if this is needed but since you already restarted the machine, an additional restart should not hurt).
Increasing the default pts device number
The default setup only creates 48 pts devices (pseudo tty slave
devices). To fix this:
In /etc/system: set pt_cnt = <number> # touch /reconfigure # rebootnpty has an effect on the number of old-style (BSD style) pseudo ttys.
Maximum number of processes per user and other
resources
The maximum number of processes per user is maxuprc. The default value for maxuprc is all processes (-5), which is fine for desktop machines but not for large ``mainframe'' type machines. And multi-user student machines. (Runaway forks are very common).
To change this value, set set maxuprc = <number>
Well, it works in Solaris 2.3, I tried the canonical runaway fork program: "while(1) fork()" and that user did stop at the correct number of PIDs. Of course that I have to do a reboot to stop that processes, but the important is that a single user can't hang the system anymore.
Increasing the maximum number of file descriptors
per process
To get more info use the sysdef -i . (...) * Process Resource Limit Tunables (Current:Maximum) * Infinity:Infinity cpu time Infinity:Infinity file size 7ffff000:7ffff000 heap size 800000:7ffff000 stack size Infinity:Infinity core file size 40: 400 file descriptors <------------- Infinity:Infinity mapped memory (...)In Solaris 2 the /etc/system method cannot be used since there are no variables corresponding to the individual limits, just a single rlimits data structure. The kernel must be patched using adb. The elements are laid out as shown by the sysdef -i command as shown above.
To increase the default number of file descriptors per process, rlimits+28 must be patched with adb as shown below.
Warning- using adb to patch the kernel is dangerous. Mistyping a command could crash the system or render it unbootable. Save an unpatched kernel copy and do not increase the hard limits.
#cp /kernel/unix /kernel/unix.orig #adb -k -w /kernel/unix /dev/mem rlimits,e?X rlimits: rlimits: 7fffffff 7fffffff 7fffffff 7fffffff 7ffff000 7ffff000 800000 7ffff000 7fffffff 7fffffff 40 400 7fffffff 7fffffff rlimits+28?W80 rlimits+28/W80 rlimits,e?X rlimits: rlimits: 7fffffff 7fffffff 7fffffff 7fffffff 7ffff000 7ffff000 800000 7ffff000 7fffffff 7fffffff 80 400 7fffffff 7fffffff $q #
It's never as easy as you think
SYSV shared memory, semaphores and messages
If you are setting up a program under Solaris 2.3 that needs
SYSV shared memory (and semaphores and messages), read on. If doing an ipcs -b
as instructed by the install manual results in an IPC status message informing
you that the facilities aren't present in system and attempting to actually
run the program that uses shared memory results in an error (of course)then
do the following:
This can be tuned around to suit your needs of course.The following will work for a small oracle type system In /etc/system set shmsys:shminfo_shmmax=16000000 set shmsys:shminfo_shmmin=1 set shmsys:shminfo_shmmni=100 set shmsys:shminfo_shmseg=20 set semsys:seminfo_semmns=400 set semsys:seminfo_semmni=140 set semsys:seminfo_semmsl=60