dcsimg

IIS vs. Apache, Looking Beyond the Rhetoric

By Martin Brown (Send Email)
Posted Jan 10, 2008


For some time, Apache and Microsoft have commanded the lion's share of the Web server market. While Apache is the clear-cut winner in the Netcraft and Security Space monthly surveys, Internet Information Server dominates among Fortune 1000 enterprises.

SWatch Reader Favorite! IIS and Apache are the two most widely deployed Web servers. Not surprisingly, each has a loyal and vehement following. This tutorial goes beyond the noise to compare execution environments, dynamic components, security and authentication, performance, and reliability.

Both are viable choices, and each carries its own set of pros and cons.

With Apache 2.0 in production release since mid-2002 and IIS 6.0 shipping since earlier this year, we've decided the time has come to run a feature-by-feature comparison of the two servers to help readers better determine which server suits their needs.

Basics

IIS has been an optional component of the Windows Server operating systems since Windows NT 4.0. Back then, this was a basic Web server in the form of IIS 3.0. An Option Pack, released shortly after Windows NT 4.0 was released, included IIS 4.0 and was the first "real" version of IIS to be used heavily as a Web server platform.

IIS 5.0 was included in Windows 2000 in both the server and desktop versions, and the updated version, IIS 5.1, is incorporated into Windows XP. The changes between IIS 4 and IIS 5 are fairly minor.

Windows Server 2003 includes the new IIS 6.0, which is an almost complete rewrite from the previous editions. It sports a new execution model, better management facilities, and significantly increased performance.

Apache, on the other hand, has an older heritage, having been originally based on the httpd code that some would argue started the entire Web revolution in the first place. Apache 1.3.x, which was the production version until 2002, was a largely Unix product that used a number of tricks to enable it to execute within other operating systems, including Windows.

The production release of Apache 2.0 hit the shelves in 2002. The new release incorporated a brand-new execution environment that separated the core functionality of the Apache system from the system that actually supported and processed requests. Apache 2.0 is now supported under a wide array of potential operating systems, including all versions of Windows, Linux, Unix, and Mac OS X, in addition to an array of nonmainstream OSs, like BeOS and VMS.

Execution Environment

IIS and Apache operate very differently and thus have a variety of advantages of disadvantages. IIS is obviously designed and available to work only within the Windows environment. With IIS 6.0, the only platform currently supported is Windows Server 2003. Although this limits the deployment platforms for IIS-based Web services, it also provides a number of benefits, including greater cooperation with the host operating system and easier management and control through a variety of standard OS tools and utilities.

In IIS 6.0, the cooperation between the operating system and the server is greater than ever. In a change to previous versions, the component that accepts requests from clients and processes them is now two separate components. The kernel mode listener, HTTP.sys, listens and accepts requests from clients, placing the requests into one or more request queues. IIS then processes the requests in these queues using at least one worker process to control the execution of the individual requests and applications.

This separate process allows requests to be accepted even when IIS worker processes aren't technically running, and also enables finer control on the worker processes that handle requests. Thus, the admin (or the server, automatically) can recycle requests to recover from extension and application failures that would have previously required a shutdown/restart of the IIS service or, in extreme cases, a reboot of the entire server.

Apache 2.0 was a major rewrite from the previous versions. Among the many changes, the Web server is now directly available on a variety of platforms, including Windows. The redesign enables it to support a wide array of platforms in more efficient ways that lead to Unix- and Windows-specific execution models that make the best use of the OS.

The core of the system is the Apache Portable Runtime (APR), which enables the Apache core to run on more or less any system with a C compiler. A number of multi-processing modules (MPMs) then provide the support for actually accepting and processing requests. Under Unix, this can be the traditional "forked" model or a newer threaded model making use of the threading built into most modern kernels. Under Windows, this also uses a threaded model, which in some respects is similar to the threaded model used by the worker processes within IIS 6.0.

FeatureIISApache
Independent Request HandlerYesYes (limited)
Multiple Process Request HandlersYesYes
Thread SupportYesYes (on a suitable OS)

Dynamic Components

The primary dynamic environment for development within IIS is Active Server Pages. This is a generic term for a solution that allows code to be embedded into HTML pages. These ASP pages are parsed by the server before being supplied to the client as HTML. The ASP system allows developers to work in a number of different languages, including Visual Basic, VBScript, JavaScript, Java, and C/C++, along with other open source alternatives, such as Perl and Python. In addition, IIS continues to support traditional CGI methods along with its own suite of filtering and execution systems in the form of ISAPI filters.

Apache is also designed to work with a wide range of languages, either via the CGI model, or through the use of dynamic modules by directly incorporating the language interpreter into the Apache environment. This significantly speeds up the execution of dynamic components for languages like PHP, Perl, and Python.

Both systems support the Java Server Pages model, and it's possible to migrate most JSP applications between the two platforms with few changes. Other languages can achieve this with varying results. Even ASP can be supported under Unix through the ChilliSoft ASP component (www.chillisoft.com), through the Apache::ASP module, or the Apache modmono module (http://apacheworld.org/modmono/).

One element that currently cannot be emulated under Unix is the Microsoft.NET environment. IIS 6.0 and Windows Server 2003 make heavy use and provide excellent levels of integration with the .NET Framework.

FeatureIISApache
ASPYesWith Chilisoft, Apache::ASP, or modmono
CGIYesYes
PerlYesYes
PythonYesYes
PHPYesYes
JSPYesYes
.NET IntegratedYesNo

Original date of publication, 09/09/2003.

Page 1 of 2


Comment and Contribute

Your name/nickname

Your email

(Maximum characters: 1200). You have characters left.