M

Lecture on Distributed Systems and Architectures

3-Tier Distributed Architecture and Modern Systems

Understanding 3-Tier Distributed Architecture

  • Definition: A foundational approach for modern software systems, structuring applications into three distinct logical computing layers.

  • Purpose: To enhance modularity, scalability, and maintainability of software applications by separating concerns into specialized tiers.

Evolution from Traditional Systems

  • Traditional Mainframe Systems:

    • Characterized by a single, central processing system that supplied all computing power.

    • Users interacted via "dumb terminals" which had no processing capability of their own, simply displaying output and sending input to the mainframe.

  • Distributed Systems:

    • Represent a shift where data and processing responsibilities are divided across multiple networked computers.

    • Each computer or component typically has specific roles, allowing for parallel processing and resource distribution.

  • Client-Server Model:

    • An evolution that integrates data and services.

    • Applications are often structured into multiple "tiers" where clients request services from servers.

Client-Server Architecture Types

  • One-Tier Architecture:

    • A simple program that runs entirely on a single computer.

    • Does not involve any network access or communication with external services.

    • Example: A standalone desktop application like an offline word processor.

  • Two-Tier Architecture:

    • Consists of a Client Graphical User Interface (GUI) directly connected to server-side domain logic.

    • The communication between the client and server is typically facilitated by a specific network protocol.

    • Example: A desktop application directly connecting to a database server.

  • Three-Tier Architecture:

    • Introduces a modular design by separating the application into three distinct layers:

      1. Presentation Layer: User interface.

      2. Application (or Business Logic) Layer: Processes business rules.

      3. Data Layer: Manages data storage and retrieval.

    • This separation enhances modularity, making systems easier to develop, maintain, and scale.

  • N-Tier Architecture:

    • An extension of the three-tier model, featuring multiple logical layers.

    • Emphasizes physical separation of these layers, meaning different tiers can run on separate machines or servers.

    • Primarily designed for high scalability and complex enterprise applications where components need to be distributed across various servers.

Components of a 3-Tier Architecture

  • 01 Presentation Layer (Frontend):

    • Role: Responsible for sending Human-readable content (HTML), interactive elements (JavaScript), and styling (CSS) to web browsers. It is what the user directly interacts with.

    • Technologies/Frameworks: Commonly built using modern JavaScript frameworks such as React, Angular, or Vue.js.

  • 02 Application Layer (Backend/Business Logic):

    • Role: Processes the core business logic and rules of the application. It acts as an intermediary between the presentation and data layers, handling requests, performing computations, and orchestrating operations.

    • Programming Languages: Typically implemented using server-side languages like PHP, Java, Python, or C#.

  • 03 Data Layer (Database):

    • Role: Manages the storage, retrieval, and organization of data for the application. It ensures data persistence and provides mechanisms for data access.

    • Database Management Systems (DBMS): Examples include relational databases like MySQL and PostgreSQL, or NoSQL databases such as MongoDB.

Client Computing Classifications

  • Thick Client (Fat Client):

    • Characteristics: Provides rich functionality and performs the majority of the data processing and logic execution locally on the client machine itself.

    • Advantages: Can operate with less reliance on server resources once loaded, potentially offering better performance for local tasks.

  • Thin Client:

    • Characteristics: A lightweight computer that relies heavily on server resources for processing, data storage, and running applications. It primarily acts as a display and input device.

    • Advantages: Easier to manage, lower hardware costs, and centralized updates.

  • Hybrid Client:

    • Characteristics: Combines features of both thick and thin clients. It can store some data or perform some processing locally while still relying on server resources for core functionalities and data storage.

    • Flexibility: Offers a balance between local performance and centralized management.

Cloud Computing Fundamentals

  • On-Demand Self-Service:

    • Principle: Consumers can automatically provision computing capabilities (e.g., server time, network storage) as needed, without requiring human interaction with each service provider.

  • Ubiquitous Access:

    • Principle: Cloud resources are broadly accessible over the network using standard mechanisms that promote use by heterogeneous thin or thick client platforms (e.g., mobile phones, laptops, tablets).

  • Rapid Elasticity:

    • Principle: Capabilities can be rapidly and elastically provisioned or released to scale up and down quickly, sometimes automatically, to match demand.

  • Measured Service:

    • Principle: Cloud systems automatically control and optimize resource use by leveraging a metering capability. Resources are monitored, controlled, and reported, providing transparency for both the provider and consumer of the utilized service. Charges are based on actual resource usage.

Public vs. Private Clouds

  • Public Clouds:

    • Cost: Generally offer lower costs because there is no need for hardware purchase or ongoing maintenance by the user.

    • Management: No maintenance required from the user's side; the provider handles all infrastructure management.

    • Scalability: Provide near-unlimited scalability, allowing users to easily adjust resources up or down rapidly.

    • Reliability: High reliability due to vast network of servers and distributed infrastructure.

    • Example: Microsoft Azure, Amazon Web Services (AWS), Google Cloud Platform.

  • Private Clouds:

    • Customization: Offer more flexibility for customization to meet specific organizational needs.

    • Control & Privacy: Enhanced control over data, security, and infrastructure, leading to better privacy.

    • Scalability: While better than traditional on-premises solutions, scalability is limited by the dedicated resources owned or leased by the organization.

    • Resources: Dedicated resources are exclusively used by a single organization.

    • Typical Users: Government agencies, financial institutions, or organizations with stringent security and compliance requirements.

Internet Protocols & Communication

  • TCP/IP (Transmission Control Protocol/Internet Protocol):

    • Role: The core communication protocol suite that establishes connections and ensures the reliable delivery of data packets across networks. TCP handles connection establishment and data segmentation, while IP handles addressing and routing.

  • HTTP/HTTPS (Hypertext Transfer Protocol/Secure Hypertext Transfer Protocol):

    • Role: HTTP is the fundamental protocol used for transferring web pages and other web content over the internet.

    • Security: HTTPS is the secure version of HTTP, incorporating SSL/TLS (Secure Sockets Layer/Transport Layer Security) encryption to protect communication between the web browser and server, ensuring data privacy and integrity.

  • SMTP/POP3/IMAP (Simple Mail Transfer Protocol/Post Office Protocol 3/Internet Message Access Protocol):

    • Role: These are email protocols used for sending and retrieving messages from mail servers.

      • SMTP: Primarily used for sending email.

      • POP3: Used for retrieving emails from a server, typically downloading them to the local client and deleting them from the server.

      • IMAP: Allows users to manage and retrieve emails from a server, leaving messages on the server, which enables access from multiple devices.

  • FTP (File Transfer Protocol):

    • Role: A standard network protocol used for transferring large files between a client and a server on a computer network.

Modern Development Stacks

  • LAMP Stack:

    • Description: A widely used, open-source solution stack for developing dynamic web applications.

    • Components:

      • Linux: The operating system foundation.

      • Apache: The web server software that serves web pages.

      • MySQL: The relational database management system for storing data.

      • PHP: The server-side scripting language used for developing web applications.

  • MEAN Stack:

    • Description: A JavaScript-based full-stack solution for building robust web applications, using a uniform language across the entire stack.

    • Components:

      • MongoDB: A NoSQL database that stores data in flexible, JSON-like documents.

      • Express.js: A robust web application framework for Node.js, used for building APIs and web applications.

      • Angular: A powerful frontend framework developed by Google for building dynamic single-page applications.

      • Node.js: A JavaScript runtime environment that allows executing JavaScript code on the server-side.

Remote Procedure Calls (RPC)

  • Concept: A protocol that enables a computer program to cause a procedure (a subroutine or function) to execute in another address space (typically on another computer on a shared network) without the programmer explicitly coding the remote interaction. It effectively extends local procedure calls across networks.

  • Process Flow:

    1. Client Request: The client program makes a procedure call, including any necessary arguments, and then pauses its execution, waiting for a response from the remote server.

    2. Server Processing: The server receives the client's request. It then calls a dispatch routine to locate and execute the requested service or procedure, performing the necessary operations.

    3. Response Return: After completing the service, the server sends a reply back to the client. This completes the RPC transaction, and the client resumes its execution, often processing the returned results.

  • Error Handling: RPC mechanisms are designed to handle various issues inherent in distributed systems, such as:

    • Timeouts: When a server fails to respond within a specified period.

    • Version Mismatches: Ensuring compatibility between client and server procedure definitions.

    • Server Crashes: Providing mechanisms for clients to handle unresponsive or failed servers.