LJ Archive

Ye Old Laptop as a Server

Joseph Quigley

Issue #164, December 2007

Don't throw away that old laptop; use it as a mobile VoIP and Web server.

Resourceful people can use an old desktop as a server of some sort, but they also may have an old laptop around collecting dust. Although most of today's desktop environment software runs too slowly on these older laptops, you may not want to get rid of yours yet. These cast-offs easily can be transformed not only into a low-power server, but also into a mobile VoIP and Web server.

Let's look a three Linux distros with this in mind and test two different Web servers. The Ye Old Laptop used in this article is a Dell Latitude with a 1.0GHz Intel Pentium III Mobile CPU and 256MB of RAM. Keep in mind that Web 2.0 software may be too much for these old cast-offs. So, if you need to serve the latest-and-greatest flashy content, you're better off buying a new desktop computer. The server configuration I used and tested on every Linux distribution is Apache 1.3.34, Lighttpd 1.4.13, PHP 5 and MySQL Server 5.

Xubuntu 7.04

Xubuntu is an official Ubuntu distribution for old or slow systems. The main difference between it and Ubuntu is that Xubuntu uses the Xfce window manager instead of GNOME. An X-less Ubuntu or Kubuntu installation should have the same performance results as an X-less Xubuntu. With X running, Xubuntu requires at least 128MB of RAM, but the minimum requirements for the Xubuntu Alternate CD without X are 64MB of RAM. It uses the Ubuntu repositories, which are filled with programs that satisfy nearly every system administrator's needs. I installed Apache 1.3 and Lighttpd 1.4, MySQL Server 5 and PHP 5 with apt-get install apache lighttpd and apt-get install mysql-server-5.0 php5. For some reason, I had to install Apache 2.0 (and all its dependencies) to get PHP to work with Apache 1.3. After I got it working, I then uninstalled Apache 2.0.

After configuring Apache and Lighttpd, I stress-tested the Web server over a 100Mb Ethernet connection with Siege, a benchmarking and HTTP regression-testing utility. It is designed to let Web developers measure the performance of both their code and their servers to see how well the server functions on the Internet under a heavy load. Siege supports basic authentication, the HTTP and HTTPS protocols, and even cookies. This utility allows system administrators to hit their Web server with both a concurrent and configurable number of simulated users.

I generated a 5KB file with dd and ran a stress test with siege 192.168.1.179/5kb -c10 -r10 on a fairly new computer, simulating ten clients refreshing ten times each second (a fairly heavy load). To improve results, I turned off all unneeded services, including Xorg, Samba, the FTP server and the IRC server. If you run Siege with the -b command-line argument, it runs the test without any delay for throughput benchmarking. This means that the server gets all the hits at once (but that isn't a very realistic scenario). Without the -b flag, Siege invokes each simulated user with a delay of at least one second. Table 1 shows the performance differences between Apache 1.3 and Lighttpd 1.4.13.

Table 1. Performance Differences between Apache 1.3 and Lighttpd 1.4.13 on Xubuntu with a 5KB File

Ten clients, ten hits/second, 5KB fileApache 1.3Lighttpd 1.4.13
Time elapsed9 secs8 secs
Data transferred0.2MB0.35MB
Server response time0.06 secs0.00 sec
Transaction rate11.00 trans/sec12.5 trans/sec
Throughput0.02MB/sec0.04MB/sec
Concurrency0.70.02
Longest transaction3.00 secs0.04 secs
Shortest transaction0.00 secs0.00 secs

The tests performed on Xubuntu 7.04 (Table 1) reveal that the transaction rate is high, and the shortest transfer time is about a millisecond or less. (Siege can't calculate anything below a millisecond.) This is mainly because my network consists of only 20 feet of cable. Depending on your connection, testing over the Internet will show a greater latency than over a local network. According to the Siege man page, concurrency is the average number of simultaneous connections. When the number rises, the server performance decreases, especially on slower hardware.

Table 2. Performance Differences between Apache 1.3 and Lighttpd 1.4.13 on Xubuntu with a 1MB File

Ten clients, ten hits/second, 1MB fileApache 1.3Lighttpd 1.4.13
Time elapsed12 secs12 secs
Data transferred108.41MB108.40MB
Server response time0.5 secs0.4 secs
Transaction rate8.3 trans/sec8.2 trans/sec
Throughput9.0MB/sec8.9MB/sec
Concurrency4.33.5
Longest transaction1.30 secs0.75 secs
Shortest transaction0.1 secs0.1 secs

The tests performed on the 1MB file (Table 2) show that under a heavy load, Lighttpd 1.4.13 performs the best with smaller files (such as blog posts without any pictures). Performance, however, is still higher than Apache with 5KB files. Interestingly, the heavier the load, the better Apache performed. Results from tests on 5MB files under a very heavy load of 50 clients at ten connections per second showed a 0.1 second higher response time and a 0.1MB/sec higher throughput than Lighttpd. Lighttpd still had shorter transaction times that were four seconds less than Apache though.

On Xubuntu, Lighttpd is the fastest performing server for static documents, although Apache follows close behind. For best results in Xubuntu, turn off all unneeded services, so that if the server gets a heavy load, it will have a few more resources to improve speed. I found Xubuntu to be quite fast and easy to get running, but there are other distros to consider, such as Vector Linux.

Vector Linux 5.8

Vector Linux is another distro tuned for slower systems. It is based on Slackware 11, but unlike Slackware, Vector strives to retain legacy drivers for very old hardware. Its forum actively supports users of equipment that is considered to be outdated. It is even used for software development and Web serving, even though the distribution's focus is on the desktop environment.

Vector Linux comes with Slapt-get, an apt-like package manager for Slackware-based systems, by default. It is quite compatible with most Slackware packages on linuxpackages.net, so installing Web server software is quite straightforward. I couldn't get a package list from Linux Packages (at the time of this writing), so I gave up and compiled Apache, Lighttpd, PHP and MySQL from scratch. I copied over the Apache and Lighttpd configuration files from Xubuntu and made sure everything was working. Then, I fired up Siege and stress-tested it.

Table 3. Performance Differences between Apache 1.3 and Lighttpd 1.4.13 on Vector Linux with a 5KB File

Ten clients, ten hits/second, 5KB fileApache 1.3Lighttpd 1.4.13
Time elapsed9 secs7 secs
Data transferred0.49MB0.49MB
Server response time0.09 secs0.00 secs
Transaction rate11 trans/sec14.2 trans/sec
Throughput0.05MB/sec0.07MB/sec
Concurrency1.000.02
Longest transaction3.00 secs0.01 secs
Shortest transaction0.00 secs0.00 secs

Similar to the results with Xubuntu, Lighttpd is a clear leader in speed on Vector Linux as well (Table 3). On Vector Linux, Lighttpd has a noticeably higher transaction rate than Apache, and Apache's longest transaction is practically three seconds slower than Lighttpd's! Throughput is just a tiny bit greater with Lighttpd than with Apache, and the concurrency is shockingly low. This speed gap closes when Lighttpd is presented with a 1MB file. Just like working with Xubuntu, you should turn off any unneeded services and even cron jobs in Vector Linux for optimal performance.

Table 4. Performance Differences between Apache 1.3 and Lighttpd 1.4.13 on Vector Linux with a 1MB File

Ten clients, ten hits/second, 1MB fileApache 1.3Lighttpd 1.4.13
Time elapsed11 secs10 secs
Data transferred97.67MB97.67MB
Server response time0.4 secs0.3 secs
Transaction rate9.1 trans/sec10 trans/sec
Throughput8.9MB/sec9.7MB/sec
Concurrency3.593.21
Longest transaction0.63 secs0.65 secs
Shortest transaction0.08 secs0.08 secs

Lighttpd on Vector Linux is the fastest performing server for static documents (Table 4). Apache follows with good results. Results from tests on 5MB files also under a considerably heavy load of 50 clients at ten connections per second showed that Apache had an average response time about 150 milliseconds faster than Lighttpd. Lighttpd and Apache had nearly equal transaction rates and throughput, but Lighttpd's concurrency was higher than Apache's. Interestingly, Lighttpd's longest transaction time was a full ten seconds shorter than Apache's!

Slackware is often known for its almost legendary server qualities, and it appears that Vector Linux measures up to them. What happens though, when you go even smaller—as small as the 50MB Damn Small Linux?

Damn Small Linux 3.3

Damn Small Linux (DSL) is known for its small size and for running well on slower systems. It also has the apt package manager. With the right apt repository, you can practically turn DSL into a full-fledged distro! It was designed to run on very old hardware, including processors such as the 386, 486, Pentium, Pentium II, Pentium III and the older AMD equivalents. Unlike Vector Linux and Xubuntu, DSL uses the “classic” 2.4 Linux kernel and BusyBox, rather than the 2.6 kernel and the GNU utilities. Like Knoppix, it is designed to run off a Live CD (or USB thumbdrive), but it serves as an excellent desktop operating system too—if you don't mind using older versions of your frequently used software.

DSL is somewhat crippled for anything but Web browsing and music playing. To use DSL as a server OS, you will need to install the GNU utilities by selecting Apps→Tools→Upgrade to GNU Utils in the System menu. This will make the DSL system more fully GNU-compatible. If you plan to use apt, you need to click on Apps→Tools→Enable Apt in the System menu. Now that the GNU utilities are installed, you can install Apache or Lighttpd. I recommend compiling everything—PHP, MySQL and the http server—from scratch. Although this takes some time and effort, it is far less complex than trying to get everything working correctly with apt or MyDSL (Damn Small Linux's own spartan package system). By compiling the Web software from source, you have complete feature control as well.

For those who don't need or want Apache 1.3, the XAMPP Project has a completely configured and working standalone Apache 2, MySQL and PHP binary package that can install anywhere on the system.

Table 5. Performance Differences between Apache 1.3 and Lighttpd 1.4.13 on DSL with a 5KB File

Ten clients, ten hits/second, 5KB fileApache 1.3Lighttpd 1.4.13
Time elapsed7 secs10 secs
Data transferred0.49MB0.49MB
Server response time0.00 secs0.09 secs
Transaction rate14.2 trans/sec10 trans/sec
Throughput0.07MB/sec0.05MB/sec
Concurrency0.020.90
Longest transaction0.01 secs3.00 secs
Shortest transaction0.00 secs0.00 secs

The speed difference between Apache and Lighttpd is quite noticeable (Table 5); Apache is clearly the faster of the two. I used the Apache package in the MyDSL package manager though, which could be optimized for older systems. Interestingly, Apache had a higher transaction rate than Lighttpd did. It also had quite a low concurrency. Although Apache is noticeably faster than Lighttpd, the hardware constraints of the laptop make any Web server lousy at anything but small files under a heavy load. However, it could serve small blogs or PHP, Perl, Ruby and Python scripts under a medium load without getting too overloaded.

Although it may seem like Lighttpd is slacking off on the first test, when it has to pull a load, it does it efficiently.

Table 6. Performance Differences between Apache 1.3 and Lighttpd 1.4.13 on DSL with a 1MB File

Ten clients, ten hits/second, 1MB fileApache 1.3Lighttpd 1.4.13
Time elapsed11.7 secs10.8 secs
Data transferred97.66MB97.66MB
Server response time0.34 secs0.35 secs
Transaction rate8.5 trans/sec9.3 trans/sec
Throughput8.3MB/sec9MB/sec
Concurrency2.93.3
Longest transaction0.70 secs0.65 secs
Shortest transaction0.08 secs0.08 secs

Test results show (Table 6) that Lighttpd quickly regained its customary speed over Apache. Lighttpd's average response time is only a fraction faster than Apache's, but the transaction rate is almost a full megabyte per second more than Apache's. Lighttpd, however, has a higher concurrency, but that didn't pose a problem when I ran a test with 50 clients connecting ten times a second, as Lighttpd was still faster. Running this test on a 5MB file returned very disappointing results. Apache had the lowest of the longest transaction times but was otherwise the same as Lighttpd in throughput and transaction rates.

Overall, DSL is the smallest of the three distros tested in this article. When fleshed out with Apache/Lighttpd, GNU and other server utilities, the disk space used is less than 100MB. In general, Lighttpd and Apache on Damn Small Linux tie in practically every aspect. You will notice some minor speed improvements with X turned off, and although there aren't many, you still may want to turn off all unneeded services. In these days of broadband, even a quarter of a second can be a quarter second too slow. Damn Small Linux may seem like a strange distribution to use as a server OS, but there is no real reason why it can't be used as one—it's just one of the few actively developed distros that uses the 2.4 Linux. Like all distros, DSL needs to be tweaked so that you can get the most out of it.

Getting the Most out of the Server

Configuration is everything in a server. To milk some more speed from your server, you will want to configure it to your needs. Turn off all server modules you don't plan to use. Apache limits the number of users that can connect to the server at one time to around 5,000 clients. For a laptop with such limited capacities as the one used in this article, you most likely will want to lower this to 500–1,000 clients, depending on what kind of content you will be serving. For best results, eliminate unneeded features from the SQL Server and languages such as PHP, Python, Ruby or Perl, by recompiling from source, if need be.

SQL Servers can be resource hogs, so if you want to extract the most speed from your computer, you should configure the SQL Server to your needs. Both PostgreSQL and MySQL have pages on speed optimization on their Web sites (see Resources). In addition to functioning as Web servers, old laptops are great Voice-over-IP servers as well.

TeamSpeak

TeamSpeak is proprietary VoIP software that works similarly to a telephone conference call. Like IRC, users connect to a TeamSpeak server and join different chat channels. Its primary target audience is gamers, but it can be used for meetings and discussions or just to chat. Unlike Asterisk, TeamSpeak was designed for networked computer-to-computer voice calls, and it does not interact with the SIP protocol or any type of phone. It has similarities to IRC, such as channel administrators, protected channels and voiced channels. TeamSpeak can give various abilities and privileges to clients, ranging from server administrators who control the way the server or channel operates to anonymous users who have no privileges and can only chat.

The TeamSpeak Web site explains that the current game communication services, such as Roger Wilco or Microsoft's GameVoice, did not fulfill the creators' needs. Some of the primary problems with these services are the lack of Linux compatibility and the issues with high-bandwidth utilization and routers. The TeamSpeak server, however, runs with surprisingly low system requirements—a minimum of 32MB of RAM and a 100MHz CPU. With TeamSpeak on a laptop, you can have a LAN party and move from house to house to improve team communication while playing games such as Warsow, Tremulous or even console games. Another possibility is to meet with a few people at someone's house and have a meeting over the Internet with a few others around the planet.

Installing TeamSpeak on Xubuntu, Vector Linux and DSL was a piece of cake. I downloaded the server from its Web site, but ran into some dependency problems. I then stumbled across a how-to on the site that gave me a link to a version on an FTP site and included dependencies.

Which Distribution and Server Is Best?

In the Open Source world, myriad choices exist. The tests performed in this article cover different file sizes on two different Web servers running on three different Linux distributions.

The winner for the 1MB file tests is Lighttpd on Vector Linux. The transaction rate was an average of ten transactions per second and a throughput of 9.7MB per second. Damn Small Linux came in second place with an average of 9.3 transactions per second and a throughput of 9MB per seconds.

The competition for the 5KB file resulted in a tie between Apache on DSL and Lighttpd on Vector Linux. Both Lighttpd and Apache had average transaction rates of 14.2 transactions per second on Vector Linux and DSL, respectively. Throughput was the same for Apache on DSL as it was for Lighttpd on Vector Linux, weighing in at 0.07MB per second.

So, with all the different options and servers, making a selection boils down to three criteria: your machine, your needs and your abilities. When it comes to servers, Apache is an 800-pound gorilla that can do almost anything. Its extensibility through a variety of modules has made it the most common Web server on the market. If you're not looking to run a hosting service for Web developers on a laptop, Lighttpd's smaller size and simplicity could fill the bill. When it comes to Linux distributions, the three factors to take into consideration are size, simplicity and speed. If you are looking for speed, explore Vector Linux. If ease and simplicity are your highest priorities, try Xubuntu. If space is a problem, consider Damn Small Linux.

If you want a the fastest Web server that is also mobile, combine TeamSpeak with Lighttpd on Vector Linux. If you want to display LAN-party score results or serve pictures and short videos while maintaining communication with teammates anywhere in the world, or if you want to have a central meeting place and wiki or content management system with a few people around the globe, then Lighttpd, TeamSpeak and Vector Linux are right for the job.

Even though they have slower hardware, old laptops definitely can be used in place of desktops—so long as you don't expect very heavy loads. Figure out your priorities of speed, simplicity and size in distributions; then simplicity or speed in servers; and finally, simplicity, frugality and speed in VoIP. Resurrect ye old laptop, blow off the dust, and give it new purpose in life.

Joseph Quigley has been a Linux user for three years. He enjoys fiddling with different Linux distros and exploring new programming languages.

LJ Archive