The Tomcat-based Java implementation was bulky, difficult to manage, and couldn’t scale to meet the surge in traffic. Moreover, the MySQL back end was a bottleneck. According to Pattishall, “Every application and subapplication had a problem. And we had to fix it.”
Lighting the LAMP
Lunt had some prior job experience in the late 1990s with a variety of open source combinations, including running MySQL and Linux on Intel hardware and developing applications using Perl as a scripting language. He had also experimented with PHP, a language similar to Perl but optimized for Web development. After considering his options, Lunt led the charge to completely re-architect Friendster using Apache and PHP.
“We had to go back and rewrite the site,” Lunt says. “That was not a popular choice here. They had a couple Tomcat authors here who were pretty threatened by that.”
Still, Friendster pushed forward with LAMP because it was the only toolset that would allow the company to create its vision, according to Pattishall. “The one thing we kept the same was using open source software — using MySQL, code we could look at, and stuff we could download off the Net. This let us do things [our own] way,” he says.
Pattishall says the benefits of open source include better visibility in the architecture and more control of fixes. “With open source you can look directly at what is causing a problem, write your own fix, and get up and running in such a fast manner. Instead of waiting four weeks for a vendor to provide a qualified patch, you provide the fix yourself,” he says.
The transition to LAMP wasn’t entirely smooth. “What we were doing was challenging and hard. We were a top 40 Web site. We were dealing with a volume of traffic that most sites don’t dream of,” Lunt says.
Late-night emergencies were common, and firefighting consumed the whole of many days. The problems were so severe that discussions were had as to whether it might be more prudent to go a more traditional engineering route.
“There were discussions of ditching open source. Should we just buy off-the-shelf software that would do what we want?” Pattishall explains. “We investigated the market but found there wasn’t anything close to what we wanted to do, and it was way too expensive. We wouldn’t be able to execute on any business plan because we spent too much just on the software.”
What’s more, although taking the open source route may seem intimidating because of the difficulty in obtaining support, Lunt says traditional vendor support is not always a safety net, adding, “Commercial software support contracts are often a support blanket.”
Re-architecting the data
Some of Friendster’s biggest headaches came from the site’s MySQL implementation, according to Pattishall. “Everything was wrong with the usage of MySQL when I came in,” he says. “Everything was going through one location, which was a huge bottleneck. All our writes were taking forever.”
Rather than ditch MySQL for a large commercial RDBMS such as Oracle, however, Friendster’s IT team decided to rebuild its MySQL implementation, this time engineering it the right way.
“We worked to customize MySQL. We had great support from [MySQL AB, the parent company of the software]. We wouldn’t be able to do this with Oracle,” Lunt says. “The licensing costs would kill us. ... It’s a good product, but not that much better to justify the cost.”