Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Full Stack Development with JHipster

You're reading from   Full Stack Development with JHipster Build modern web applications and microservices with Spring and Angular

Arrow left icon
Product type Paperback
Published in Mar 2018
Publisher Packt
ISBN-13 9781788476317
Length 380 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Sendil Kumar Nellaiyapen Sendil Kumar Nellaiyapen
Author Profile Icon Sendil Kumar Nellaiyapen
Sendil Kumar Nellaiyapen
Deepu K Sasidharan Deepu K Sasidharan
Author Profile Icon Deepu K Sasidharan
Deepu K Sasidharan
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Introduction to Modern Web Application Development FREE CHAPTER 2. Getting Started with JHipster 3. Building Monolithic Web Applications with JHipster 4. Entity Modeling with JHipster Domain Language 5. Customization and Further Development 6. Testing and Continuous Integration 7. Going into Production 8. Introduction to Microservice Server-Side Technologies 9. Building Microservices with JHipster 10. Working with Microservices 11. Deploying with Docker Compose 12. Deploying to the Cloud with Kubernetes 13. Using React for the Client-Side 14. Best Practices with JHipster 15. Other Books You May Enjoy

Web architecture patterns

The full-stack landscape is further complicated by the different web architecture patterns commonly used these days. The widely used web application architecture patterns today can be broadly classified into two—monolithic architecture and microservice architecture, the latter being the new kid on the block.

Let's take a look at the following in detail:

  • Monolithic architecture
  • Microservice architecture

Monolithic web architecture

A monolithic architecture is the most used pattern for web applications due to its simplicity in development and deployment. Though the actual moving parts will differ from application to application, the general pattern remains the same. In general, a monolithic web application may 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 a database, and can exchange data with other systems
  • It can run on web application containers such as Tomcat, JBoss, and so on
  • 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 (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 server or between two systems. 

SOAP (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 reservation orders online 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 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 detailed here:

  • Simpler to develop as the technology stack is uniform throughout all layers.
  • Simpler to test as the entire application is bundled in a single package making it easier to run integration and end-to-end tests.
  • Simpler and faster to deploy, as you only have one package to worry about.
  • Simpler to scale as you can multiply the number of instances behind a load balancer to scale out.
  • Requires a smaller team to maintain the application.
  • Team members share more or less the same skill set. 
  • The technical stack is simpler and most of the times easier to learn. 
  • Initial development is faster hence making time to market faster.
  • Requires 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 detailed here:

  • Components are tightly coupled together resulting in unwanted side effects such as changes to one component causing a regression in another and so on.
  • Becomes complex and huge over time resulting in slow development turnaround. New features will take more time to develop and refactoring of existing features will be more difficult due to tight coupling.
  • The entire application needs to be redeployed for any changes.
  • Is less reliable due to tightly coupled modules. A small issue in a service might break the entire application.
  • Newer technology adoption is difficult as entire application needs to be migrated. Incremental migration is not possible most of the time. Hence many monolithic applications end up having an outdated technology stack.
  • Critical services cannot be scaled individually resulting in increased resource usage as the entire application will need to be scaled.
  • Huge monolith applications will have a higher start-up time and high resource usage in terms of CPU and memory.
  • Teams will be more interdependent and it will be challenging to scale the teams.

Microservice architecture

The microservice architecture has gained momentum in recent years, and is gaining popularity in web application development due to its modularity and scalability. Microservice architecture can offer almost all the features of a monolith that we saw in the earlier section. Additionally, it offers many more features and flexibility, and hence is often considered a superior choice for complex applications. Unlike the monolithic architecture, it's quite difficult to generalize the microservice architecture as it could vary heavily depending on the use case and implementation. But they do share some common traits and they are, in general, the following:

  • Microservice components are loosely coupled. Components can be developed, tested, deployed, and scaled independently without disrupting other components.
  • Components need not be developed using the same technology stack. This means a single component can choose its own technology stack and programming language.
  • They often utilize advanced features such as service discovery, circuit breaking, load balancing, and so on.
  • Microservice components are mostly lightweight and they do a specific functionality. For example, an authentication service will only care about authenticating a user into the system.
  • Often has an extensive monitoring and troubleshooting setup.

An example of a microservice web application architecture would be as follows:

Let's imagine a huge online e-commerce system where customers can go through categories of merchandise, maintain favorites, add items to a shopping cart, make and track orders, and so on. The system has inventory management, customer management, multiple payment modes, order management, and so on. The application consists of several modules and components including a UI gateway application, which builds a nice rich user interface and also handles user authentication and load balancing, and several other backend applications responsible for managing the inventory, verifying payment, and managing orders. It also has performance monitoring and automatic failover for services. 

The application will be deployed as multiple executable WAR files in Docker containers hosted by a cloud provider. Take a look at the following diagram:

The advantages of a microservice web application architecture are as detailed here:

  • Loosely coupled components resulting in better isolation, easier to test and faster to startup.
  • Faster development turnaround and better time to market. New features can be built faster and existing features can be easily refactored.
  • Services can be deployed independently making the application more reliable and make patching easier.
  • Issues, such as a memory leak in one of the services, are isolated and hence will not bring down the entire application.
  • Technology adoption is easier, components can be independently upgraded in incremental migration making it possible to have a different stack for each component.
  • More complex and efficient scaling models can be established. Critical services can be scaled more effectively. Infrastructure is used more efficiently.
  • Individual components will start up faster making it possible to parallelize and improve overall start-up.
  • Teams will be less dependent on each other. Best suited for agile teams.

The disadvantages of a microservice web application architecture are as detailed here:

  • More complex in terms of the overall stack as different components might have different technology stacks forcing the team to invest more time in keeping up with them.
  • Difficult to perform end-to-end tests and integration tests as there are more moving parts in the stack.
  • The entire application is more complex to deploy as there are complexities with containers and virtualization involved.
  • Scaling is more efficient but setting upscaling is more complex as it would require advanced features such as service discovery, DNS routing, and so on.
  • Requires a larger team to maintain the application as there are more components and more technologies involved.
  • Team members share varying skill sets based on the component they work on, making replacements and knowledge sharing harder.
  • The technical stack is complex and most of the times harder to learn. 
  • Initial development time will be higher making time to market slower.
  • Requires a complex infrastructure. Most often will require containers (Docker) and multiple JVM or app containers to run on.
You have been reading a chapter from
Full Stack Development with JHipster
Published in: Mar 2018
Publisher: Packt
ISBN-13: 9781788476317
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime