Diff for /wikisrc/guide/tuning.mdwn between versions 1.2 and 1.3

version 1.2, 2013/03/21 11:11:21 version 1.3, 2015/06/19 19:18:31
Line 221  of the tools is given with interpretatio Line 221  of the tools is given with interpretatio
   
 ### The top Process Monitor  ### The top Process Monitor
   
 The [top(1)](http://netbsd.gw.com/cgi-bin/man-cgi?top+1+NetBSD-current)  The [[!template id=man name="top" section="1"]]
 monitor does exactly what it says: it displays the CPU hogs on the  monitor does exactly what it says: it displays the CPU hogs on the
 system. To run the monitor, simply type top at the prompt. Without any  system. To run the monitor, simply type top at the prompt. Without any
 arguments, it should look like:  arguments, it should look like:
Line 290  not why. Line 290  not why.
 #### Other Neat Things About Top  #### Other Neat Things About Top
   
 A careful examination of the manual page  A careful examination of the manual page
 [top(1)](http://netbsd.gw.com/cgi-bin/man-cgi?top+1+NetBSD-5.0.1+i386) shows  [[!template id=man name="top" section="1"]] shows
 that there is a lot more that can be done with top, for example, processes can  that there is a lot more that can be done with top, for example, processes can
 have their priority changed and killed. Additionally, filters can be set for  have their priority changed and killed. Additionally, filters can be set for
 looking at processes.  looking at processes.
Line 298  looking at processes. Line 298  looking at processes.
 ### The sysstat utility  ### The sysstat utility
   
 As the man page  As the man page
 [sysstat(1)](http://netbsd.gw.com/cgi-bin/man-cgi?sysstat+1+NetBSD-5.0.1+i386)  [[!template id=man name="sysstat" section="1"]]
 indicates, the sysstat utility shows a variety of system statistics using the  indicates, the sysstat utility shows a variety of system statistics using the
 curses library. While it is running the screen is shown in two parts, the upper  curses library. While it is running the screen is shown in two parts, the upper
 window shows the current load average while the lower screen depends on user  window shows the current load average while the lower screen depends on user
Line 385  NetBSD system can be found on other UNIX Line 385  NetBSD system can be found on other UNIX
   
 ### fstat  ### fstat
   
 The [fstat(1)](http://netbsd.gw.com/cgi-bin/man-cgi?fstat+1+NetBSD-5.0.1+i386)  The [[!template id=man name="fstat" section="1"]]
 utility reports the status of open files on the system, while it is not what  utility reports the status of open files on the system, while it is not what
 many administrators consider a performance monitor, it can help find out if a  many administrators consider a performance monitor, it can help find out if a
 particular user or process is using an inordinate amount of files, generating  particular user or process is using an inordinate amount of files, generating
Line 411  information about file usage. Line 411  information about file usage.
   
 ### iostat  ### iostat
   
 The [iostat(8)](http://netbsd.gw.com/cgi-bin/man-cgi?iostat+8+NetBSD-5.0.1+i386)  The [[!template id=man name="iostat" section="8"]]
 command does exactly what it sounds like, it reports the status of the I/O  command does exactly what it sounds like, it reports the status of the I/O
 subsystems on the system. When iostat is employed, the user typically runs it  subsystems on the system. When iostat is employed, the user typically runs it
 with a certain number of counts and an interval between them like so:  with a certain number of counts and an interval between them like so:
Line 456  problems. Line 456  problems.
   
 ### ps  ### ps
   
 Using the [ps(1)](http://netbsd.gw.com/cgi-bin/man-cgi?ps+1+NetBSD-5.0.1+i386)  Using the [[!template id=man name="ps" section="1"]]
 command or process status, a great deal of information about the system can be  command or process status, a great deal of information about the system can be
 discovered. Most of the time, the ps command is used to isolate a particular  discovered. Most of the time, the ps command is used to isolate a particular
 process by name, group, owner etc. Invoked with no options or arguments, ps  process by name, group, owner etc. Invoked with no options or arguments, ps
Line 525  problems. Line 525  problems.
 ### vmstat  ### vmstat
   
 Using  Using
 [vmstat(1)](http://netbsd.gw.com/cgi-bin/man-cgi?vmstat+1+NetBSD-5.0.1+i386),  [[!template id=man name="vmstat" section="1"]],
 information pertaining to virtual memory can be monitored and measured. Not  information pertaining to virtual memory can be monitored and measured. Not
 unlike iostat, vmstat can be invoked with a count and interval. Following is  unlike iostat, vmstat can be invoked with a count and interval. Following is
 some sample output using `5 5` like the iostat example:  some sample output using `5 5` like the iostat example:
Line 589  cropping up whether the fault of the loc Line 589  cropping up whether the fault of the loc
 ### ping  ### ping
   
 The classic  The classic
 [ping(8)](http://netbsd.gw.com/cgi-bin/man-cgi?ping+8+NetBSD-5.0.1+i386) utility  [[!template id=man name="ping" section="8"]] utility
 can tell us if there is just plain connectivity, it can also tell if host  can tell us if there is just plain connectivity, it can also tell if host
 resolution (depending on how `nsswitch.conf` dictates) is working. Following is  resolution (depending on how `nsswitch.conf` dictates) is working. Following is
 some typical ping output on a local network with a count of 3 specified:  some typical ping output on a local network with a count of 3 specified:
Line 640  chances are something is wrong on that o Line 640  chances are something is wrong on that o
 ### traceroute  ### traceroute
   
 The  The
 [traceroute(8)](http://netbsd.gw.com/cgi-bin/man-cgi?traceroute+8+NetBSD-5.0.1+i386)  [[!template id=man name="traceroute" section="8"]]
 command is great for making sure a path is available or detecting problems on a  command is great for making sure a path is available or detecting problems on a
 particular path. As an example, here is a trace between the example ftp server  particular path. As an example, here is a trace between the example ftp server
 and ftp.NetBSD.org:  and ftp.NetBSD.org:
Line 695  network ICMP is most likely disabled. Line 695  network ICMP is most likely disabled.
   
 Another problem that can crop up on a NetBSD system is routing table issues.  Another problem that can crop up on a NetBSD system is routing table issues.
 These issues are not always the systems fault. The  These issues are not always the systems fault. The
 [route(8)](http://netbsd.gw.com/cgi-bin/man-cgi?route+8+NetBSD-5.0.1+i386) and  [[!template id=man name="route" section="8"]] and
 [netstat(1)](http://netbsd.gw.com/cgi-bin/man-cgi?netstat+1+NetBSD-5.0.1+i386)  [[!template id=man name="netstat" section="1"]]
 commands can show information about routes and network connections  commands can show information about routes and network connections
 (respectively).  (respectively).
   
Line 787  summarily followed up with the offending Line 787  summarily followed up with the offending
 ### tcpdump  ### tcpdump
   
 Last, and definitely not least is  Last, and definitely not least is
 [tcpdump(8)](http://netbsd.gw.com/cgi-bin/man-cgi?tcpdump+8+NetBSD-5.0.1+i386),  [[!template id=man name="tcpdump" section="8"]],
 the network sniffer that can retrieve a lot of information. In this discussion,  the network sniffer that can retrieve a lot of information. In this discussion,
 there will be some sample output and an explanation of some of the more useful  there will be some sample output and an explanation of some of the more useful
 options of tcpdump.  options of tcpdump.
Line 857  problems may be laying in wait, such as  Line 857  problems may be laying in wait, such as 
 services for example.  services for example.
   
 Starting accounting is actually fairly simple, as root, use the  Starting accounting is actually fairly simple, as root, use the
 [accton(8)](http://netbsd.gw.com/cgi-bin/man-cgi?accton+8+NetBSD-5.0.1+i386)  [[!template id=man name="accton" section="8"]]
 command. The syntax to start accounting is: `accton filename`  command. The syntax to start accounting is: `accton filename`
   
 Where accounting information is appended to filename, now, strangely enough, the  Where accounting information is appended to filename, now, strangely enough, the
Line 871  To stop accounting, simply type accton w Line 871  To stop accounting, simply type accton w
   
 To read accounting information, there are two tools that can be used:  To read accounting information, there are two tools that can be used:
   
  * [lastcomm(1)](http://netbsd.gw.com/cgi-bin/man-cgi?lastcomm+1+NetBSD-5.0.1+i386)   * [[!template id=man name="lastcomm" section="1"]]
  * [sa(8)](http://netbsd.gw.com/cgi-bin/man-cgi?sa+8+NetBSD-5.0.1+i386)   * [[!template id=man name="sa" section="8"]]
   
 #### lastcomm  #### lastcomm
   
Line 1228  cures for this, first, modify that param Line 1228  cures for this, first, modify that param
 NetBSD's *ramdisk* implementations cache all data in the RAM, and if that is  NetBSD's *ramdisk* implementations cache all data in the RAM, and if that is
 full, the swap space is used as backing store. NetBSD comes with two  full, the swap space is used as backing store. NetBSD comes with two
 implementations, the traditional BSD memory-based file system  implementations, the traditional BSD memory-based file system
 [mfs](http://netbsd.gw.com/cgi-bin/man-cgi?mount_mfs+8+NetBSD-current)  [[!template id=man name="mfs" section="8"]]
 and the more modern  and the more modern
 [tmpfs](http://netbsd.gw.com/cgi-bin/man-cgi?mount_tmpfs+8+NetBSD-current).  [[!template id=man name="tmpfs" section="8"]].
 While the former can only grow in size, the latter can also shrink if space is  While the former can only grow in size, the latter can also shrink if space is
 no longer needed.  no longer needed.
   
Line 1345  following sysctls can be used: Line 1345  following sysctls can be used:
     vfs.lfs.ignore_lazy_sync      vfs.lfs.ignore_lazy_sync
   
 Besides tuning those parameters, disabling write-back caching on  Besides tuning those parameters, disabling write-back caching on
 [wd(4)](http://netbsd.gw.com/cgi-bin/man-cgi?wd+4+NetBSD-5.0.1+i386) devices may  [[!template id=man name="wd" section="4"]] devices may
 be beneficial. See the  be beneficial. See the
 [dkctl(8)](http://netbsd.gw.com/cgi-bin/man-cgi?dkctl+8+NetBSD-5.0.1+i386) man  [[!template id=man name="dkctl" section="8"]] man
 page for details.  page for details.
   
 More is available in the NetBSD mailing list archives. See  More is available in the NetBSD mailing list archives. See
Line 1383  SPARC it would be under `src/sys/arch/sp Line 1383  SPARC it would be under `src/sys/arch/sp
   
 After you have located your kernel config file, copy it and remove (comment out)  After you have located your kernel config file, copy it and remove (comment out)
 all the entries you don't need. This is where  all the entries you don't need. This is where
 [dmesg(8)](http://netbsd.gw.com/cgi-bin/man-cgi?dmesg+8+NetBSD-5.0.1+i386)  [[!template id=man name="dmesg" section="8"]]
 becomes your friend. A clean  becomes your friend. A clean
 [dmesg(8)](http://netbsd.gw.com/cgi-bin/man-cgi?dmesg+8+NetBSD-5.0.1+i386)-output  [[!template id=man name="dmesg" section="8"]]-output
 will show all of the devices detected by the kernel at boot time. Using  will show all of the devices detected by the kernel at boot time. Using
 [dmesg(8)](http://netbsd.gw.com/cgi-bin/man-cgi?dmesg+8+NetBSD-5.0.1+i386)  [[!template id=man name="dmesg" section="8"]]
 output, the device options really needed can be determined.  output, the device options really needed can be determined.
   
 #### Some example Configuration Items  #### Some example Configuration Items
Line 1466  that the `cd`-drive is on an atapibus an Line 1466  that the `cd`-drive is on an atapibus an
 that is of interest in this case is the kernel config's "IDE and related  that is of interest in this case is the kernel config's "IDE and related
 devices" section. It is worth noting at this point, in and around the IDE  devices" section. It is worth noting at this point, in and around the IDE
 section are also ISA, PCMCIA etc., on this machine in the  section are also ISA, PCMCIA etc., on this machine in the
 [dmesg(8)](http://netbsd.gw.com/cgi-bin/man-cgi?dmesg+8+NetBSD-5.0.1+i386)  [[!template id=man name="dmesg" section="8"]]
 output there are no PCMCIA devices, so it stands to reason that all PCMCIA  output there are no PCMCIA devices, so it stands to reason that all PCMCIA
 references can be removed. But first, the `cd` drive.  references can be removed. But first, the `cd` drive.
   
Line 1490  Well, it is pretty obvious that those li Line 1490  Well, it is pretty obvious that those li
     ...      ...
   
 The only device type that was in the  The only device type that was in the
 [dmesg(8)](http://netbsd.gw.com/cgi-bin/man-cgi?dmesg+8+NetBSD-5.0.1+i386)  [[!template id=man name="dmesg" section="8"]]
 output was the cd, the rest can be commented out.  output was the cd, the rest can be commented out.
   
 The next example is slightly more difficult, network interfaces. This machine  The next example is slightly more difficult, network interfaces. This machine
Line 1575  We already know how to remove Kernel sup Line 1575  We already know how to remove Kernel sup
 don't need, thus saving memory and space, but you can save some KiloBytes of  don't need, thus saving memory and space, but you can save some KiloBytes of
 space by removing debugging symbols and two ELF sections if you don't need them:  space by removing debugging symbols and two ELF sections if you don't need them:
 `.comment` and `.ident`. They are used for storing RCS strings viewable with  `.comment` and `.ident`. They are used for storing RCS strings viewable with
 [ident(1)](http://netbsd.gw.com/cgi-bin/man-cgi?ident+1+NetBSD-5.0.1+i386) and a  [[!template id=man name="ident" section="1"]] and a
 [gcc(1)](http://netbsd.gw.com/cgi-bin/man-cgi?gcc+1+NetBSD-5.0.1+i386) version  [[!template id=man name="gcc" section="1"]] version
 string. The following examples assume you have your `TOOLDIR` under  string. The following examples assume you have your `TOOLDIR` under
 `/usr/src/tooldir.NetBSD-2.0-i386` and the target architecture is `i386`.  `/usr/src/tooldir.NetBSD-2.0-i386` and the target architecture is `i386`.
   
Line 1623  On the third column we can see the size  Line 1623  On the third column we can see the size 
 summing `.comment` and `.ident` sizes we know how much we're going to save with  summing `.comment` and `.ident` sizes we know how much we're going to save with
 their removal: around 120KB (= 52640 + 72164 = 0xcda0 + 0x119e4). To remove the  their removal: around 120KB (= 52640 + 72164 = 0xcda0 + 0x119e4). To remove the
 sections and debugging symbols that may be present, we're going to use  sections and debugging symbols that may be present, we're going to use
 [strip(1)](http://netbsd.gw.com/cgi-bin/man-cgi?strip+1+NetBSD-5.0.1+i386):  [[!template id=man name="strip" section="1"]]:
   
     # cp /netbsd /netbsd.orig      # cp /netbsd /netbsd.orig
     # /usr/src/tooldir.NetBSD-2.0-i386/bin/i386--netbsdelf-strip -S -R .ident -R .comment /netbsd      # /usr/src/tooldir.NetBSD-2.0-i386/bin/i386--netbsdelf-strip -S -R .ident -R .comment /netbsd
Line 1650  To see how much space we've saved: Line 1650  To see how much space we've saved:
     -rwxr-xr-x  1 root  wheel  3987769 Apr 29 18:05 /netbsd.gz      -rwxr-xr-x  1 root  wheel  3987769 Apr 29 18:05 /netbsd.gz
   
 Note that you can only use gzip coding, by using  Note that you can only use gzip coding, by using
 [gzip(1)](http://netbsd.gw.com/cgi-bin/man-cgi?gzip+1+NetBSD-5.0.1+i386), bzip2  [[!template id=man name="gzip" section="1"]], bzip2
 is not supported by the NetBSD bootloaders!  is not supported by the NetBSD bootloaders!
   

Removed from v.1.2  
changed lines
  Added in v.1.3


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb