Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Difference between Tomcat and Apache Web Server

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 67528
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moved to the Tomcat forum.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I forgot to add that you can't use Tomcat as a web server .
You can check for more info at Apache-Tomcat
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bear Bibeault
Sheriff
Posts: 67528
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ]
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic