Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Apache/Tomcat Integration Question

 
Scott Updike
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm fairly new to setting up web servers and integrating with web containers and have a couple of really dumb questions:

1) If I have an application that is entriely servlet/jsp based, why would I need to have Apache in addition to Tomcat? I know Tomcat is a container, but it also serves the servlets (including the compiled jsps) without Apache. What are some high level reasons for deploying a servlet based app within the apache/tomcat framework and not just tomcat? I assume there are security concerns that tomcat may not address that are taken care of in apache??
2) Assuming you have integrated apache with tomcat, if one deploys their web application within the webapp directory structure in tomcat (per the instructions), then wouldn't all the web traffic URLs be "tomcat specific" and not use the "apache specific" URLs?

Just trying to figure out what Apache gives you that Tomcat doesn't when it comes to deploying a 100% servlet-based application to the web.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the past, Tomcat (and Java) were slow at serving up files when compared with Apache HTTPD (which is written in C). For this reason, production apps were deployed in Apache HTTPD with a connector used to pass only servlet and JSP requests to Tomcat.

Both Tomcat and Java itself have made great strides in performance since then and it makes more sense (to me anyway) to test Tomcat as a standalone before getting mired down in connector configuration. Tomcat can also handle SSL, which was another reason for fronting with httpd in the past.

There are still cases where combining the two makes sense.
If your app includes Perl or PHP scripts, for example httpd will definitely handle those better. Also, if your app serves up large (very large) amounts of static data files you might see a significant performance boost by configuring httpd to serve them up while passing requests for dynamic data back to Tomcat.

Try working with Tomcat as a standalone first.
If you feel that your app is not performing as well as it should, look at all the options available to you; including fronting with httpd.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, Tomcat now gives you the option of integrating the Apache Portable Runtime component (which is at the heart of Apache HTTPD)

See:
http://tomcat.apache.org/tomcat-5.5-doc/apr.html
 
Scott Updike
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great. Thanks for the quick response. That confirms my suspicions.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic