Server Load (Wikipedia)

The first year of Wikipedia’s existence, the encyclopedia was growing quickly, but by technology standards it was not too demanding on computing resources. It had grown to 20,000 articles in one year, but it was still a project largely known only to the tech elite. Wikipedia basically ran on one large computer for the first two years of its life, since the wiki software really couldn’t benefit from having more hardware. But in 2003, Manske and others started to see the cracks form as the English language Wikipedia chalked up more than a hundred thousand articles, and more than a dozen other languages were growing quickly. The traffic was climbing, the demands getting more complex, and there were brief outages and slowdowns, as the system could not keep up with the traffic.

They started to look into other solutions. At the very least, they could split the load of the wiki between two computers—one for the Web server and one for the database. In combining their computing horsepower, the two machines would talk to each other over a high-speed network connection.

As Wikipedia’s traffic climbed even higher, in January 2004 a major change was made to make a drastic bump in the site’s capabilities. Nine new server computers were purchased. One served as the database server, while the other eight serviced requests from Web visitors. It was a major upgrade in quality for the public, as 2003 had seen some major multi-day outages of Wikipedia, something hardly imaginable today. While there was eight times the capacity to serve visitors, having only one machine handling database functions did prove a bottleneck. In the art and science of Web server solutions, you don’t always get proportional bumps in capacity if you "throw hardware at the problem."

That year, Wikipedia followed an exponential growth curve, such that more than thirty machines were purchased to serve the load. Even then, the additional hardware could not speed up the database significantly.

At the end of the year, the volunteers who helped do system administration had an idea from seeing what other major Internet sites were using. By doing a clever job of caching, or storing frequently used information in computer memory, and not taxing the database and computer processors, you could get a manyfold increase in speed. One of the major improvements was the installation of what the volunteers call "squid" servers.

Normally when one visits a Web site, the Web server makes a computationally demanding request to fetch you the desired page. For Wikipedia it’s a pretty taxing operation if it accesses the database and has to compete with other people’s requests as well. A peculiar thing about Wikipedia, and most Web sites, is that 90 percent or more of the queries are simply requests to read articles. "I want to see the article on Dog," for example. In these cases, if the page for [[Dog]] can be serviced without hitting the database, it’s a faster response for the user, and it reduces the load on the database server.

This is essentially what the clever Wikipedia developers did with two technologies—squid servers and memcached, both open source software packages. A squid is a very lean Web server that tries to serve Web requests very quickly from what is stored in memory, and memcached is a program to help groups of squid computers share their memory to store information efficiently. They work as a team to avoid putting a load on the database servers.

This allowed for a team of machines to respond to a page request quickly if that page had been accessed recently. If the page could not be found in the memory of the squid/memcached system (a "cache miss"), then a normal request would be sent to the database server. But more often than not, requests had a "cache hit" and the page was sent quickly.

The results were dramatic. The developers reported the news:

[Squids] are currently running at a hit-rate of approximately 75%, effectively quadrupling the capacity of the Apache servers behind them. This is particularly noticeable when a large surge of traffic arrives directed to a particular page via a web link from another site, as the caching efficiency for that page will be nearly 100%.26

By putting up a "front line" of computers that handled user requests, Wikipedia was able to get an instant boost in performance because the bulk of page requests were being serviced from the cache, and not bothering the database server.

It was a godsend. Through the squid and memcached software, and some slight modification to the wiki software code, the exact same hardware was able to handle many times the number of visitors as before. And even better, with this solution, throwing more hardware at the problem helps. More machines means more memory and more computing power to service requests.

It’s this industrial-strength caching solution, and a clever crew of volunteer programmers, that allowed Wikipedia to scale to become a top ten Web site, with a budget of less than a million dollars.27

It should be noted, as a historical footnote, that Richard Stallman, who inspired the free software and free content movement, also proposed his own encyclopedia in 1999, and attempted to launch it the same year that Wikipedia took off. Called GNUpedia, it coexisted confusingly in the same space as Bomis’s Nupedia, a completely separate product. Keeping with tradition, Stall-man renamed his project GNE—GNU’s Not an Encyclopedia. But in the end, Wikipedia’s lead and enthusiastic community was already well established, and Richard Stallman put the GNE project into inactive status and put his support behind Wikipedia.

Next post:

Previous post: