Tuesday, May 19, 2009

Modifying live Kernel tuning parameters values.... mdb

Sometimes we need to modify Kernel tuning parameters values by modify /etc/system file and then performing system reboot to make the changes take effect. However in most datacenter site, its restricted to perform such reboot at any time during office-hour. It should be carried out after office-hour, in the middle of the night, or the worse during week-end days.

Following is the procedure which can be applied to minimize system downtime and/or after office-hour jobs. The tuning parameters value changes will take immediate effect by executing following commands:
root@sun1: # echo 'lotsfree/W 4096' | mdb -kw
lotsfree: 0xb9e = 0x4096
root@sun1: # echo 'dosynctodr/W 0' | mdb -kw
dosynctodr: 0x1 = 0x0
root@sun1: # echo 'ncsize/W 0t42000' | mdb -kw
ncsize: 0xafc8 = 0xa410
root@sun1: # echo 'shminfo_shmmax/W 0t8500000' | mdb -kw
shminfo_shmmax: 0x800000 = 0x81b320

To verify the changes, we can run mdb utility to read from text input files. First, we create text file containing instructions as;
root@sun1: cat /tmp/mdb_val.cmd
lotsfree/D
dosynctodr/D
ncsize/D
shminfo_shmmax/D
$q

Then redirect the file into mdb utility
root@sun1: mdb -k < /tmp/mdb_val.cmd
lotsfree:
lotsfree: 16534
dosynctodr:
dosynctodr: 0
ncsize:
ncsize: 42000
shminfo_shmmax:
shminfo_shmmax: 8500000

Caution:
The system might crash when we use mdb utility to change the tuning parameters values. This is because the live Kernel relies on the parameters to perform the majority of tasks. An improper setting could cause the Kernel to panic. In addition, any changes using mdb utility are lost when system rebooted, unless appropriate changes have also been made to /etc/system file.

Further reading:
Solaris System Performance Management (SA-400) - Student Guide.

mdb utility use switch or flag to display (D and E) or write (W and Z) the live Kernel tuning parameter value;

/D; Display a 32-bit(4 bytes) parameter value, eg: lotsfree/D
/E; Display a 64-bit (8 bytes) parameter value, eg: buffer_lock/E
/W; Write a 32-bit (4 bytes) parameter value, eg: lotsfree/W 4096
/Z; Write a 64-bit (8 bytes) parameter value, eg: buffer_lock/Z 0t8192

We should used correct switch/flag to display or write the parameter values. The following command used to determine whether the parameter has 4 bytes (32 bit) or 8 bytes (64 bit) value;
"/usr/ccs/bin/nm /dev/ksyms"

example:
root@sun1: # /usr/ccs/bin/nm /dev/ksyms|grep -i ncsize
(Index)|(Value)|(Size)|(Type)|(Bind)|(Other)|(Shndx)|(Name)
[25655] |4274292852| 4| OBJT| GLOB| 0| ABS|ncsize
Coloum 3; Size = 4; its indicated an 4 bytes (32 bit) parameter

root@sun1: # /usr/ccs/bin/nm /dev/ksyms|grep -i buffer_lock
[7916] |4274633176| 8| OBJT| LOCL| 0| ABS|buffer_lock
Coloum 3; Size = 8; its indicated an 8 bytes (64 bit) parameter

Untuk merubah tuning parameter kernel dengan mdb, sebaiknya dilakukan jika kita sudah betul-betul fasih dengan cara penggunaannya. Sebab cara ini berisiko. Jika salah dengan nilai parameter, dapat mengakibatkan system tidak bekerja normal atau bahkan mengakibatkan system crash atau panic. Lebih aman dengan mengubah paramaeter pada file /etc/system, kemudian melakukan reboot. Toh lemburan masih lebih baik ketimbang nungguin iklan.

No comments:

Post a Comment