DEV Community

Cover image for Day 0: System Architecture basics
Aishanii
Aishanii

Posted on

Day 0: System Architecture basics

Introduction📚

This first post will just be an introduction to basic terminologies and key concepts one should know before we start working with case studies. I aim to write about the foundational concepts which are useful for system design interview.

High-Level Architecture of a Computer System 📕

System design begins with understanding the high-level architecture of a computer. The fundamental building blocks include:

  1. Bits and Bytes: The smallest unit of data in computing is a bit (0 or 1). Aggregations of bits lead to bytes (8 bits) and further into kilobytes, megabytes, gigabytes, and terabytes.

  2. Storage: Storage devices can either be Hard Disk Drives (HDD) or Solid State Drives (SSD). SSDs are more expensive but significantly faster in data retrieval, boasting speeds up to five times that of HDDs.

  3. RAM: Random Access Memory (RAM) is volatile memory that serves as the primary workspace for currently running applications and data. It provides rapid read and write access, which is crucial for efficient processing.

  4. Cache Memory: This is a smaller, faster memory located closer to the CPU, designed to decrease data access times by storing frequently used data.

  5. CPU: The central processing unit (CPU) is the brain of the computer that executes instructions by compiling high-level programming languages into machine code.

  6. Motherboard: Acts as the communication backbone that interconnects all components.

Production-Ready App Architecture 📗

The architecture of a production-ready application integrates several key components:

  • CI/CD Pipeline: Continuous Integration and Continuous Deployment automate the code deployment process, ensuring seamless transitions from development to production without manual intervention.

  • Load Balancers: These distribute incoming user requests across multiple servers, ensuring reliable performance during peak traffic.

  • External Storage Solutions: Storage systems are kept external to the main production server, interlinked through a network.

  • Logging and Monitoring Systems: These systems record and analyse application performance, allowing real-time error detection and user notification through platforms like Slack.

Debugging Process 📘

When an error occurs, the debugging process comprises:

  • Error Identification: Use logs to find patterns or anomalies.
  • Replication: Recreate the error in a non-production environment.
  • Analysis: Employ tools to inspect the running application.
  • Hotfix Deployment: Implement temporary fixes swiftly to restore functionality.

Key Principles of System Design🥸

Good system design embodies several essential principles:

  1. Scalability: Systems must accommodate increases in users and data traffic gracefully.
  2. Maintainability: Future developers should be able to understand and improve the system.
  3. Efficiency: Resources need to be optimally utilized.

Additionally, systems must be designed with the understanding that failures are inevitable, ensuring they remain robust under adverse conditions.

CAP Theorem 🧢

The CAP theorem, formulated by Eric Brewer, delineates key trade-offs for distributed systems:

  1. Consistency: All nodes must reflect the same data state.
  2. Availability: The system remains operational, serving requests consistently.
  3. Partition Tolerance: Operations persist even in the face of network failures.

A distributed system can only achieve two out of these three characteristics at a time, necessitating a thoughtful approach to designing systems based on specific business needs.

Measuring Availability and Reliability
Availability refers to the operational uptime of the system, typically expressed as a percentage.

Networking Basics 🛜

Networking fundamentals focus on how devices communicate through:

  • IP Addressing: Distinguishing devices on a network (IPv4 and IPv6).

  • Data Packets: Units of data formatted for transmission, containing IP headers to facilitate communication.

  • Transport Layer Protocols: TCP guarantees reliable packet delivery, while UDP provides faster, less reliable transmission, suitable for time-sensitive communications.

Application Layer Protocols 📙

Common application layer protocols include:

  • HTTP: A stateless protocol for web transactions, suitable for standard web operations.
  • WebSockets: Allow for real-time, two-way communication over a single connection.
  • SMTP: Standard used for sending emails between servers.
  • FTP: Used for file transfers.
  • GRPC and GraphQL: Modern methodologies for creating APIs, offering advanced features and flexible queries

API Design Best Practices🙌

Creating exceptional APIs involves defining clear input and output operations. Best practices include:

  • RESTful Principles: Apply standardized HTTP methods and ensure statelessness.
  • GraphQL: Allows clients to request specific datasets, reducing data over-fetching.
  • Rate Limiting: Prevent abuses of the API through controlled requests.

Strategies for Reducing Latency ♻️

Latency reduction techniques such as caching and content delivery networks (CDNs) are pivotal in modern web development:

  • Caching: Storing copies of data to expedite access.
  • CDN: Geographically distributed servers that deliver content closer to users.

Proxy Servers📒

Proxy servers act as intermediaries between clients and servers, fulfilling various roles:

  1. Forward Proxy: Acts on behalf of clients, anonymizing requests and managing internet access.
  2. Reverse Proxy: Disguises backend servers, balancing load and managing SSL encryption.

Load Balancing🎢

Load balancing distributes workloads across multiple servers to prevent bottlenecks. Strategies include:

  • Round Robin: Sequential allocation of requests to servers.
  • Least Connection: Directs traffic to servers with minimal active connections.
  • Geographical Algorithms: Routes requests based on user proximity to servers.

Database Fundamentals📈

Understanding databases is crucial for system design. Key points include:

  • Relational vs. NoSQL Databases: SQL databases offer structured data management, while NoSQL databases provide flexibility for unstructured data.
  • Sharding and Replication: Techniques for horizontal scaling to enhance availability and performance.
  • Caching and Indexing: Important performance optimization techniques.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay