Facts About Web Servers, Web Containers, and Application Servers

Hasini Sandunika Silva
5 min readMay 13, 2021

--

Facts about Web Servers, Web Containers, and Application Servers

This article will provide you the information about web servers, web containers, and application servers.

Web Server

This is responsible for storing, processing, and delivering the static contents of the web pages to the clients (the browser). Some examples of the static contents of web pages are HTML documents, images in HTML documents, style sheets and scripts, etc. Web servers do not support multithreading. Traditionally, web servers do not deal with dynamic content or server-side programming but sometimes can use plugins to enable dynamic content generations (add .NET plugin to IIS environment). The communication between client and web server takes place using the HTTP protocol. Web servers can access the static databases.

When we consider how these web servers work, the user types the address of the web page on the browser. Then, the browser will search for the IP address of this on the cache file of the user’s computer. If the browser couldn’t be able to find such an address the browser will send the user typed address to the DNS to get the corresponding IP address. After receiving it the browser will translate the IP address into a connection to the host with the following HTTP/2 request. (This is the current network protocol used by the World Wide Web).

GET /path/file.html HTTP/2Host: www.examplewebsite.comContent-Type: text/html;charset=utf-8

Before sending the request to the host check whether the connection between the client computer and the host is connected. Next when the client computer has the content of the package the TCP protocol will split the big package into smaller packets and send them to the host. Due to using the HTTP protocol, the default port is 80 and this will listen to the package sent by the client. After receiving the package, the web server on the host will append the given path to the path of its root directory. Finally, the web server reads the file and if it exists sends the corresponding response to the web browser, and if it doesn’t exit sends an error message to the client. Refer to figure 1.

Figure 1. Web Server.

Some examples of web servers:

  • Apache HTTP Server: Used in Java
  • Internet Information Services (IIS): Used in Microsoft ASP.NET
  • Nginx
  • LiteSpeed Web Server
  • GWS

Web Container (Servlet Container)

The main responsibility of this is to serve the dynamic content based on Java Server Pages (JSP), Servlets, etc. But this can serve both static and dynamic content. This does not support J2EE services. Web containers manage the lifecycle of servlets, mapping a URL to a particular servlet, and ensure that the URL requester has the correct access rights through XML configurations or annotation configurations.

Let’s have a look at what will happen when the client sends a request to the server. First, the web server sends the request to the container and this will pass the request to the particular servlet. After processing the request (apply business logic, etc.) by the web container the response will reach the client through the web server. Refer to figure 2.

Figure 2. Web Container.
  • Servlets: Java classes that execute on the server and use to generate dynamic web content.
  • Java Server Pages (JSP): Used to insert java code in HTML pages by using special JSP tags. Refer to the following code snippet.
<html><body><% out.print("JSP"); %></body></html>

Some of the common web containers are,

  • Apache Tomcat
  • Jetty

Application Server

The application server has the full functionality of a web container, but it provides the amount of additional functionality such as Enterprise Java Beans (EJB), Java Transaction API (JTA), Dependency Injection (DI), etc. Application servers can handle both static and dynamic contents (based on business logic) of web pages and also use multi-threading to support multiple requests in parallel. If we use only an application server for both static and dynamic content processing this will use the same hardware components for both services. But this will impact the performance of the application server. To improve the performance of the system it’s better to use a web server for static content handling and an application server for dynamic content handling. In application servers, we can deploy the applications written in server-side languages (e.g. Java).

  • EJB: A specification that is used to develop secured, robust and scalable distributed applications. There are 3 types of beans as, session bean, message-driven bean, and entity bean.
  • JTA: This allows to perform distributed transactions.
  • DI: A design pattern that allows creating dependent objects without instantiating.
Figure 3. The Logical View of an Application Server.

Examples for application servers;

  • IBM Websphere
  • Oracle Web Logic
  • Apache Geronimo
  • Wildfly

Here describe how the application servers are work when a client sends a request. When the client sends a request to the web server and the request needs dynamic content then it initiates the communication with the application server. After the configuration, the application server runs the application by connecting with the application database and finally sends the response to the client through the web server. Refer to figure 4.

Figure 4. Application Server.

References

--

--

Hasini Sandunika Silva
Hasini Sandunika Silva

No responses yet