Four Application Architecture Patterns

Monolithic

A Monolithic architecture is three tier architecture, consists of front-end, business logic tier and database tier. This is typical in Spring MVC framework and Python Django framework.

Monolithic framework is easy to develop and test. It is simple to deploy and scale horizontally with load balancer. As code base grows, the challenges with maintainability and flexibility become significant. The disadvantages with monolithic architecture are:

  • complexity: a project with million lines of code usually has too many modules, blurred lines between components, inter-dependencies;
  • technical debt: components already in use are hard to change, due to dependencies; this causes technical debt to grow; adoption to new new technology is risky;
  • long deployment interval: fix to a single component requires the entire application to be upgraded; continuous deployment is difficult;
  • unreliable: issues such as infinite loop, memory leak in a single module may potentially bring down the entire process;
  • limited scalability: monolithic application only scales as a whole;
Monolithic Application Architecture

Distributed architecture

distributed architecture is an horizontal extension of monolithic architecture. Business modules exchange data with each other using standard interface. Client requests are load balanced with LVS/Nginx, which significantly increases websites capacity for concurrent requests. Other advantages are:

  • Modules are loosely coupled;
  • development team can be divided and specialized;
  • easy to deploy;
  • scalability: new function is a new interface with new module; no change to existing modules;
  • code reusability;

The main drawback is that inter modular communication is based on standard interface therefore efforts are required to develop interface.

Micro-service arechitecture

In micro-service architecture, the business tier is broken down into many smaller applications (micro-services) that connect to each other. The services can be deployed on different servers or the same servers. Typical frameworks are Spring cloud, Dubbo.

Example of microservice architecture

Advantage:

  • easy to develop and maintain because each microservice is build for a specific business function, hence the size is small.
  • fast startup, owing to the size of each microservice
  • microservices are easy to update without impacting the entire application
  • technology stack has many choices.
  • scalability: refer to scaling cube for microservices.

Disadvantage

  • operation and maintenance requires skills, due to the complexity of microservice architecture.
  • network latency;
  • transaction processing: business transactions that update multiple business entities need to update multiple databases owned by different services;
  • not easy to test: when you test a microservice, you need to test the service and launch all services it dependes upon
  • deployment: an application consists of a large number of services, each has multiple runtime instances and each instance need to be configured, deployed, scaled and monitored. Service discovery mechanism becomes necessary because manual approaches cannot scale to this level of complexity and successful deployment a microservices application requires a high level of automation
application architecture
Break a Monolith Application into MicroServices

Serverless architecture

In serverless architecture, developers do not worry about the provisioning of computing resources and operations. The platform assigns resources and ensures SLA. The advantages are:

  • Low operation cost, pay as you go;
  • Simplified infrastructure
  • Maintainability

Disadvantages:

  • Vendor lock-in, high migration cost
  • Lack of industry standard

There are lots of literatures about serverless architecture from cloud vendors such as AWS.

Leave a Comment