Monolithic web architecture

A monolithic architecture is the most widely used pattern for web applications because of its simplicity to develop and deploy. Though the actual moving parts will differ from application to application, the general pattern remains the same. In general, a monolithic web application can do the following:

  • It can support different clients, such as desktop/mobile browsers and native desktop/mobile applications.
  • It can expose APIs for third-party consumption.
  • It can integrate with other applications over REST/SOAP web services or message queues.
  • It can handle HTTP requests, execute business logic, access databases, and exchange data with other systems.
  • It can run on web application containers, such as Tomcat and JBoss.
  • It can be scaled vertically by increasing the power of the machines it runs on or scaled horizontally by adding additional instances behind load balancers.
REST (short for REpresentational State Transfer) relies on a stateless, client–server, cacheable communications protocol. HTTP is the most commonly used protocol for REST. It is a lightweight architectural style in which RESTful HTTP communication is used to transfer data between a client and a server, or between two systems.

SOAP (short for Simple Object Access Protocol) is a messaging protocol using HTTP and XML. It is widely used in SOAP web services to transfer data between two different systems.

An example of a typical monolithic web application architecture would be as follows: Let's imagine an online hotel reservation system that takes online reservation orders from customers, verifies the room availability, verifies the payment option, makes the reservation, and notifies the hotel. The application consists of several layers and components, including a client-side app—which builds a nice, rich user interface—and several other backend components responsible for managing the reservations, verifying the payment, notifying customers/hotels, and so on. 

The application will be deployed as a single monolithic web application archive (WAR) file that runs on a web application container such as Tomcat, and will be scaled horizontally by adding multiple instances behind an Apache web server acting as a load balancer. Take a look at the following diagram:

The advantages of a monolithic web application architecture are as follows:

  • It is simpler to develop, as the technology stack is uniform throughout all layers.
  • It is simpler to test, as the entire application is bundled in a single package, making it easier to run integration and end-to-end tests.
  • It is simpler and faster to deploy, as you only have one package to worry about.
  • It is simpler to scale, as you can multiply the number of instances behind a load balancer to scale it out.
  • It requires a smaller team to maintain the application.
  • The team members share more or less the same skill set. 
  • The technical stack is simpler and, most of the time, is easier to learn. 
  • Initial development is faster, thereby making the time to market shorter.
  • It requires a simpler infrastructure. Even a simple application container or JVM will be sufficient to run the application.

The disadvantages of a monolithic web application architecture are as follows:

  • Components are tightly coupled together, resulting in unwanted side effects, such as changes to one component causing a regression in another.
  • It becomes complex and huge as time passes, resulting in slow development turnaround. New features will take more time to develop and refactoring existing features will be more difficult because of tight coupling.
  • The entire application needs to be redeployed whenever any change is made.
  • It is less reliable because of tightly coupled modules. A small issue with any service might break the entire application.
  • Newer technology adoption is difficult as the entire application needs to be migrated. Incremental migration is not possible most of the time, which means that many monolithic applications end up having an outdated technology stack after some years.
  • Critical services cannot be scaled individually, resulting in increased resource usage. As a result, the entire application will need to be scaled.
  • Huge monolith applications will have a higher start up time and higher resource usage in terms of CPU and memory.
  • Teams will be more interdependent and it will be challenging to scale the teams.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset