Think loose coupling

A traditional application builds a tightly integrated server, where each server has a specific responsibility. Applications depend upon other servers for completeness of functionality. As shown in the following diagram, in a tightly coupled application, the web server fleet has a direct dependency on all application servers, and vice versa:

Tightly coupled architecture

In the preceding architecture diagram, if one application server goes down, then all web servers will start receiving errors, as the request will route to an unhealthy application server, which may cause a complete system failure. In this case, if you want to scale by adding and removing servers, it requires lots of work, as all connections need to be set up appropriately.

With loose coupling, you can add an intermediate layer such as a load balancer or a queue, which automatically handles failures or scaling for you. In the following architecture diagram, there is a load balancer between the web server and the application server fleet, which makes sure to always serve user requests from a healthy application server:

Load balancer-based loosely coupled architecture

If one of the application servers goes down, the load balancer will automatically start directing all the traffic to the other three healthy servers. Loosely coupled architecture also helps you to scale your servers independently and replace unhealthy instances gracefully. It makes your application more fault tolerant as an error radius is limited to a single instance only.

For queue-based loosely coupled architecture, take an example of an image-processing website, where you need to store an image, and then process it for encoding, thumbnail, and copyright. The following architecture diagram has a queue-based decoupling. You can achieve loose coupling of systems by using queues between systems and exchanging messages that transfer jobs:

Queue-based loosely coupled architecture

Queue-based decoupling enables asynchronous linking of systems, where one server is not waiting for a response from another server and it is working independently. This method lets you increase the number of virtual servers that receive and process the messages in parallel. If there is no image to process, you can configure auto-scaling in order to terminate the excess servers.

In a complex system, a loosely coupled architecture is achieved by creating a service-oriented architecture (SOA), where independent services contain a complete set of functionalities and communicate with each other over a standard protocol. In modern design, microservice architecture is becoming highly popular, which facilitates the decoupling of an application component. The loosely coupled design has many benefits, from providing scalability and high availability, to ease of integration. 

In the next section, you will learn more about SOA, and you will also dive deep into the details of this topic in Chapter 6, Solution Architecture Design Pattern

..................Content has been hidden....................

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