Solaris Performance Tuning: tune and measure pttys

In Solaris versions prior to Solaris 8, you can use the crash utility to view the ptys on a system. To use crash you must be root.

Example:

# crash
dumpfile = /dev/mem, namelist = /dev/ksyms, outfile = stdout
> pty
ptms_tty TABLE SIZE = 48
SLOT   MWQPTR   SWQPTR  PT_BUFP  TTYPID STATE
0 f5fd2748 f6006848 f5e1f860     306 mopen sopen
1 f6065000 f607bb48 f607cfa0     352 mopen sopen
2 f6105e38 f60f1b60 f607ca80     389 mopen sopen
3 f60f14d0 f6110e40 f607ca00     393 mopen sopen
4 f61485f8 f6148148 f607c400     419 mopen sopen
5 f61476e0 f6151ab0 f607c8a0     424 mopen sopen
6 f6151240 f617bd88 f6158f00     429 mopen sopen
7 f62a8628 f5fd2478 f600f6a0     134 mopen sopen
8 f6307290 f61369a8 f600f080     134 mopen sopen
>

The above output shows that there are 48 ptys configured.  Currently 9 slots of the table are used.  The TTYPID column shows the pid of the process that is currently using the pty. To see the number of ptys in use on systems running Solaris 8 and above,  the following commands can be used:

If running 64 bit KERNEL use this command:

# echo “ptms_inuse/E” | mdb -k

example:
# echo “ptms_inuse/E” | mdb -k
ptms_inuse:
ptms_inuse:     10

If running 32 bit KERNEL use this command:

# echo “ptms_inuse/D” | mdb -k

There is also an mdb command that displays each pty, similar to how the crash utility does it in previous releases of Solaris:

# echo “::walk pty_map | ::ptms” | mdb -k

example:
# echo “::walk pty_map | ::ptms” | mdb -k
ADDR             PTY FL MASTERQ          SLAVEQ           PID    PROC
00000300017e7dd8  10 e 0000030001b3ad30 0000030002427708   3697 dtterm
00000300017e7e08   5 e 0000030001ae7230 0000030001ae6a98       2980 dtterm
00000300017e7e38   6 e 00000300019a0808 00000300019a0fa0        2981 dtterm
00000300017e7e68   4 e 0000030001b64d38 0000030001b645a0       2979 dtterm
00000300017e7e98   3 6 00000300018f42f0 00000300041c6dd8         2915  sdt_shell
00000300017e7ec8   1 6 00000300023d4888 0000030000e03060     2598  fbconsole
00000300017e7ef8   9 c 0000000000000000 0000030002509028    3462  <defunct>
00000300017e7f28   2 6 00000300018f67f8 0000030001c68158          2867  fbconsole
00000300017e7f58   7 e 000003000181c560 000003000179af68         2982  dtterm
00000300017e7f88   8 e 00000300017cea50 0000030001c06d48         2983 dtterm

The tunable parameter pt_cnt has a different definition than it had in previous versions of Solaris. The value of  pt_cnt now represents the minimum number of ptys on the system.  The default value for pt_cnt is now zero.

In Solaris 8 and above, the configuration of ptys is now automatic as they are needed and administrators will no longer need to manually configure more than 48 ptys.  The number of ptys is now limited by the number of pty data structures that can fit in the percentage of physical memory set in pt_pctofmem. The default maximum number of ptys is the amount that will fit in 5% of physical memory.  If pt_cnt is non-zero, the greater of pt_cnt and the default maximum will be the largest number of ptys allowed.

The parameter pt_max_pty is available for users to set a hard limit on the maximum number of ptys that they wish to allow on the system. When set to anything other than the default, this hard limit will not be exceeded.  The default for pt_max_pty is zero, which only means that there has been no user defined maximum set.  When left at the default of zero, the system defined maximum will be used.

Previous to Solaris 8, it was necessary to create files in the /dev/pts directory with a “boot -r” when the pt_cnt was modified. In Solaris 8 and later, this is no longer required.

Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us