Posts

Showing posts from January, 2026

Proxies in System Design

In modern system design, proxy servers play a crucial role in improving performance, enhancing security, and ensuring scalability. A proxy acts as an intermediary between a client and the destination server, enabling features like load balancing, caching, anonymity, and more. Types of Proxies 1. Forward Proxy   Position: Between the client and the internet. Function: Handles requests from clients and forwards them to the appropriate server . Use Cases: Hiding client IP addresses for privacy Caching frequently accessed content Filtering requests (e.g., blocking restricted websites) How to use: Configure client to use proxy for outbound traffic. Use squid (recommended) - traditionally used as a forward proxy (and sometimes transparent proxy). It was built for caching web content and controlling outbound traffic. Script: # squid.conf http_port 3128 acl allowed_clients src 192.168.1.0/24 http_access allow allowed_clients # Optional: block certain domains acl blocked_sites dstdomain .fa...

Data Partitioning in System Design

Data Partitioning Techniques: Making Databases Scale Better As applications grow and data explodes, databases can become bottlenecks. Queries slow down, servers get overloaded, and scaling becomes a nightmare. That’s where data partitioning comes in - a smart way to split your data into manageable chunks so your system stays fast, efficient, and scalable. The most common partitioning techniques with simple examples and their benefits: 1. Horizontal Partitioning (Sharding) Description: Splitting data across multiple tables or databases based on rows. Example 1 : You run a global app with millions of users. Instead of storing all user data in one giant table, you split it by region - Asia, Europe, and America. Each shard handles users from its region, reducing load and speeding up queries. Example 2 (Layman) : Think of a library with millions of books. Instead of keeping them all in one giant hall, you split them into different buildings by genre - fiction, science, history. Each buildin...

Design Patterns

In software engineering, design patterns are tried‑and‑tested solutions to recurring problems in system design. They provide a shared vocabulary for developers and help create flexible, maintainable, and scalable applications. Broadly, design patterns fall into three categories: Creational, Structural, and Behavioral. In brief, Design Patterns are Reusable Solutions for Common Software Problems. Creational Patterns Creational patterns deal with object creation mechanisms , making systems more independent of how their objects are created.          1.  Singleton   Ensures a class has only one instance and provides a global point of access to it. Example: Logger, configuration settings.                        ```                      // Ensures only one instance of a class exists. // Useful for shared resources like l...

Load Balancers in System Design

Image
When building scalable and reliable systems, one of the most critical components is the load balancer. Its job is simple yet powerful: distribute incoming network traffic across multiple servers so that no single server becomes overwhelmed. This ensures smooth performance, high availability, and a better user experience. 🔑 Key Functions of a Load Balancer Traffic Distribution : Spreads requests evenly across servers. Redundancy & Reliability : Keeps services available even if one server fails. Scalability : Makes it easy to add or remove servers as demand changes. Health Monitoring : Continuously checks server status to avoid routing traffic to unhealthy nodes. Session Persistence : Ensures a user’s session stays on the same server when needed. SSL Termination : Offloads encryption/decryption tasks from backend servers. 🛠️ Types of Load Balancers Hardware Load Balancers   Physical devices dedicated to balancing traffic. Often used in enterprise setups.   Software Load Ba...

Database Sharding

Database Sharding: Scaling Your Data the Smart Way As applications grow, databases often struggle to handle massive amounts of data efficiently. Database sharding is a powerful architecture pattern that solves this problem by splitting large datasets into smaller, more manageable chunks called shards . These shards are distributed across multiple machines or database nodes, improving scalability and performance. Why Do We Need Sharding? Handles big data workloads Improves query performance Enables horizontal scaling Provides fault isolation Types of Database Sharding           1. Key-Based Sharding                   Data is distributed using a hash function.                      Example : `application_id % 3` → three shards.           2. Range-Based Sharding            ...

Things to know for System Design

What is System Design? System design is the process of defining the architecture, components, and interfaces of a system to meet specific requirements. Here's a brief breakdown: Identify Requirements: Determine what the system needs to do. High-Level Design: Outline the system's major components and their interactions. Detailed Design: Specify the internal workings of each component. Implementation: Write the code and integrate the components. Testing: Verify that the system meets all requirements and functions correctly. Maintenance: Update and improve the system over time. Functional vs Non-Functional Requirements Functional : Basic functionalities that the system should offer Non-Functional : Quality constraints in application like portability, maintainability, reliability, security etc. What are the components of System Design? Architecture : The overall structure of the system, including how components interact and the flow of data. Components : The individual parts of the...