As we have throughout the TCP Performance Tuning series, we're going to make sure RFC 1323 Window Scaling is enabled and increase our send and receive window size to 1 MB. The ndd command is the Solaris equivalent of sysctl in FreeBSD/Linux/Mac OS X. As always, the '$' represents the shell prompt and should not be typed.
$ sudo ndd -set /dev/tcp tcp_wscale_always 1
$ sudo ndd -set /dev/tcp tcp_tstamp_if_wscale 1
$ sudo ndd -set /dev/tcp tcp_max_buf 16777216
$ sudo ndd -set /dev/tcp tcp_cwnd_max 8388608
$ sudo ndd -set /dev/tcp tcp_xmit_hiwat 1048576
$ sudo ndd -set /dev/tcp tcp_recv_hiwat 1048576
To make these settings permanent, add the following lines to /etc/system.
set ndd:tcp_wscale_always=1
set ndd:tcp_tstamp_if_wscale=1
set ndd:tcp_max_buf=16777216
set ndd:tcp_cwnd_max=8388608
set ndd:tcp_xmit_hiwat=1048576
set ndd:tcp_recv_hiwat=1048576
By default, Solaris has RFC 1323 Window Scaling and Timestamps enabled, but it never hurts to make sure.

My question is regarding TCP performance tuning in Solaris. I have made the changes as shown above and below, but when I reboot the server the value is reverting back to the Soalris 10 default of 48K. Is there another file that also needs to be modified, I don't know what else could be causing this issue.
set ndd:tcp_max_buf=16777216
set ndd:tcp_cwnd_max=8388608
set ndd:tcp_xmit_hiwat=1048576
set ndd:tcp_recv_hiwat=1048576
You need to put these commands inside a script file that execute them when server reboots.
For example:
# vi /etc/init.d/net-tune
set ndd:tcp_max_buf=16777216
set ndd:tcp_cwnd_max=8388608
set ndd:tcp_xmit_hiwat=1048576
set ndd:tcp_recv_hiwat=1048576
# ln -s /etc/init.d/net-tune /etc/rc2.d/S99net-tune
After theses two steps Solaris will execute the script on boot (will be executed because of capital "S").
I'm sorry. I made a mistake.
Following the right commands to put on script:
ndd -set /dev/tcp tcp_wscale_always 1
ndd -set /dev/tcp tcp_tstamp_if_wscale 1
ndd -set /dev/tcp tcp_max_buf 16777216
ndd -set /dev/tcp tcp_cwnd_max 8388608
ndd -set /dev/tcp tcp_xmit_hiwat 1048576
ndd -set /dev/tcp tcp_recv_hiwat 1048576
The others steps remain the same.
In Solaris 10 you should use the integrated Service Management Facility (SMF) and not the traditional /etc/init.d Start/Stop scripts!
step 1:
create a manifest xml file (also see the smf_method(5) man-page):
The so defined service will then be created as a logical directory within SMF.
Let's call this one "ndd-nettune".
/var/svc/manifest/site/ndd-nettune.xml:
ndd network tuning
step 2:
Check and import of configuration of the service in SMF (defined through the manifest):
# svccfg validate /var/svc/manifest/site/ndd-nettune.xml
# svccfg import /var/svc/manifest/site/ndd-nettune.xml
step 3:
Creation of a method script (this is like the old-fashioned rc-scripts with start/stop/restart sections).
This file will be located and named as defined in the exec_method-section of the manifest file (see above). Also see the man-page smf_method(5).
I put in a fallback possibility as well (in the stop section) to set the parameters back to where they were before the modification.
/lib/svc/method/ndd-nettune:
#!/sbin/sh
#
# ident "@(#)ndd-nettune.xml 1.0 01/08/06 SMI"
. /lib/svc/share/smf_include.sh
. /lib/svc/share/net_include.sh
tcp_par=/var/tmp/ndd_tcp_params
# Make sure that the libraries essential to this stage of booting can be found.
LD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH
case "$1" in
'start')
if test ! -f $tcp_par
then
echo no such file: $tcp_par
else
rm $tcp_par
fi
echo "#!/sbin/sh" >> $tcp_par
echo "# Script to use with ndd-nettune service stop method (/lib/svc/method/ndd-nettune)" >> $tcp_par
echo "# commands to set the TCP parameter values back to original" >> $tcp_par
echo >> $tcp_par
tcp_xmit_hiwat=`ndd -get /dev/tcp tcp_xmit_hiwat`
echo "ndd -set /dev/tcp tcp_xmit_hiwat $tcp_xmit_hiwat" >> $tcp_par
ndd -set /dev/tcp tcp_xmit_hiwat 1048576
tcp_recv_hiwat=`ndd -get /dev/tcp tcp_recv_hiwat`
echo "ndd -set /dev/tcp tcp_recv_hiwat $tcp_recv_hiwat" >> $tcp_par
ndd -set /dev/tcp tcp_recv_hiwat 1048576
... and so on for the other parameters ...
echo >> $tcp_par
echo "exit 0" >> $tcp_par
;;
'stop')
chmod 700 $tcp_par
$tcp_par
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
# Reset the library path now that we are past the critical stage
unset LD_LIBRARY_PATH
exit $SMF_EXIT_OK
step 4:
The service will be checked and set offline/online with the following commands:
# svcs -a | grep nettune
online Apr_08 svc:/network/ndd-nettune:default
# svcadm disable ndd-nettune
# svcadm enable ndd-nettune