aspose file tools*
The moose likes Tomcat and the fly likes Difference between Tomcat and Apache Web Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Difference between Tomcat and Apache Web Server" Watch "Difference between Tomcat and Apache Web Server" New topic
Author

Difference between Tomcat and Apache Web Server

Mukesh Mittal
Greenhorn

Joined: Dec 29, 2005
Posts: 16
Hi
I just want to know the difference between Tomcat Servlet Container and Apache webserver?

I know that we can use Tomcat directly without using Web server. Tomocat can handle both static and dynamic pages.
[ December 29, 2005: Message edited by: Mukesh Mittal ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Moved to the Tomcat forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sunny Kumar
Ranch Hand

Joined: Oct 27, 2005
Posts: 57
If you are going to serve only static(such as HTML) pages then Apache webserver would suffice but if the pages being (dynamically) served are in JSP/Servlet then you need a container that can interpret them, for which we use Tomcat.Similarly, if you will be using PHP then you need to add its support in Webserver.
Webserver is used to just respond to the requests with feature such as load balancing, whereas containers( such as Tomcat) are used to manage the lifecycle of the pages generated using JSP and servlet..
If you need more info on the container specific responsibilty then you can check out either the JSP or Servlet specification.
Sunny Kumar
Ranch Hand

Joined: Oct 27, 2005
Posts: 57
I forgot to add that you can't use Tomcat as a web server .
You can check for more info at Apache-Tomcat
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You certainly can use Tomcat as a standalone webserver.

That link is to the documentation on a very old version of Tomcat.
Unless you have a good reason to stay on such an old version, you'd be better off to start with the most recent stable version.
http://tomcat.apache.org/tomcat-5.5-doc/index.html


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Originally posted by Sunny Kumar:
I forgot to add that you can't use Tomcat as a web server .


As Ben pointed out, this is completely incorrect. Modern versions of Tomcat can not only be used as a stand-alone web server, it is generally considered a very good one.
Sunny Kumar
Ranch Hand

Joined: Oct 27, 2005
Posts: 57
Originally posted by Ben Souther:
You certainly can use Tomcat as a standalone webserver.


Ya..agree with that.
I should have emphasized more on the word web-server because I think there has to be some features that only a web server is able to provide or atleast cnsidered best for.
[ December 30, 2005: Message edited by: Sunny Kumar ]
Hemant Agarwal
Ranch Hand

Joined: Nov 21, 2005
Posts: 138
My question is If we can use Tomcat as a standalone server than why we will ever need to combine apache + tomcat as a server
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Hemant Agarwal:
My question is If we can use Tomcat as a standalone server than why we will ever need to combine apache + tomcat as a server


It used to be that Tomcat/Java was so much slower than Apache HTTPD when it came to serving static files that you had to combine them to get a production ready application. This is no longer the case. Most often, the gains you get by combining the two (if any) are not worth the hassle of administering both + the connector.

There are other reasons though.
If your app has components written in other technologies than Java such as PHP or PERL, you may prefer to use HTTPD to handle those things. If you have huge amounts of static data and very little Java driven dynamic stuff, it may be more efficient to let HTTPD handle the static data.
Some people combine the two in order to bind to a port below 1024 on a unix box or to share an SSL certificate between different apps.
HTTPD can also be used as a load balancer for several instances of Tomcat.

In short, unless you have a compelling reason to do so, I wouldn't bother connecting the two. I would stick to Tomcat as a standalone until there is solid proof (in the form of a load test) that life would be better with an HTTPD front end.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between Tomcat and Apache Web Server