Prefetch Technologies // Keeping your cache lines cozy

Observing Linux performance with dstat

linuxMar 8, 2009 3 min read

I mentioned a few posts back that I was playing with a bunch of Linux utilities. One of these utilities is dstat, which allows you to view a number of system statistics (disk utilization, network utilization, page activity, etc.) from the command line: The default output contains a number of useful statistics, but additional stats can be displayed if you pass a few options to dstat: The output above will overflow a standard 80 character wide display, so you may need to adjust the size of your terminal window to see everything. Dstat is an amazing utility, and yet another tool I plan to add to my performance analysis toolkit.

$ read more →

Viewing process utilization on Linux hosts with pidstat

linuxMar 7, 2009 2 min

While playing around with my Debian 5.0 host last week, I came across the pidstat utility. Pidstat allows you to display a number of statistics for processes running on a system (and threads inside that process), which can be incredibly useful for troubleshooting performance problems. To use pidstat to get a breakdown of how a given process is using the processors on a system, pidstat can be run with the "-p" option and the process ID to interrogate: Linux 2.6.26-1-686 (disarm) 03/07/2009 i686 08:07:18 AM PID %user %system %CPU CPU Command 08:07:20 AM 3297 11.06 74.37 85.43 0 dd 08:07:22 AM 3297 13.00 70.00 83.00 0 dd 08:07:24 AM 3297 10.95 72.64 83.58 0 dd If you are looking to see how much I/O a specific process is responsible for, you can run pidstat with the "-d" option: Linux 2.6.26-1-686 (disarm) 03/07/2009 i686 08:06:35 AM PID kB_rd/s kB_wr/s kB_ccwr/s Command 08:06:37 AM 3288 3.98 113319.40 0.00 dd 08:06:39 AM 3288 4.00 112514.00 0.00 dd 08:06:41 AM 3288 4.00 81454.00 0.00 dd And finally, to view paging activity per process, you can run pidstat with the "-r" option (and optionally the "-t" flag if you want to see thread activity): Linux 2.6.26-1-686 (disarm) 03/07/2009 i686 08:10:20 AM PID TID minflt/s majflt/s VSZ RSS %MEM Command 08:10:22 AM 3338 - 0.00 0.00 3180 596 0.23 dd 08:10:22 AM - 3338 0.00 0.00 3180 596 0.23 |__dd 08:10:22 AM PID TID minflt/s majflt/s VSZ RSS %MEM Command 08:10:24 AM 3338 - 0.00 0.00 3180 596 0.23 dd 08:10:24 AM - 3338 0.00 0.00 3180 596 0.23 |__dd 08:10:24 AM PID TID minflt/s majflt/s VSZ RSS %MEM Command 08:10:26 AM 3338 - 0.00 0.00 3180 596 0.23 dd 08:10:26 AM - 3338 0.00 0.00 3180 596 0.23 |__dd Pidstat is pretty darn cool, and I will definitely be using this in the future! Nice!

$ read more →

Configuring VLAN interfaces on CentOS Linux hosts

networkingFeb 28, 2009 1 min

I recently needed to configure a CentOS Linux host to use 802.1Q tagged queuing. This turned out to be super easy, and allowed me place the physical server on multiple layer-2 networks. To configure an 802.1Q interface, I first checked the ifcfg-eth0 script for the interface that was planning to participate in 802.1Q: Once I had the interface information, I created a ifcfg-vlan301 interface file with the VLAN number as well as the VLAN options: After the files were created, I used service to restart networking and everything came up smoothly. There are much better references on the Internet for Linux 802.1Q configuration, but I'm posting this here so I have a handy reference (and one I know works!).

$ read more →

Monitoring file activity on Linux hosts

linuxFeb 28, 2009 1 min

While reviewing one of my Linux hosts, I noticed that a bunch of write activity was occurring to one specific file system. I was curious to see what this write activity was, so I started reading up on the Linux inotify framework. Inotify allows you to monitor file system events, and the super useful iwatch utility provides a command line interface to the inotify framework. When iwatch is executed and passed the name of a directory on the command line, it will print all of the events that are applicable to that directory: This command line will cause a line to be printed to STDOUT each time an event is triggered due to operations taking place in /tmp…

$ read more →

Viewing man pages as a pdf on OS X

macosFeb 27, 2009 1 min

Picked up this neat little trick on command-line-fu. Read any UNIX man page in OS X as a pdf in preview

$ read more →