Download your favorite Linux distribution at LQ ISO.
Go Back > Articles > Jeremy's Magazine Articles
User Name


By jeremy at 2005-01-07 11:00
Peeking In, At Linux
by Jeremy Garcia

Last month's "Tech Support" showed how to monitor resource utilization with Cacti. This month, let's use vmstat to track down any bottlenecks that Cacti might have found. Part of the procps package (which contains many other useful utilities such as ps, top, w, and kill), vmstat reports statistical information about process status, memory consumption, paging activity, block I/O operations, interrupts, context switches, and processor usage. vmstat is available from and is licensed under the GPL. While you can download and install the latest version of procps, it's a standard set of utilities found in almost every Linux install.

A nice feature of vmstat is its overview of process, memory, swap, I/O, system, and CPU activity in just one line of numbers. Figure One shows a sample of vmstat output.

Figure One: Sample output of vmstat

procs                      memory      swap          io     system         cpu
 r  b   swpd   free   buff   cache   si   so    bi    bo   in    cs us sy id wa
 0  0      0 104232 218884 3364308    0    0     0     1    1     1  4  1  0  1
Briefly, r and b are the number of processes waiting for run time and the number of processes in uninterruptible sleep, respectively. swpd, free, buff, and cache display how much virtual memory is being used (kB), the amount of idle memory (kB), the amount of memory used as buffers (kB), and the amount of memory used as a page cache, in that order. si shows the amount of memory swapped in from disk (kB/s), while so conveys the amount of memory swapped to disk (kB/s). bi and bo reflect the blocks sent to and from a block device (in blocks per second), respectively. in measures the number of interrupts per second, including the clock. cs shows the number of context switches per second. Finally, us, sy, id, and wa display the percentage of total processor time consumed by user-space, the kernel, spent idle, and spent in I/O wait, respectively.

vmstat can be invoked in a few different ways. Typing vmstat with no parameters yields a single line of output containing averages (calculated from the time the system was last booted). Given an optional delay, such as vmstat 5, vmstat prints a line with averages as above, and then prints a new line every 5 seconds until interrupted. Each line after the first represents the values for that time period. Lastly, you can specify a delay and a count value, as in vmstat 5 10, to print a report every 5 seconds terminating after 10 lines. Five seconds seems to be a good delay, as the output is based on a reasonable amount of data.

Fully interpreting vmstat output requires an in-depth understanding of Linux or Unix architecture, but you'll quickly find it useful with a couple of tips and a little testing.

For example, if the r column is consistently higher than the number of CPUs in the machine, you are most likely CPU-bound and would benefit from more or faster processors. You can find out what's eating your CPU time using a tool such as top. With similar reasoning, you can deduce whether your bottleneck is caused by memory or I/O and then use an appropriate tool to narrow down the problem or upgrade your hardware. Don't forget that, regardless of how much memory you have, the free column eventually dwindles. This is normal and is a result of your memory being used for I/O cache and buffers -- it is not necessarily indicative of a memory shortage.

Installing True Type Fonts

If you own a new flat-panel display, but your web pages and documents just don't "look right," perhaps you need to install True Type fonts. Many web pages and documents use True Type fonts, but by default, Linux doesn't have any installed. Luckily, Xfree86 4.0 and above supports True Type fonts. (If you're using an older version of X you can either upgrade, or install a font server such as xfsft.)

The first thing to do is find a copy of each of the fonts that you'd like to install. The easiest way to do this is to copy them from a Windows machine or from a CD-ROM. Some True Type fonts can even be downloaded from the Internet.

Once you've found some fonts, choose where to install them, such as /usr/share/fonts/truetype/. Then copy all of the .ttf files into the directory and run the following commands as root:

# cd /usr/share/fonts/truetype
# ttmkfdir > fonts.scale
# mkfontdir
# chkfontpath -a /usr/share/fonts/truetype
# fc-cache
Now, the True Type fonts in that directory are available to your applications.

The instructions above should work for most distros. Some distributions include configuration tools or tricks to make font installs even easier. Regardless of how you install them, True Type is sure to greatly improve your Linux experience. Enjoy.

by minrich on Sat, 2005-01-08 11:05
Hi jeremy

Do you know if these instructions work for Xorg as in Suse9.2. Because if so I will try them under VMware.


by jeremy on Sat, 2005-01-08 11:35
The font instructions (which I assume is the section you are interested in) should work fine in Xorg. Just make sure you have:
Load  "freetype"
in your modules section.


by quixote9 on Sat, 2005-05-21 22:00
That was an awesomely simple and useful set of instructions on how to get truetype fonts. By far the best thing I've seen out there. And it worked flawlessly. I have all the fonts I'm used and I'm totally tickled. Thanks!


by jeremy on Sun, 2005-05-22 13:44
Thanks for the feedback quixote9.



All times are GMT -5. The time now is 12:11 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration