Linux in Government: Optimizing Desktop Performance, Part II
As we discussed in last week's article, for most of its existence, people have distributed Linux as a workstation or a server rather than as a desktop. The default workstation that evolved has existed mostly for use by developers. So, when you install a Linux distribution with a graphical interface, it generally looks like what a developer might want. In addition, it performs similar to how many UNIX workstations work, which can seem slow.
In this article, we continue to look at the Linux desktop in a different light. Here, we think of it as a computer system with a fast interface that we can optimize for the knowledge worker and consumer.
Many points exist in a PC where an operating system can slow down. The most common point for this to happen lies between random access memory (RAM) and the hard drive. Similar to increasing the amount of RAM in your computer, you may find that purchasing a better hard drive can improve your performance. Follow the discussion below, and you should see why you may need a better hard drive.
By enabling Direct Memory Access (DMA), data can transfer directly from a hard drive's buffer to the computer's main memory, leaving the processor uninvolved. Although the results vary depending on the devices in your PC, using DMA should improve performance. You should try this to see if you experience improvements in disk performance. Please refer to Figure 1.
Most Linux distributions set the using_dma option to 1, and the Linux kernel normally sets DMA automatically. I discovered that in my system the flag was set to 0, which meant my using_dma option was off. Take a look at the top of Figure 1 which represents where I tested my hard drive parameter.
When I ran the command hdparm -t /dev/hda, my disk read 24MB in 3.11 seconds, which does not provide for the best disk access. So, I turned on using_dma using the hdparm -d 1 /dev/hda command and found that my disk access increased from 24MB in 3.11 seconds to 140MB in 3.01 seconds. You can see the results in the gray area of Figure 1.
Simply turning on using_dma enables a 16-bit mode, so I switched to 32-bit mode and found that my read time improved slightly. My buffered disk reads went from 46.50MB per second to 46.52MB, not much of an improvement. I also looked at turning on multiple sector I/O. This is a feature of modern IDE hard drives that permits the transfer of multiple sectors per I/O interrupt rather than the usual one sector per interrupt. When this feature is enabled, it typically reduces operating system overhead for disk I/O by 30-50%. On many systems, it also provides increased data throughput of anywhere from 5% to 50%.
I then ran the command hdparm -m /dev/hda and saw the following result:
/dev/hda: multcount = 16 (on)
But my buffering slowed down:
138 MB in 3.02 seconds = 45.72 MB/sec
In Fedora Core 3, you can change hdparm parameters in the /etc/sysconfig/harddisks file by uncommenting values. However, unless you see a significant improvement, don't make any changes. Simply buy a better hard drive.
Window frame image files can slow down system performance depending on the technique a theme maker uses to draw a frame. In GNOME, for example, the Crux window frame option loads slowly depending on CPU resources. In the system I used to test, I used a Sempron 2200 with a clock speed of 1.5GHz. To reduce CPU usage, I changed my frame options and noticed an increase in application start-up speed. For example, I downloaded and installed a theme called Atlanta and ran:
# gconftool-2 --type string --set /apps/metacity/general/theme Atlanta
I also could have changed the window frame by using Launch->Preferences->Theme and selected Theme Details. Then I could have selected the Window Border tab, clicked on Atlanta and closed.
Although themes use is subjective and people like to select their own eye candy, enterprises tend to want to get the best performance possible. You might try different combinations of theme elements to see if you find a difference in performance.
When you log in to a GNOME desktop, you see a splash screen, which displays icons and takes up time. I turn off my splash screen in order to reduce CPU cycles and because I find it annoying. If you have limited resources, you can use this command to save CPU cycles or get rid of the splash screen if you find it annoying:
# gconftool-2 --type bool --set /apps/gnome-session/options/show_splash_screen false
Users also can get to the splash screen options by using Launch->Preferences->More Preferences->Sessions and then unchecking it in the first tab. See Figure 2 for a look at the Sessions options.
Notice that you have several options from which to choose in the Sessions tool. Later, we use the third tab, Startup Programs, to show you how to load a script to improve the start-up time for OpenOffice.org.
- Brent Laster's Professional Git (Wrox)
- Machine Learning Everywhere
- Smoothwall Express
- Own Your DNS Data
- Bash Shell Script: Building a Better March Madness Bracket
- Returning Values from Bash Functions
- From vs. to + for Microsoft and Linux
- Simple Server Hardening
- Understanding OpenStack's Success
- Tech Tip: Really Simple HTTP Server with Python