We are always confused between Apache and Tomcat and we would like know the difference between Apache HTTP server and Tomcat? Also difference between Web Server and Application Server?
Most of the times these terms Web Server and Application server are used interchangeably but both are different roles all together.
couple of days back client side IT asked me the same question and I thought that I should post this on TechDiary. Also I have found this question very popular in interview process so it has to go on my blog. I had little bit idea about the difference between Apache HTTP and Tomcat so I went through different posts and technical articles to get the detailed information so I can explain it in simple language.
Apache HTTP and Tomcat Server
“Apache” is the name of a foundation that write open-source software. Apache HTTPD is a web server written in portable C (when people say “Apache”, they usually mean Apache HTTPD.) It mostly serves static content by itself, but there are many add-on modules (some of which come with Apache itself) that let it modify the content and also serve dynamic content written in Perl, PHP, Python, Ruby, or other languages.
Tomcat is primarily a servlet/JSP container. It’s written in Java. It can serve static content, too, but its main purpose is to host servlets and JSPs. You wouldn’t use Tomcat unless most of your content was Java.
It’s actually possible to use both Apache and Tomcat together, so that Apache serves the static content, and Tomcat the Servlets and JSPs. Depending on various factors.
Apache HTTP server can also be used as a Load Balancer, Reverse Proxy and Failover.
Web Server and Application Server
Web server serves content to the web using http protocol. Application server hosts and exposes business logic and processes.
Application Server is a term that sometimes is mixed with a web server. While a web server handles mainly HTTP protocols, the application server deals with several different protocols, including, but not limited, to HTTP. An application server is typically a super-set of a web server, which is to say that an application server can do what a web server does (i.e. answer HTTP socket requests on port 80 and HTTPS socket requests on port 443).
The whole and sole task of the web server is to continuously listen to the incoming requests and understand the specifics of the request as per the knowledge of the protocol(HTTP) and dispatch the response back, again with the specifics of the protocol. Where the application server is in-charge of the logic, the interaction between the user and the displayed content. The application server is working in conjunction with the web server, where one displays and the other one interacts.
Imagine you go to your favorite store. The customer operator there who takes your order, records into the system, bills you and dispatches it to you when the order is ready is analogous to the Web Server. He continuously takes the requests from new customers and keeps dispatching the prepared orders, optionally wrapping them in decorated packets or putting in platters.
At the same time, the guy forwards these requests to the core kitchen, where all the hard part of preparing up the pizza is done with the knowledge of the recipe, ingredients, cooking timings and other specifics, and dispatches back the prepared pizza. So, the core kitchen has the responsibility of both request-dispatch(though with limited complexity) and doing the hard part of preparing the pizza. So, it acts as the application server.
If you found any of the information on this page helpful in anyway then please consider sharing this content with your favorite social network or by leaving your thoughts in the comment section. Thanks!