Tomcat vs. Apache: Why One Over the Other?

March 17th, 2012 Leave a comment 1 comment
Like the article?
Tomcat vs Apache

The question has often been asked by those looking to run a web server on their production machines: Do they go with Apache Web Server (also known as “Apache httpd”) or Apache Tomcat? Both are production level servers that seem to offer great capabilities, and it can be difficult to choose between the two if you’re not familiar with their capabilities. The real secret here, however, is that the question is a bit of a misleading one: there isn’t a “versus” here per-se: the two servers, while both offering similar features, can ultimately be used side-by-side to complement each other and create a full-featured and robust web-serving architecture.

Let’s explain: the giant in the room is, of course, Apache’s traditional web server: it’s found on most Linux distributions as the main http server of choice, and due to its cross-platform builds has found itself not just on Linux machines but on Windows and Mac ones as well. It’s known for being relatively fast (though by no means the fastest) and modular, meaning that you can add in different plugins to increase functionality as you need it (such as PHP and CGI modules). This has led to it becoming the de facto standard on many server installations across many different configurations, and most if not all server administrators will be familiar with it and how it works.

Where many people get confused is when they see that Tomcat can be run as a server. Apache as a web server can be configured in many different ways and with many extensions, but it does lack the ability to server Java Servelets or JavaServer Pages (hereafter referred to as JSP). Tomcat can and does serve those, and often people who use or need JSP will believe that Tomcat needs to be used to serve these as well as take on the role of the production web server.

The truth, however, is that Tomcat doesn’t make for a great production server outside of JSP heavy pages: if you need any other dynamic content or are serving static pages, it’s simply too slow to scale well in a production environment. This makes it great as a testing server or a very specific production server, but most modern websites will need the horsepower that Apache provides when it comes to static content and PHP / CGI-based services.

The Tomcat developers know this, however, and that’s why the versus aspect of this question is a bit of a red herring: Tomcat is capable of running in tandem with Apache as a complementary component, letting Apache take care of dynamic content and static pages while deferring calls to JSP to Tomcat. This marries the best of both worlds and lets each of the servers do what they do best: Apache takes care of the speed-based parts of the site while Tomcat can come in and serve the JSP, leaving the site running great and letting the technologies complement each other.

This isn’t, of course, to say that there aren’t situations where one clearly wins over the other: A small or medium-sized PHP blog will have utterly no use for Tomcat, and a site entirely in JSP may be better served by running entirely or at least heavily on Tomcat. For the most part, however, the two technologies are complementary – not confrontational. When it comes to Apache versus Tomcat, don’t immediately jump to “versus” – think about “works with” instead!

If you are interested in learning beyond the overview of each server, we provide both Apache training and Tomcat training courses as part of LearnComputer’s regular curriculum.

Help us spread the word!
  • Twitter
  • Facebook
  • LinkedIn
  • Pinterest
  • Delicious
  • DZone
  • Reddit
  • Sphinn
  • StumbleUpon
  • Google Plus
  • RSS
  • Email
  • Print
If you liked this article, consider enrolling in one of these related courses:
Don't miss another post! Receive updates via email!
  1. Julio says:

    Silly point of view as you don’t choose a server but a platform. It’s ok to explain these servers for people who might be confused and think they are in the same league but not with this type of comparison.

    If you need Java then Apache httpd is not an option, then your options are Jetty, Resin or even heavyweights as Glassfish, Weblogic, etc. If you are not using Java then you would not consider Tomcat and its relatives.

Comment