home *** CD-ROM | disk | FTP | other *** search
/ ftp.sberbank.sumy.ua / 2014.11.ftp.sberbank.sumy.ua.tar / ftp.sberbank.sumy.ua / incoming / sxtech / tune.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2014-08-29  |  1KB  |  52 lines

  1. #!/bin/sh
  2. export PATH=/stand:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
  3.  
  4. OUTPUT=$1/boot/loader.conf
  5.  
  6. PHYSMEM=$(sysctl hw.physmem | awk '{print $2}')
  7.  
  8. # One L7 node per 64K.  Use expr, /bin/sh often overflows at 32 bits.
  9. L7NODES=$(expr $PHYSMEM / 65536)
  10.  
  11. # Three socks per L7 node, plus some slush
  12. SOX=$(($L7NODES * 3 + 2048))
  13.  
  14. # Two PCB hash table buckets per L7 node.
  15. TCBHASHSZ=$(($L7NODES * 2))
  16. # Fit to next larger power of 2, kernel wants power-of-two hash size
  17. # but $PHYSMEM is usually missing a few bytes, which distorts things.
  18. #
  19. pow=2; while [ $pow -lt $TCBHASHSZ ]
  20. do
  21.     pow=$(( $pow * 2 ))
  22. done
  23. TCBHASHSZ=$pow
  24.  
  25. # 8 mbuf clusters per L7 node, to a maximum of 128K (256MB).
  26. MBCL=$(($L7NODES * 8))
  27. if [ $MBCL -gt 131072 ]; then
  28.     MBCL=131072
  29. fi
  30.  
  31. ## The fixed part
  32.  
  33. cat > $OUTPUT << ZOG
  34. userconfig_script_load="YES"
  35. # Xcel II wants this since it polls like a network device
  36. kern.polling.enable=1
  37. #
  38. # ensure we don't hang about in the debugger
  39. #
  40. debug.debugger_on_panic=0
  41. #
  42. net.inet.tcp.syncache.hashsize=8192
  43. hw.em.rx_desc=4096
  44. #
  45. ZOG
  46.  
  47. ## The variable part
  48. echo net.inet.tcp.tcbhashsize=$TCBHASHSZ >> $OUTPUT
  49. echo kern.ipc.maxsockets=$SOX >> $OUTPUT
  50. echo kern.ipc.nmbclusters=$MBCL >> $OUTPUT
  51. echo eq.l7lb.max_nodes=$L7NODES >> $OUTPUT
  52.