Cloud Application Architecture

Submitted by sylvia.wong@up… on Mon, 06/27/2022 - 18:49

Let’s explore the architectural considerations and patterns for designing and deploying applications in the cloud. We will delve into the essential components of web-tier architecture and introduce two popular architectural approaches: Monolithic and Microservice-based architectures.

First, we will begin with a comprehensive overview of the Web Tier architecture. The web tier is a critical component of a cloud application architecture that handles incoming web traffic, manages user requests, and serves web content. We will examine the key elements of a web tier, including load balancers, web servers, caching layers, and content delivery networks (CDNs). Understanding the web tier architecture is essential for building scalable, resilient, and high-performance web applications.

Next, we will introduce the concept of Monolithic architecture and Microservice-based architecture. Monolithic architecture represents a traditional approach where an application is built as a single, unified unit. We will discuss the characteristics, benefits, and challenges associated with the Monolithic architecture pattern. Additionally, we will explore real-world use cases where Monolithic architectures are suitable and examine their limitations in terms of scalability, agility, and ease of maintenance.

Following that, we will dive into Microservice-based architecture, which is gaining significant popularity in cloud application development. Microservices break down an application into small, independent, and loosely coupled services that can be developed, deployed, and scaled independently. We will explore the advantages of Microservice architectures, including enhanced scalability, fault isolation, ease of deployment, and team autonomy. We will also discuss the challenges, such as increased complexity and potential communication overhead.

Let’s start with reviewing Web Tier Architecture.

Sub Topics

Web tier architecture, also known as the web application tier or the presentation tier, is a crucial component of a multi-tier architecture that focuses on handling web-based requests and delivering web content to users. It primarily deals with the user interface and the processing of HTTP/HTTPS requests.

In web-tier architecture, the main components typically include:

A diagram shwoing web tier architecture
  1. Load Balancer: This component distributes incoming web traffic across multiple web servers to ensure scalability, high availability, and optimal resource utilisation. Load balancers help evenly distribute requests and can handle failover in case of server failures.
  2. Web Servers: Web servers handle user requests and serve web content such as HTML pages, images, CSS files, and JavaScript files. They execute server-side code and generate dynamic responses to user interactions. Examples of popular web servers include Apache HTTP Server, Nginx, Microsoft IIS, and Tomcat.
  3. Caching Layer: To enhance performance and reduce the load on web servers, a caching layer is often included. It stores frequently accessed data, such as HTML fragments, API responses, or database query results, and serves them directly to users without invoking the entire request stack. Caching solutions like Redis, Memcached, or Varnish Cache are commonly used for this purpose.
  4. Content Delivery Network (CDN): CDNs help deliver static content efficiently, especially for globally distributed applications. CDNs store copies of static files (e.g., images, CSS, JavaScript) in edge locations closer to users, reducing latency and improving user experience. Amazon CloudFront, Akamai, and Cloudflare are examples of popular CDNs.

Web tier architecture is responsible for handling user requests, processing them through the necessary application logic, and generating appropriate responses. It plays a vital role in ensuring a smooth and efficient user experience for web applications.

Web tier architecture is often complemented by other tiers in a multi-tier architecture, such as an application tier or a database tier. The application tier contains business logic and handles complex processing, while the database tier stores and retrieves data. 1-tier, 2-tier, 3-tier, and n-tier architectures outline the number of layers and the distribution of components within a web application. As you move from 1-tier to n-tier, there is an increasing focus on separation of concerns, scalability, reusability, and maintainability.

1-tier architecture (also known as monolithic architecture):

In 1-tier architecture, all the components of the web application are deployed on a single machine or server. The presentation logic, application logic, and data storage all reside together. Typically, this architecture is used for simple applications where there is no need for complex scalability or separation of concerns. It is the simplest form of architecture but lacks scalability and can become challenging to maintain as the application grows.

2-tier architecture (also known as client-server architecture):

In 2-tier architecture, the application is divided into two main layers:

  1. the client layer
  2. the server layer.

The client layer consists of the user interface or presentation logic, which is responsible for rendering the application and interacting with the user. The server layer, on the other hand, contains the application logic and data storage. The client sends requests to the server, which processes them and returns the response.

3-tier architecture:

In 3-tier architecture, the application is divided into three main layers:

  1. the presentation layer
  2. the application or business logic layer
  3. the data storage layer

The presentation layer handles the user interface and user interactions. The application layer contains the business logic, which processes requests from the presentation layer and coordinates the application's functionality. The data storage layer handles the storage and retrieval of data. This architecture provides better scalability and separation of concerns compared to the previous two tiers. It allows for independent scaling of each layer and promotes reusability and maintainability.

This architecture allows for better separation of concerns between the client and server, but it still lacks scalability for handling large-scale applications.

n-tier architecture:

N-tier architecture is an extension of the 3-tier architecture, where "n" represents any number greater than three. It allows for further division of the application into additional layers or tiers to handle specific concerns. For example, additional tiers can be added for caching, messaging, security, or other specialized functionalities. Each tier can be developed and scaled independently, which enhances flexibility and scalability. N-tier architecture is commonly used for large-scale enterprise applications where different components need to be deployed and scaled separately.

Summary

Overall, the web tier architecture focuses on handling incoming web requests, serving web content, and ensuring the scalability, availability, and performance of web applications. It acts as a critical layer in the overall architecture of web-based systems, enabling efficient and secure delivery of content to users.

Let's look at the first type of architecture, Monolith architecture (1-tier).

A silicon monolith IC

As outlined previously, Monolithic architecture is an architectural style where an entire application is built as a single, self-contained unit. In this approach, all components of the application, such as the user interface, business logic, and data access, are tightly coupled and deployed together as a single executable or deployment package.

Let’s review the characteristics, benefits, and challenges associated with the Monolithic architecture pattern.

Characteristics of Monolithic Architecture

  • Single Codebase: The entire application is developed and maintained within a single codebase, often using a single programming language or framework.
  • Tight Coupling: All components and modules within the application are tightly interconnected, making it difficult to modify or replace individual parts without impacting the entire system.
  • Centralised Database: Monolithic architectures typically use a shared, centralised database for data storage and retrieval.
  • Single Deployment Unit: The application is deployed as a single unit, with all components packaged and deployed together.

Advantages and Challenges of Monolithic Architecture

Benefits of Monolithic Architecture Challenges of Monolithic Architecture
Simplicity: Monolithic architectures are relatively straightforward to develop, test, and deploy, as there is only one application to manage. Scalability: Scaling a monolithic application can be challenging, as the entire application needs to be scaled, even if only specific parts require additional resources.
Performance: The tight coupling between components allows for efficient communication and sharing of resources, resulting in good performance. Limited Technology Flexibility: As all components are tightly coupled, it can be difficult to adopt new technologies or frameworks within the application.
Easy Development: Developers have a holistic view of the entire application, making it easier to understand and make changes. Continuous Delivery: The size and complexity of monolithic applications can hinder the adoption of continuous integration and continuous delivery practices.
Debugging and Troubleshooting: Identifying issues and debugging is typically simpler in a monolithic architecture, as all components are tightly integrated. Maintenance and Upgrades: Making changes or updates to a monolithic application requires redeploying the entire application, increasing the risk and complexity of maintenance activities.
  Team Collaboration: Large monolithic applications can lead to challenges in team collaboration, as multiple teams may need to work on the same codebase simultaneously.

While monolithic architectures have been widely used in the past, they are being gradually replaced by more modular and scalable approaches like microservices. However, monolithic architectures still have their place, particularly for smaller applications or cases where simplicity and a unified codebase are more important than scalability or technology flexibility.

Examples of the use of Monolithic Architecture

Content Management Systems (CMS)

Many content management systems, such as WordPress or Drupal, are built using monolithic architectures. These systems often have stable workloads, limited inter-component dependencies, and straightforward deployment requirements. They excel in managing and delivering content but can face challenges in scalability when handling a high volume of concurrent users or complex workflows.

Limitations:

  • Scalability: Monolithic CMSs can struggle to handle sudden spikes in traffic, as scaling requires replicating the entire application stack, including the database, caching layer, and other components.
  • Agility: Introducing new features or adopting new technologies can be cumbersome due to the tightly coupled nature of monolithic architectures. Changes may require extensive regression testing and deployment cycles.
  • Maintenance: Maintenance can be challenging in large CMSs, particularly when multiple teams are involved. Updating or fixing one component may necessitate regression testing and redeployment of the entire system.

Enterprise Resource Planning (ERP) Systems

ERP systems, such as SAP or Oracle E-Business Suite, are often built using monolithic architectures. They aim to provide comprehensive business management solutions and include modules for various functions like finance, human resources, supply chain management, and customer relationship management.

Limitations:

  • Scalability: Scaling ERP systems can be complex due to the interconnectedness of modules and shared databases. Scaling typically involves replicating the entire system, which can be costly and resource-intensive.
  • Agility: The tightly coupled nature of monolithic ERP systems can impede agility, making it challenging to introduce new features or modify existing ones without extensive regression testing and deployment activities.
  • Maintenance: Maintaining monolithic ERP systems can be intricate and time-consuming. Upgrades or fixes may require thorough testing across all modules and extensive downtime for the entire system.

Small-to-Medium E-commerce Platforms

Some small-to-medium-sized e-commerce platforms adopt monolithic architectures due to their simplicity and ease of development. These platforms may handle product catalogues, shopping carts, order management, and payment processing within a single application.
Limitations:

  • Scalability: Monolithic e-commerce platforms may face scalability challenges during high-demand periods, such as seasonal sales events. Scaling requires replicating the entire application, including the database, which can limit cost-effectiveness.
  • Agility: Introducing new features or adopting new technologies can be slower in monolithic architectures. Changes may necessitate redeploying the entire application stack, impacting release cycles and time-to-market.
  • Maintenance: As the e-commerce platform grows, maintaining and updating the monolithic architecture can become complex. Fixes or modifications to one part of the system may require extensive regression testing and deployment activities for the entire application.

It's important to note that while monolithic architectures may suit certain use cases initially, as applications grow in complexity or face evolving requirements, the limitations in terms of scalability, agility, and ease of maintenance become more pronounced. In such cases, alternative architectures like microservices or serverless architectures may offer better scalability, flexibility, and ease of maintenance.

Microservice-based architecture is an architectural style where an application is built as a collection of small, loosely coupled services that work together to deliver overall functionality. Each service is designed to perform a specific business capability and can be developed, deployed, and scaled independently.

Let’s review the characteristics, benefits, and challenges associated with microservice-based architecture.

Characteristics of Microservice-based Architecture

  1. Service Independence: Each microservice operates independently and can be developed, deployed, and scaled autonomously.
  2. Bounded Context: Microservices are organised around specific business capabilities or bounded contexts, which allows for modular development and maintenance.
  3. Lightweight Communication: Microservices communicate with each other using lightweight protocols, often through APIs or message queues.
  4. Technology Diversity: Different microservices within an application can be built using different technologies or programming languages based on the specific requirements of each service.
  5. Decentralized Data Management: Each microservice manages its own data storage, either through separate databases or using polyglot persistence approaches.

Advantages and Challenges of Microservice-based Architecture

Advantages of Microservice-based Architecture Challenges of Microservice-based Architecture
Enhanced Scalability: Microservices allow for fine-grained scaling, where only the services experiencing high demand can be scaled independently. This enables efficient resource utilisation and cost-effective scaling. Distributed System Complexity: Microservice architectures introduce complexities associated with distributed systems, such as inter-service communication, service discovery, and eventual consistency.
Fault Isolation: Since microservices are independent, a failure in one service does not necessarily impact the entire application. Faults and issues can be isolated and contained within the affected service, minimising the impact on the overall system. Operational Overhead: Managing and monitoring a larger number of services adds operational overhead. Infrastructure, logging, monitoring, and deployment pipelines become more complex.
Ease of Deployment: Microservices can be deployed independently, making it easier to release updates, bug fixes, and new features. It enables teams to adopt continuous deployment practices and deliver changes to production more frequently. Data Consistency: Maintaining data consistency across microservices can be challenging, especially when dealing with transactions that span multiple services. Eventual consistency patterns and distributed transactions need to be carefully implemented.
Team Autonomy: Microservices facilitate a decentralised development approach, where cross-functional teams can independently develop and maintain their respective services. This allows for better team autonomy and faster decision-making. Service Coordination: Coordinating interactions between services, especially in complex workflows, requires careful design and consideration of message passing, event-driven architectures, or choreography patterns.

Microservice-based architectures offer significant advantages in terms of scalability, fault isolation, ease of deployment, and team autonomy. However, it's crucial to weigh these benefits against the challenges associated with building and managing distributed systems. Organisations need to carefully consider the complexity of their application, the capabilities of their development teams, and the operational overhead before adopting a microservice architecture.

Examples of the use of Microservice-based Architecture

Microservice-based architectures have gained popularity and are suitable for various real-world use cases. Here are some examples and the limitations encountered in terms of scalability, agility, and ease of maintenance:

E-commerce Platforms

Large-scale e-commerce platforms like Amazon and eBay have adopted microservice architectures to handle the complexity of their systems. Each microservice may handle functionalities such as product catalogues, shopping carts, payment processing, inventory management, and user reviews. This allows independent scaling of services based on demand and enables teams to work autonomously on specific services.

Limitations:

  • Scalability: While microservice architectures offer scalability benefits, managing the coordination and consistency across services can be complex.
  • Agility: Introducing new features or making changes in a microservice architecture can require coordination and integration testing across multiple services. The interdependence of services can slow down the agility of development and deployment.
  • Maintenance: Maintaining data integrity and handling eventual consistency among services may require careful design and implementation.

Travel and Booking Systems

Travel and booking platforms like Airbnb or Expedia often employ microservice architectures. Each microservice may handle specific functionalities such as user authentication, accommodation search, booking management, payment processing, and reviews. This architecture enables independent development and scalability of individual services.

Limitations:

  • Scalability: While microservices allow for scalable deployments, managing consistent availability and performance across services can be challenging. Ensuring efficient communication and synchronisation among services under heavy traffic loads requires careful planning and monitoring.
  • Agility: Coordinating changes across multiple services in a travel and booking system can introduce complexity.
  • Maintenance: Maintaining data consistency and handling business workflows that span multiple services may require additional effort for coordination and testing.

Social Media Platforms

Social media platforms like Facebook and Twitter employ microservice architectures to handle massive user bases and diverse functionalities. Different microservices may handle user profiles, news feeds, messaging, notifications, image and video processing, and recommendation systems. This architecture allows for independent scaling and development of services.

Limitations:

  • Scalability: Managing consistent performance and responsiveness across various microservices, especially during peak usage periods, can be challenging. Balancing the load and ensuring efficient communication between services becomes crucial for a seamless user experience.
  • Agility: Coordinating changes and maintaining data consistency across multiple services can introduce complexities in social media platforms.
  • Maintenance: Ensuring synchronised updates, handling event propagation, and maintaining user interactions across services require careful design and coordination.

It's important to note that while microservice architectures offer benefits in scalability, agility, and ease of maintenance, they also introduce complexities and challenges. Organisations need to consider the trade-offs, including the increased operational overhead, distributed system complexities, and potential impact on development agility when deciding to adopt a microservice architecture.

Learning Activity

Imagine a company called "TechMart," which is an e-commerce platform specializing in selling technology products, ranging from smartphones and laptops to smart home devices and accessories. TechMart has been experiencing rapid growth in its customer base, product offerings, and transaction volume. The company wants to revamp its existing application architecture to ensure scalability, maintainability, and the ability to rapidly introduce new features.

Now, the question for the students is: Which architecture, monolithic or microservice-based, would be more suitable for TechMart's needs? Provide your answer and thoughts in the forum 'Learning Activity 1: TechMart'.

To answer this question, you need to consider the following factors:

  1. Scalability: Does TechMart anticipate significant growth in terms of customer traffic and transaction volume? Will the application need to handle peak loads during seasonal sales or promotional events? Assessing scalability requirements will help determine which architecture can efficiently handle increased demand and scale resources accordingly.
  2. Modularity and Maintainability: How complex are the interactions and dependencies among different functionalities within TechMart's application? Will different teams be responsible for developing and maintaining various parts of the system? Evaluating the need for independent development, deployment, and maintenance of different components will guide the choice between monolithic and microservice architectures.
  3. Time-to-Market and Agility: Does TechMart prioritise rapid development and deployment of new features? Is there a need for independent deployment of individual functionalities to avoid downtime and enable faster updates? Understanding the organisation’s agility requirements will influence the selection of an architecture that aligns with the speed and flexibility goals.
  4. Technology Diversity and Team Autonomy: Does TechMart want to leverage different technologies, frameworks, or programming languages for different parts of the application? Are cross-functional teams responsible for specific services or functionalities? Determining the level of technology flexibility and team autonomy required can impact the suitability of monolithic or microservice-based architecture.
  5. Operational Complexity: How well-equipped is TechMart's IT team to manage a distributed system? Can they handle the increased operational overhead associated with microservice architectures? Assessing the availability of expertise, infrastructure, and monitoring capabilities will be crucial in evaluating the feasibility of adopting a microservice-based architecture.

By analysing these factors and considering TechMart's specific requirements, students can determine whether a monolithic or microservice-based architecture would be more suitable for the company's needs. They should justify their choice based on the scalability, modularity, agility, technology diversity, and operational aspects of the scenario.

Go through the AWS Academy Portal’s videos and the challenge questions of Module 13 (Cloud Architecting course).

Cloud Architecting Module 13 – Building Microservices and Serverless Architectures

This module includes the following sections:

Architectural need
  1. Introducing microservices
  2. Building microservice applications with AWS container services
  3. Introducing serverless architectures
  4. Building serverless architectures with AWS Lambda
  5. Extending serverless architectures with Amazon API Gateway
  6. Orchestrating microservices with AWS Step Functions
https://awsacademy.instructure.com/courses/42151/modules#module_482365

As a group, you should be working on the project proposal section, project description, methodology and timelines component of your assessment.

Module Linking
Main Topic Image
A person holding a laptop in a data center
Is Study Guide?
Off
Is Assessment Consultation?
Off