|
Question : What is functional difference between tomcat and apache?
|
|
What is functional difference between tomcat and apache?
Please give a real example.
|
Answer : What is functional difference between tomcat and apache?
|
|
Hi,
Apache is a general-purpose http server, which supports a number of advanced options that Tomcat doesn't. Although Tomcat can be used as a general purpose http server, you can also set up Apache and Tomcat to work together with Apache serving static content and forwarding the requests for dynamic content to Tomcat. This is generally prefered when using tomcat because the overhead from serving static content directly from Apache is much lower than having Tomcat handle all of the requests.
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 Web server.Web server is used to just respond to the requests with feature such as load balancing, whereas containers( such as Tomcat) are used to manage the life cycle 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. You certainly can use Tomcat as a standalone webserver.
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.
|
|
|
|