what's on our mind.

How the Cloud Drives Technology Adoption

Posted @ 10:32 am by charles johnson | Category: Technology | 0 Comments

Since Michael Kunze first coined the acronym ‘LAMP’ in 1998, the Linux, Apache, MySQL, and PHP software stack for web applications has become synonymous with rapid, stable, and inexpensive software development. Thousands of well-known applications, including this very blog, are developed and run on LAMP technology. Over time, it has proven itself so useful and reliable that it’s become the golden standard for rapid web development.

In software, however, 12 years is a lifetime. The wolves have begun to circle. In particular, serious alternatives are cropping up to both the MySQL database server and the Apache web server. And, as usual, it’s all about money.

To understand why a 16-year-old de facto standard like Apache, a Free software project that has withstood serious commercial competition from Netscape, Microsoft, Oracle, and dozens of others, is suddenly in serious danger of falling out of favor, one must first understand the economics of Cloud hosting.

In traditional hosting, RAM is cheap. Beyond the initial purchase cost, owning a server in a datacenter with 512MB of RAM isn’t really any more or less expensive than owning a server with 1GB of RAM, or 2GB of RAM, or 16GB of RAM. Once the part is in service, there isn’t any serious additional cost incurred by having that resource available. By contrast, in the Cloud model RAM is the primary lever by which costs increase. A single Rackspace Cloud server with 2GB of RAM costs as much as two Rackspace Cloud servers with 1GB of RAM. The increase is linear, too: 4 Rackspace Cloud servers with 1GB of RAM cost the same amount as a single Rackspace Cloud server with 4GB of RAM.

As the memory for a single node doubles, so does the price. But at the web tier, it’s almost always better to scale out, by splitting the workload among more servers, than it is to scale up, by keeping the workload on a few large servers. Four Rackspace Cloud servers with 1GB of RAM have four times the potential computational power of a single Rackspace Cloud server with 4GB of RAM, at the same price!

With this in mind, let’s talk once more about Apache. Apache is solid, versatile software. According to Netcraft, Apache runs almost 60% of the websites in the world, and for the vast majority of existing web projects there’s no reason not to continue to use it. Apache is extremely modular, and this modularity allows it to load interpreters for languages such as PHP, Python, .Net, and Perl directly into the web server itself. But this modularity is also an Achilles heel; many default installations of Apache include more than 50 modules out of the box. Each additional module consumes memory and CPU time as the web server runs, and each module is another set of configuration options and security considerations for a systems administrator to take into account. Further, as each language interpreter in Apache is treated as a module, this means that to run an Apache server that can handle 200 simultaneous PHP connections, PHP must be loaded into memory 200 times. For many modern web applications, this requirement quickly pushes the Apache+PHP stack out of the realm of what can be supported in 1GB of RAM, long before the available computational power at the CPU is used up.

When it comes to RAM, Apache scales up. But when it comes to the Cloud, the pricing scales out. To really make the most of an investment in Cloud-based hosting, we need a frugal webserver that is optimized around low-memory scenarios. Enter Nginx.

The Nginx (pronounced “Engine-X”) webserver is a 7-year-old project originated by programmer Igor Sysoev at Rambler Media. Under the hood, Apache and Nginx are very different creatures. Where Apache focuses on modularity, adaptability, and a Swiss-army-knife approach, Nginx instead focuses on speed, low resource consumption, and simple configuration. Rather than embedding the language interpreter into the webserver itself, Nginx forwards requests for PHP and other scripting languages to dedicated applications, then returns the results of those requests back to the user.

The upshot is that it becomes very simple to scale out when using Nginx: If a single Rackspace Cloud server with 1GB of RAM starts feeling the pinch as site traffic increases, then it’s easy to buy another 1GB Cloud server instead of paying that same amount to buy more memory for an existing server. And because of the frugality with which Nginx treats memory, the point at which that scaling must occur takes place later than it would with Apache.

The low-consumption design of Nginx brings it much more in line with the economic realities of Cloud hosting, and that’s allowing this Russian upstart with a cutesy-spelled name to take a serious shot at venerable old man Apache. The growth of Nginx has been meteoric: According to the January 2011 Netcraft report, while overall usage of Microsoft IIS and Apache are dropping year-over-year, the use of Nginx is up a full percentage point over January, 2010. A virtual unknown only two years ago, Nginx is now handling 7.5% of the world’s websites.

The point of this post isn’t to bad-mouth Apache. Apache remains a solid, tested choice, and is often the best option for many web applications, especially those hosted on physical servers. But in Cloud-based hosting environments, Nginx offers tangible benefits for most users that are becoming too great to ignore.

It’s a pity, though. LNMP just doesn’t have the same ring to it.

Leave a reply