Bookmark Topic Watch Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
What's the difference between a web server, an application server, and a servlet container?

Is Tomcat an application server?

What's the difference between Tomcat and JBoss/Geronimo?

In the strictest sense, one could say: A web server serves up static HTML pages and nothing else. Tomcat is a Servlet/JSP container, and 'Java application servers' are those which support the full JEE (formerly J2EE) stack.

The distinctions between these terms, however, have always been blurry, and continue to become more so over time, and will vary depending on where and with whom your discussion takes place. To understand this requires a little history lesson.

Tomcat started its life as the JServ module for Apache HTTPD (now known as the Apache web server).
It was only a servlet container and was incapable of handling web requests on its own. When combined, HTTPD would handle all web requests, would serve up all the static content on its own and forward any dynamic requests to JServ. Httpd was the web server and JServ was the servlet container.

Eventually, JServ was replaced by the Tomcat application server, and a connector was added that allowed Tomcat to operate as a standalone web/application server. At the time Tomcat alone was not fast enough for use in heavy traffic production environments, and didn't support SSL so it was standard practice to combine Tomcat with the Apache web server; much in the same way that JServ and httpd were used. This is still not uncommon today and there are still valid reasons for wanting to do so.

Over time, both Tomcat and the Java Virtual machine, with its Just In Time compiler, have made huge gains in performance, and in many cases running Tomcat as a standalone application server is just as fast or faster than running it in conjunction with the Apache web server. (Testing your application in both configurations under load is the only way to know for sure). Tomcat also has full support for SSL.

So, as you can see, in the case of Tomcat, the lines between application server and web server have blurred over the years.

The lines are also somewhat blurry when you look at the Apache web server itself. It has been hosting large commercial applications using CGI (Common Gateway Interface) for over a dozen years. In addition, many modules, such as the one that allows the popular PHP scripting language to run natively, have become almost standard in an Apache web server installation.

Another popular web/application server, Microsoft's IIS (Internet Information Server), is also used as both a web server and application server. It too can be configured to pass requests for dynamic content to Tomcat via an ISAPI filter. It can also be configured to support popular scripting languages such as PHP, and has native support for Microsoft's own ASP and ASP.NET platforms. Here also, the distinction between web server and application server is blurry.

In some circles, in order to qualify as a "Java application server" the server must support the entire JEE (formerly known as J2EE) stack. Tomcat does not do this. It does not support EJB (Enterprise Java Beans), amongst other APIs. JBoss and Apache's Geronimo application server do support the entire JEE stack. Their servlet and JSP capabilities come from an embedded version of Tomcat (or some other servlet container).

Since one actually contains and relies on the other, the question "Which is better - Tomcat or JBoss" or the phrase, "Tomcat vs JBoss" is not answerable. They are not legitimate comparisons.

Many large, commercial applications are hosted on Tomcat; both with and without an external HTTP web server and without EJB.

To sum it up, the terms do exist but need to be considered in the context of their use in order to understand what they really mean.


TomcatFaq

Reader Comments:
The difference between Web and Application server is architectural. A Web Server is an HTTP server, follows the HTTP request/response paradigm and allows server side programming through CGI scripts (or similar). CGI based server side programming does not scale very well and is relatively difficult to maintain over time. An Application server provides a container for writing server side programs using advanced frameworks (.Net, J2EE, Spring, Hibernate, etc). This makes server side programming easier, scalable and more maintainable. Apache Tomcat, JBoss, WebLogic are all excellent J2EE application servers. The differentiation between them is very technical rather than functional.

I disagree with the preceding paragraph, in particular a) it has nothing to do with the language in which the server itself is written or which it uses for add-on, b) web servers need not support CGI, c) highly functional and scalable web apps have been written using CGI-based servers (now obsolete of course), d) Tomcat is most definitely not a J2EE (or JEE) server. -- Ulf
 
    Bookmark Topic Watch Topic
  • New Topic