Linux in Government: Optimizing Desktop Performance, Part III

by Tom Adelstein

As we discussed in Part I and Part II of this article series, 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 fits the preferences of a developer. In addition, it performs like many UNIX workstations do, which can seem sluggish.

Some default features of Linux that seem slow to a new desktop user appear perfectly acceptable to long-time workstation users. When we begin to disable services that slow down the boot process, some Linux users might object. For instance, killing the mail transfer agent could mean that service messages meant for root or admin are not sent. Someone wanting to boot up her laptop quickly, however, might not care about that. For system administrators and developers, though, the missing chance to analyze a program flaw becomes a lost opportunity.

Most developers and administrators do not reboot their workstations. They consider uptime an important measurement of Linux's stability and do not seem to mind if services run that they do not use. If you run the command top, you can see why. Take a look at Figure 1.

Linux in Government: Optimizing Desktop Performance, Part III

Figure 1. Running top to View Processes

As you can see in Figure 1, 70 processes or tasks exist, but 68 are sleeping. Open a terminal and run top on your own system, and watch as processes come alive and go to sleep. To quit the program, simple type q. So even if you started a service, it may rarely wake up and take up many CPU cycles or need much memory.

For desktop and laptop users who want a fast-booting operating system, getting rid of services you do not need can appear to improve performance. Obviously, if you are new to Linux, though, you probably do not know which processes you can get rid of safely nor how to stop them and keep them from restarting at boot time.

Note: In the first part of this series we said we would concentrate on Fedora Core 3 and Ubuntu 5.04. That has not changed. Depending on your distribution, some of the tweaks discussed in this series may not apply.

Also, some readers have suggested we put a warning label on our tweaks. When you try any suggestion we discuss, realize that they could have risks associated with them. Although we want to maximize performance, you have to experiment with some of our suggestions. Some of our examples may exist simply for illustration sake, such as the exercise with hdparm. We illustrated and stressed that hard drives had the potential to increase or decrease performance. You may understand how a hard drive can improve performance and choose to live with your existing situation anyway.

The Initialization Process in Linux

Before you can scale down processes in your installation of Linux to achieve increased performance, it helps to understand a little about how the operating system initializes services at boot time. Although this represents a simplistic explanation, it can provide enough background for you to accomplish the task of disabling unwanted services.

During boot up, the init process runs and starts software after the kernel initializes all devices. Depending on the distribution, Linux defines system states or runlevels such as text mode or graphics mode. In Fedora when you issue the command #init 3, for example, you put Linux in a full multiuser support state with the full range of services available, but you only see a text or command-line interface. Running #init 5 causes you to change states and run in graphical mode.

Linux-dedicated servers often run in init 3 mode. To give you an idea of how people regarded Linux before the maturity of GNOME and KDE, here's a 1999 quote from Craig Hunt (Linux Network Servers, Sybex):

Runlevel 5 initializes the system as a dedicated X Windows terminal. I don't think that is the best use for a powerful Linux system, but if you want to, you can use the system as a terminal by starting in runlevel 5.

Linux developers have taken the operating system from a simple X manager during the 1998-1999 timeframe to a complete graphical desktop that competes with Microsoft's and Apple's offerings. So, if you simply want a Linux desktop, you probably want to start out in graphical mode instead of text mode. In Fedora that means you live in runlevel 5, and in Ubuntu you live in runlevel 2.

Tools of the Trade

If you use Fedora Core 3, you can find the system-config-services tool on you applications menu by selecting applications -> System Settings --> Server Settings --> Services. When you select that option, you then see a prompt asking for you administrator's password. Enter that and you next see a window similar to the one shown in Figure 2.

Linux in Government: Optimizing Desktop Performance, Part III

Figure 2. system-config-services Screen

On the left side of Figure 2 you can see a list of services currently running in runlevel 5, your default run level.

From time to time, Fedora users happy with their distribution may run across comments on mailing lists and forums that call the distribution "bloatware". Webopedia defines bloatware as:

(n.) jargon Software that has lots of features and requires considerable disk space and RAM. As the cost of RAM and disk storage has decreased, there has been a growing trend among software developers to disregard the size of applications. Some people refer to this trend as creeping featuritis. If creeping featuritis is the symptom, bloatware is the disease.

If you look at the services checked list in Figure 2, you can see that many services have been selected. Keep in mind that Red Hat makes Fedora available to provide a test bed for innovations it plans to incorporate into its Red Hat Enterprise Linux offering. One might consider Fedora bloatware if Red Hat sold the product. As it stands, I consider Fedora to be a good product and one I can modify to suit my preferences.

For desktop purposes, I start by disabling apmd, autofs, identd, ip6tables, iptables, isdn, lpd, nfs, portmap, talkd and sendmail. You can do this using system-config-services. Remember, though, that whatever you disable in runlevel 5, you also should consider disabling in other runlevels. If you run the command #init 3 and don't go into that mode elegantly, you have to go back and check your service settings.

Another way to edit your services in Fedora involves the command-line utility called ntsysv. When you run that command, you see a screen similar to the one shown in Figure 3.

Linux in Government: Optimizing Desktop Performance, Part III

Figure 3. Editing Fedora

Unfortunately, space requirements here do not allow for a detailed discussion of each service. If you are not familiar with them, use the system-config-services utility, shown in Figure 2, and read about each one. Also, use Google to search for the ones with which you are unfamiliar.

Other services people may wish to disable on Fedora include:

  • mDNSResponder: used by Howl clients to perform Zeroconf service discovery on a network; should not be running otherwise.

  • mdmonitor: software RAID monitoring and management multipath device not required for single drive systems.

  • mdmpd: used to create, manage and monitor software RAID volumes.

  • httpd: not necessary unless you're running a Web server.

  • iptables: used for firewalls.

  • kudzu: used to discover new peripheral devices; can be redeployed if you add peripherals later.

  • mysqld: unnecessary if you are not using a database.

If you are not using the Network File System (NFS), you also can disable netfs, netplugd, network, nfslock and nfs. And, if you are not sharing a network with Microsoft Windows, you can disable smb and nmb.

I also chose to disable SELinux on my desktop because of its resource requirements. I consider SELinux important for servers or, when needed, in secure and classified environments but not necessary for normal desktop use. As with other services, test and see if it slows down your boot process or inhibits desktop performance.

Ubuntu Services for Performance Tuning

Unlike Fedora, most Linux users do not consider Ubuntu to be a bloatware distribution. In its default mode, few services run unnecessarily. Still, for strictly desktop use, I have found some tweaks that can increase performance.

Ubuntu does not come with a graphical tool to disable services. If you have the necessary skills to run the commands in text mode to manage services, you probably already know which ones you want enabled or disabled. I downloaded several from Ubuntu repositories, including sysv-rc-conf, rcconf and bum. I found bum to be the most comprehensive and user-friendly tool for Ubuntu.

You'll have to download bum from its Web site. Once you install it and log back into your desktop, you should see it in the menu listed as Boot-up Manager, bum for short. See Figure 4.

Linux in Government: Optimizing Desktop Performance, Part III

Figure 4. Menu for Boot-Up Manager

Once you select bum from the menu, you have to enter your admin password. You should see something similar to the window shown in Figure 5.

Linux in Government: Optimizing Desktop Performance, Part III

Figure 5. Boot-Up Manager for Ubuntu (bum)

As you can see, the Boot-Up Manager for Ubuntu provides significant detail. In many instances it can provide you with enough information to prevent you from making a mistake when you disable or enable a service.

In Ubuntu, I disabled several services for strictly desktop use. I began with the following:

  • ntpdate: a utility that updates the system clock on each reboot.

  • pcmcia: used only with laptops if one has PCMCIA cards.

  • ppp: point-to-point protocol used only if you have a modem. I disabled the built-in modem in my desktop and only use a network interface card.

  • powernowd: I use an AMD processor with Ubuntu and this service does not work with AMD.

  • rsync: a utility that provides fast incremental file transfer if you wish to mirror or back up data. I don't use it.

  • fetchmail: a utility to retrieve and forward mail and act as a gateway to smtp. I use a Linux groupware client, so I do not use this utility.

  • postfix: a mail transfer agent similar to sendmail. I use a mail server from my ISP and our company domain, so I don't see a need for this.

Once I unchecked these services in bum, I rebooted and noticed a significant decrease in the time required to reach my GNOME desktop. I then surveyed my system and disabled additional services, including LVM, mdadm, EVMS and pppd-dns. Again, I rebooted and saw a significant decease in boot-up time.

Another Note: Ubuntu installs with a default kernel set for i386 processors. Because I use an i686 kernel, I found upgrading also increased my system performance significantly. To do this, you can use Synaptic to search for linux-image-2.6.10-5-k7 if you use AMD or linux-image-2.6.10-5-686 for Pentium Pro/Celeron/Pentium II/Pentium III/Pentium IV.

The developers generally produce kernel image packages if you wish to create a custom kernel from the sources. We will cover that process in a future article.

By selecting and installing the kernel package, you can upgrade your default kernel to one optimized for new processors. You should experience a performance increase.

If you decide to disable the services mentioned above, consider using the graphical Boot-Up Manager (bum). I have read some disturbing suggestions from users concerning modifying init scripts. You want to have the ability to go back and enable services if disabling them causes you trouble. With bum, you can do that. With some command-line techniques, you might discover yourself in a nest of mad hornets without an escape plan.

Important Comments

The subject of loading Linux services and the initialization process demands experience and knowledge that many desktop users do not possess. If you venture into disabling services you deem unnecessary, I strongly suggest that you subscribe to a newsgroup or forum dedicated to your distribution--you probably will need support.

On the other hand, you might find that you have a knack for Linux operating system internals. If so, explore the subject on-line by searching for Linux documentation. Linux provides fascinating technology you could not learn about with proprietary systems. Many different points of view exist on just about every subject concerning Linux technology. If you have the desire to know more about what makes your computer tick, the opportunity awaits.

Tom Adelstein is a Principal of Hiser + Adelstein, an open-source company headquartered in New York City. He's the co-author of the book Exploring the JDS Linux Desktop and author of an upcoming book on Linux system administration to be published by O'Reilly. Tom has been consulting and writing articles and books about Linux since early 1999.

Load Disqus comments

Firstwave Cloud