<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>systemdesign &amp;mdash;   christova  </title>
    <link>https://christova.writeas.com/tag:systemdesign</link>
    <description>&lt;b&gt;&lt;h3&gt;Tech Articles&lt;/h3&gt;&lt;/b&gt;&lt;br/&gt;&lt;b&gt;Collated from various sources. Full copyright remains with original authors.&lt;/b&gt;</description>
    <pubDate>Fri, 08 May 2026 20:00:10 +0000</pubDate>
    <item>
      <title>30 System Design Concepts</title>
      <link>https://christova.writeas.com/30-system-design-concepts-easier-to-learn-than-you-think?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[&#xA;&#xA;#system #systemdesign #designconcepts #explainwithcode&#xA;&#xA;Please Note: This article is free to share - but still, all credit and copyright remains with Ashish Pratap Singh&#xA;&#xA;https://blog.algomaster.io/p/30-system-design-concepts&#xA;&#xA;Please checkout, sign up, subscribe and support all the excellent work Ashish has created for this excellent content in among other superb excellent posts. I am merely forwarding this content; all work belongs to Ashish.&#xA;&#xA;”I also recently created a 20-minute YouTube video https://www.youtube.com/watch?v=s9Qh9fWeOAk that quickly walks through all 30 concepts—packed with visuals and animations to make everything easier to understand.” \\Ashish Pratap Singh&#xA;&#xA;1\. Client-Server Architecture\\&#xA;&#xA;Almost every web application that you use is built on this simple yet powerful concept called client-server architecture.&#xA;&#xA;On one side, you have a client—this could be a web browser, a mobile app, or any other frontend application.&#xA;&#xA;and on the other side, you have a server—a machine that runs continuously, waiting to handle incoming requests.&#xA;&#xA;The client sends a request to store, retrieve, or modify data.&#xA;&#xA;The server receives the request, processes it, performs the necessary operations, and sends back a response.&#xA;&#xA;This sounds simple, but there’s a big question: How does the client even know where to find the server?&#xA;&#xA;---&#xA;&#xA;2. IP Address&#xA;&#xA;A client doesn’t magically know where a server is, it needs an address to locate and communicate with it.&#xA;&#xA;On the internet, computers identify each other using IP addresses, which work like phone numbers for servers.&#xA;&#xA;Every publicly deployed server has a unique IP address. When a client wants to interact with a service, it must send requests to the correct IP address.&#xA;&#xA;But there’s a problem:&#xA;&#xA;When we visit a website, we don’t type its IP address—we just enter the website name.&#xA;We can’t expect users (or even systems) to memorize a string of random numbers for every service they connect to.&#xA;And if we migrate our service to another server, its IP address may change—breaking all direct connections.&#xA;&#xA;---&#xA;&#xA;3. DNS&#xA;&#xA;Instead of relying on hard-to-remember IP addresses, we use something much more human-friendly: domain names.&#xA;&#xA;But, we need a way to map a domain name to it’s corresponding IP address.&#xA;&#xA;This is where DNS (or Domain Name System) comes in. It maps easy to remember domain names (like algomaster.io) to their corresponding IP addresses.&#xA;&#xA;Here’s what happens behind the scenes:&#xA;&#xA;When you type algomaster.io into your browser, your computer asks a DNS server for the corresponding IP address.&#xA;&#xA;Once the DNS server responds with the IP, your browser uses it to establish a connection with the server and make a request.&#xA;&#xA;You can find the IP address of any domain using the ping command. Just open your terminal and type ping followed by the domain name. And it’ll return the IP address currently assigned to that domain.&#xA;&#xA;---&#xA;&#xA;4. Proxy / Reverse Proxy&#xA;&#xA;When you visit a website, your request doesn’t always go directly to the server—sometimes, it passes through a proxy or reverse proxy first.&#xA;&#xA;A proxy server acts as a middleman between your device and the internet.&#xA;&#xA;When you request a webpage, the proxy forwards your request to the target server, retrieves the response, and sends it back to you.&#xA;&#xA;Proxy hides your IP address, keeping your location and identity private.&#xA;&#xA;A reverse proxy works the other way around. It intercepts client requests and forwards them to backend servers based on predefined rules.&#xA;&#xA;Allowing direct access to servers can pose security risks, exposing them to threats like hackers and DDoS attacks.&#xA;&#xA;A reverse proxy mitigates these risks by acting as a controlled entry point that regulates incoming traffic and hides server IPs.&#xA;&#xA;It can also act as a load balancer, distributing traffic across multiple servers.&#xA;&#xA;If you want to learn about Proxy vs Reverse Proxy in more detail, checkout this article:&#xA;&#xA;Proxy vs Reverse Proxy (Explained with Examples)&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;5. Latency&#xA;&#xA;Whenever a client communicates with a server, there’s always some delay. One of the biggest causes of this delay is physical distance.&#xA;&#xA;For example, if our server is in New York, but a user in India sends a request, the data has to travel halfway across the world—and then the response has to make the same long trip back.&#xA;&#xA;This round-trip delay is called latency—the total time it takes for data to travel between the client and the server. High latency can make applications feel slow and unresponsive.&#xA;&#xA;One way to reduce latency is by deploying our service across multiple data centers worldwide.&#xA;&#xA;This way, users can connect to the nearest server instead of waiting for data to travel across the globe.&#xA;&#xA;Once a connection is made, how do clients and servers actually communicate?&#xA;&#xA;---&#xA;&#xA;6. HTTP/HTTPS&#xA;&#xA;Every time you visit a website, your browser and the server communicate using a set of rules called HTTP (Hypertext Transfer Protocol).&#xA;&#xA;That’s why most URLs start with http:// or its secure version, https://.&#xA;&#xA;Here’s how it works:&#xA;&#xA;The client sends a request to the server. This request includes a header (containing details like the request type, browser type, and cookies) and sometimes a request body (which carries additional data, like form inputs).&#xA;The server processes the request and responds with an HTTP response—either returning the requested data or an error message if something goes wrong.&#xA;&#xA;HTTP has a major security flaw, it sends data in plain text. This is a serious problem, especially for sensitive information like passwords, credit card details, and personal data.&#xA;&#xA;That’s why modern websites use HTTPS (Hypertext Transfer Protocol Secure) instead. HTTPS encrypts all data using SSL/TLS, ensuring that even if someone intercepts the request, they can’t read or alter it.&#xA;&#xA;But clients and servers don’t directly exchange raw HTTP requests and response.&#xA;&#xA;HTTP is just a protocol for transferring data but it doesn’t define:&#xA;&#xA;How requests should be structured&#xA;What format responses should be in&#xA;or how different clients should interact with the server.&#xA;&#xA;This is where APIs (or Application Programming Interfaces) come in.&#xA;&#xA;---&#xA;&#xA;7. APIs&#xA;&#xA;Think of an API as a middleman that allows clients (like web and mobile apps) to communicate with servers without worrying about low-level details.&#xA;&#xA;Almost every digital service you use—social media, e-commerce, online banking, ride-hailing apps—is built on APIs working together behind the scenes.&#xA;&#xA;Here’s how it typically works:&#xA;&#xA;A client sends a request to an API.&#xA;&#xA;The API, hosted on a server, processes the request, interacts with databases or other services, and prepares a response.&#xA;&#xA;The API sends back the response in a structured format, usually JSON or XML, which the client understands and can display.&#xA;&#xA;APIs provide a layer of abstraction—the client doesn’t need to know how the server processes the request, only that it returns the expected data.&#xA;&#xA;If you want to learn more about APIs, checkout this article:&#xA;&#xA;What&#39;s an API?&#xA;&#xA;What&#39;s an API?&#xA;&#xA;Read full story&#xA;&#xA;But, not all APIs are built the same. Different API styles exist to serve different needs. Two of the most popular ones are REST and GraphQL.&#xA;&#xA;---&#xA;&#xA;8. Rest API&#xA;&#xA;Among the different API styles, REST (Representational State Transfer) is the most widely used.&#xA;&#xA;A REST API follows a set of rules that define how clients and servers communicate over HTTP in a structured way.&#xA;&#xA;Rest is:&#xA;&#xA;Stateless: Every request is independent; the server doesn’t store client state.&#xA;Resource-Based: Everything is treated as a resource (e.g., /users, /orders, /products).&#xA;Uses Standard HTTP Methods: Clients interact with resources using HTTP methods like:&#xA;  GET → Retrieves data (e.g., fetching a user profile).&#xA;  POST → Creates new data (e.g., adding a new user).&#xA;  PUT/PATCH → Updates existing data (e.g., changing user settings).&#xA;  DELETE → Removes data (e.g., deleting an account).&#xA;&#xA;REST APIs are great because they’re simple, scalable, and easy to cache, but they have limitations, especially when dealing with complex data retrieval.&#xA;&#xA;REST endpoints often return more data than needed, leading to inefficient network usage. If an API doesn’t return related data, the client may need to make multiple requests to retrieve all required information.&#xA;&#xA;To address these challenges, GraphQL was introduced in 2015 by Facebook.&#xA;&#xA;---&#xA;&#xA;9. GraphQL&#xA;&#xA;Unlike REST, which forces clients to retrieve fixed sets of data, GraphQL lets clients ask for exactly what they need—nothing more, nothing less.&#xA;&#xA;With a REST API, if you need a user details, user profile details along with their recent posts, you might have to make multiple requests to different endpoints:&#xA;&#xA;GET /api/users/123 → fetch user details&#xA;&#xA;GET /api/users/123/profile → fetch user profile&#xA;&#xA;GET /api/users/123/posts → fetch user’s posts&#xA;&#xA;With GraphQL, you can combine those requests into one and fetch exactly the data you need in a single query:&#xA;&#xA;The server responds with only the requested fields, reducing unnecessary data transfer and improving efficiency.&#xA;&#xA;However, GraphQL also comes with trade-offs—it requires more processing on the server side and isn’t as easy to cache as REST.&#xA;&#xA;Learn more about REST vs GraphQL here:&#xA;&#xA;REST vs GraphQL&#xA;&#xA;REST vs GraphQL&#xA;&#xA;Read full story&#xA;&#xA;When a client makes a request, they usually want to store or retrieve data.&#xA;&#xA;But this brings up another question—where is the actual data stored?&#xA;&#xA;---&#xA;&#xA;10. Databases&#xA;&#xA;If our application deals with small amounts of data, we could store it in memory.&#xA;&#xA;But modern applications handle massive volumes of data—far more than what memory can efficiently handle.&#xA;&#xA;That’s why we need a dedicated server for storing and managing data—a database.&#xA;&#xA;A database is the backbone of any application. It ensures that data is stored, retrieved, and managed efficiently while keeping it secure, consistent, and durable.&#xA;&#xA;When a client requests to store or retrieve data, the server communicates with the database, fetches the required information, and returns it to the client.&#xA;&#xA;But not all databases are the same. Different applications have different scalability, performance, and consistency requirements, which is choosing the right type of database is important.&#xA;&#xA;If you want to learn about different types of databases, checkout this article:&#xA;&#xA;15 Types of Databases and When to Use Them&#xA;&#xA;15 Types of Databases and When to Use Them&#xA;&#xA;March 24, 2024&#xA;&#xA;Read full story&#xA;&#xA;In system design, we typically choose between SQL and NoSQL databases.&#xA;&#xA;---&#xA;&#xA;11. SQL vs NoSQL&#xA;&#xA;SQL databases store data in tables with a strict predefined schema and follow the ACID properties.&#xA;&#xA;Atomicity - A transaction is all-or-nothing (it either completes fully or not at all).&#xA;Consistency – Data always remains valid and follows defined rules.&#xA;Isolation – Transactions don’t interfere with each other.&#xA;Durability – Once data is saved, it won’t be lost, even if the system crashes.&#xA;&#xA;Because of these guarantees, SQL databases are ideal for applications that require strong consistency and structured relationships, such as banking systems.&#xA;&#xA;  Examples of popular SQL databases include: MySQL and PostgreSQL&#xA;&#xA;NoSQL databases on the other hand are designed for high scalability and performance.&#xA;&#xA;They don’t require a fixed schema and use different data models, including:&#xA;&#xA;Key-Value Stores – Fast lookups for simple key-value pairs (e.g., Redis).&#xA;Document Stores – Store flexible, JSON-like documents (e.g., MongoDB).&#xA;Graph Databases – Best for highly connected data (e.g., Neo4j).&#xA;Wide-Column Stores – Optimized for large-scale, distributed data (e.g., Cassandra).&#xA;&#xA;So, which one should you use? It depends on the system requirements.&#xA;&#xA;If you need structured, relational data with strong consistency → SQL is a better choice.&#xA;If you need high scalability, flexible schemas, or fast reads/writes at scale → NoSQL is a better choice.&#xA;&#xA;Many modern applications use both SQL and NoSQL together.&#xA;&#xA;For example, an e-commerce platform might:&#xA;&#xA;Store customer orders in SQL (because they require strict consistency).&#xA;and store Product recommendations in NoSQL (because they need flexible and fast lookups).&#xA;&#xA;If you want to learn more about SQL vs NoSQL, checkout this article:&#xA;&#xA;SQL vs NoSQL - 7 Key Differences You Must Know&#xA;&#xA;SQL vs NoSQL - 7 Key Differences You Must Know&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;12. Vertical Scaling&#xA;&#xA;As our user base grows, so does the number of requests hitting our application servers.&#xA;&#xA;Initially, a single server might be enough to handle the load. But, as traffic increases, that single server can become a bottleneck, slowing everything down.&#xA;&#xA;One of the quickest solutions is to upgrade the existing server by adding more CPU, RAM or storage.&#xA;&#xA;This approach is called Vertical Scaling (Scaling Up)—making a single machine more powerful.&#xA;&#xA;But there are some major limitations with this approach:&#xA;&#xA;Hardware limits → You can’t keep upgrading a server forever. Every machine has a maximum capacity.&#xA;&#xA;Cost → More powerful servers become exponentially more expensive.&#xA;&#xA;Single Point of Failure (SPOF) → if this one server crashes, the entire system goes down.&#xA;&#xA;So, while vertical scaling is a quick fix, it’s not a long-term solution for handling high traffic and ensuring system reliability.&#xA;&#xA;Lets look at a better approach—one that makes our system more scalable and fault tolerant.&#xA;&#xA;---&#xA;&#xA;13. Horizontal Scaling&#xA;&#xA;Instead of upgrading a single server, what if we add more servers to share the load?&#xA;&#xA;This approach is called Horizontal Scaling (Scaling Out)—where we distribute the workload across multiple machines.&#xA;&#xA;This approach is better because:&#xA;&#xA;More servers = More capacity → The system can handle increasing traffic more effectively.&#xA;No Single Point of Failure → If one server goes down, others can take over, improving reliability.&#xA;Cost-effective → Instead of investing in a single, super-expensive machine, we can use multiple affordable ones.&#xA;&#xA;But horizontal scaling introduces a new challenge: how do clients know which server to connect to?&#xA;&#xA;This is where a Load Balancer comes in.&#xA;&#xA;---&#xA;&#xA;14. Load Balancers&#xA;&#xA;A Load Balancer sits between clients and backend servers, acting as a traffic manager that distributes requests across multiple servers.&#xA;&#xA;If one server crashes, the Load Balancer automatically redirects traffic to another healthy server.&#xA;&#xA;But how does a Load Balancer decide which server should handle the next request?&#xA;&#xA;It uses Load Balancing algorithms, such as:&#xA;&#xA;Round Robin → Requests are sent to servers sequentially, one after another in a loop.&#xA;&#xA;Least Connections → Requests are sent to the server with the fewest active connections.&#xA;&#xA;and IP Hashing → Requests from the same IP address always go to the same server, which helps with session consistency.&#xA;&#xA;Learn more about load balancing algorithms here:&#xA;&#xA;Load Balancing Algorithms Explained with Code&#xA;&#xA;Load Balancing Algorithms Explained with Code&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;So far, we’ve talked about scaling our application servers, but as traffic grows, the volume of data also increases.&#xA;&#xA;At first, we can scale a database vertically by adding more CPU, RAM, and storage, but there’s a limit to how much a single machine can handle.&#xA;&#xA;So, let’s explore other database scaling techniques that help manage large volumes of data efficiently.&#xA;&#xA;---&#xA;&#xA;15. Database Indexing&#xA;&#xA;One of the quickest and most effective ways to speed up database read queries is indexing.&#xA;&#xA;Think of it like the index page at the back of a book—instead of flipping through every page, you jump directly to the relevant section.&#xA;&#xA;A database index works the same way. It’s is a super-efficient lookup table that helps the database quickly locate the required data without scanning the entire table.&#xA;&#xA;An index stores column values along with pointers to the actual data rows in the table.&#xA;&#xA;Indexes are typically created on columns that are frequently queried, such as:&#xA;&#xA;Primary keys&#xA;Foreign keys&#xA;Columns used in WHERE conditions&#xA;&#xA;But be careful—while indexes speed up reads, they slow down writes (INSERT, UPDATE, DELETE) since the index needs to be updated whenever data changes.&#xA;&#xA;That’s why we should only index the most frequently accessed columns.&#xA;&#xA;Learn more about Database Indexes here:&#xA;&#xA;Database Indexes: A detailed guide&#xA;&#xA;Database Indexes: A detailed guide&#xA;&#xA;Read full story&#xA;&#xA;Indexing significantly improves read performance, but what if even indexing isn’t enough, and our database can’t handle the growing number of read requests?&#xA;&#xA;That’s where our next database scaling technique Replication comes in.&#xA;&#xA;---&#xA;&#xA;16. Replication&#xA;&#xA;Just like we added more application servers to handle traffic, we can scale our database by creating copies of it across multiple servers.&#xA;&#xA;Here’s how it works:&#xA;&#xA;We have one primary database (also called the Primary Replica) that handles all write operations (INSERT, UPDATE, DELETE).&#xA;We have multiple read replicas that handle read queries (SELECT).&#xA;Whenever data is written to the primary database, it gets copied to the read replicas so that they stay in sync.&#xA;&#xA;Replication improves the read performance since read requests are spread across multiple replicas, reducing the load on each one.&#xA;&#xA;This also improves availability since if the primary replica fails, a read replica can take over as the new primary.&#xA;&#xA;Replication is great for scaling read heavy applications, but what if we need to scale writes or store huge amounts of data?&#xA;&#xA;---&#xA;&#xA;17. Sharding&#xA;&#xA;Let’s say our service now has millions of users, and our database has grown to terabytes of data.&#xA;&#xA;A single database server will eventually struggle to handle all this data efficiently.&#xA;&#xA;Instead of keeping everything in one place, we split the database into smaller, more manageable pieces and distribute them across multiple servers.&#xA;&#xA;This technique is called Sharding.&#xA;&#xA;We divide the database into smaller parts called shards.&#xA;Each shard contains a subset of the total data.&#xA;Data is distributed based on a sharding key (e.g., user ID).&#xA;&#xA;By distributing data this way, we:&#xA;&#xA;Reduce database load → Each shard handles only a portion of queries.&#xA;Speed up read and write performance → Queries are distributed across multiple shards instead of hitting a single database.&#xA;&#xA;Sharding is also referred to as horizontal partitioning since it splits data by rows.&#xA;&#xA;If you want to learn more about Sharding, checkout this article:&#xA;&#xA;What is Database Sharding?&#xA;&#xA;What is Database Sharding?&#xA;&#xA;May 12, 2024&#xA;&#xA;Read full story&#xA;&#xA;But what if the issue isn’t the number of rows, but rather the number of columns?&#xA;&#xA;In such cases, we use Vertical Partitioning, where we split the database by columns. Let’s explore that next.&#xA;&#xA;---&#xA;&#xA;18. Vertical Partitioning&#xA;&#xA;Imagine we have a User table that stores:&#xA;&#xA;profile details (name, email, profile picture)&#xA;login history (lastlogin, IP addresses)&#xA;and billing information (billing address, payment details)&#xA;&#xA;As this table grows, queries become slower because the database must scan many columns even when a request only needs a few specific fields.&#xA;&#xA;To optimize this, we use Vertical Partitioning where we split user table into smaller, more focused tables based on usage patterns.&#xA;&#xA;UserProfile → Stores name, email, profile picture.&#xA;UserLogin → Stores login timestamps.&#xA;UserBilling → Stores billing address, payment details.&#xA;&#xA;This improves query performance since each request only scans relevant columns instead of the entire table.&#xA;&#xA;It reduces unnecessary disk I/O, making data retrieval quicker.&#xA;&#xA;However, no matter how much we optimize the database, retrieving data from disk is always slower than retrieving from memory.&#xA;&#xA;What if we could store frequently accessed data in memory for lightning-fast access?&#xA;&#xA;This is called caching.&#xA;&#xA;---&#xA;&#xA;19. Caching&#xA;&#xA;Caching is used to optimize the performance of a system by storing frequently accessed data in memory instead of repeatedly fetching it from the database.&#xA;&#xA;One of the most common caching strategies is the Cache Aside Pattern.&#xA;&#xA;Here’s how it works:&#xA;&#xA;When a user requests a data, the application first check the cache.&#xA;&#xA;If the data is in the cache, it’s returned instantly, avoiding a database call.&#xA;&#xA;If the data is not in the cache, the application retrieves it from the database, stores it in the cache for future requests, and returns it to the user.&#xA;&#xA;Next time, the same data is requested, it’s served directly from cache, making the request much faster.&#xA;&#xA;To prevent outdated data from being served, we use Time-to-Live (TTL)—an expiration time set on cached data so it gets automatically refreshed after a certain period.&#xA;&#xA;  Popular caching tools include Redis and Memcached.&#xA;&#xA;If you want to learn more about caching strategies, check out this article:&#xA;&#xA;Top 5 Caching Strategies Explained&#xA;&#xA;Top 5 Caching Strategies Explained&#xA;&#xA;Read full story&#xA;&#xA;Lets look at the next database scaling technique.&#xA;&#xA;---&#xA;&#xA;20. Denormalization&#xA;&#xA;Most relational databases use Normalization to store data efficiently by breaking it into separate tables.&#xA;&#xA;For example, in an e-commerce system:&#xA;&#xA;The Users table stores user details.&#xA;The Orders table stores their orders.&#xA;The Products table stores product details.&#xA;&#xA;While this reduces redundancy, it also introduces joins. When retrieving data from multiple tables, the database must combine them using JOIN operations, which can slow down queries as the dataset grows.&#xA;&#xA;SELECT o.orderid, u.name, u.email, o.product, o.amount&#xA;FROM orders o&#xA;JOIN users u ON o.userid = u.userid;&#xA;&#xA;Denormalization reduces the number of joins by combining related data into a single table, even if it means some data gets duplicated.&#xA;&#xA;Example: Instead of keeping Users and Orders in separate tables, we create UserOrders table that stores user details along with their latest orders.&#xA;&#xA;Now, when retrieving a user’s order history, we don’t need a JOIN operation—the data is already stored together leading to faster queries and better read performance.&#xA;&#xA;SELECT orderid, username AS name, useremail AS email, product, amount&#xA;FROM orders;&#xA;&#xA;Denormalization is often used in read-heavy applications where speed is more critical but the downside is it leads to increases storage usage and more complex update requests.&#xA;&#xA;---&#xA;&#xA;21. CAP Theorem&#xA;&#xA;As we scale our system across multiple servers, databases, and data centers, we enter the world of distributed systems.&#xA;&#xA;One of the fundamental principles of distributed systems is the CAP Theorem, which states that: No distributed system can achieve all three of the following at the same time:&#xA;&#xA;Consistency (C) → Every node always returns the most recent data.&#xA;Availability (A) → The system always responds to requests, even if some nodes are down (but the data may not be the latest).&#xA;Partition Tolerance (P) → The system continues operating even if there’s a network failure between nodes.&#xA;&#xA;Since network failures (P) are inevitable, we must choose between:&#xA;&#xA;Consistency + Partition Tolerance (CP) → Ensures every request gets the latest data but may reject requests during failures. Example: SQL databases like MySQL.&#xA;Availability + Partition Tolerance (AP) → Ensures the system always responds, even if some data is stale. Example: NoSQL databases like Cassandra and DynamoDB.&#xA;&#xA;To learn more about CAP theorem, check out this article:&#xA;&#xA;CAP Theorem Explained&#xA;&#xA;CAP Theorem Explained&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;July 31, 2024&#xA;&#xA;Read full story&#xA;&#xA;In distributed NoSQL databases, achieving instant consistency across all servers is too slow.&#xA;&#xA;Instead, we use Eventual Consistency—which means:&#xA;&#xA;Not all nodes are updated instantly, but given enough time, they eventually sync and return the same data.&#xA;This allows the system to remain highly available and fast, even under extreme loads.&#xA;&#xA;How Eventual Consistency Works:&#xA;&#xA;A user updates data in one replica of the database.&#xA;&#xA;The system immediately acknowledges the update, ensuring high availability.&#xA;&#xA;The update is then propagated asynchronously to other replicas.&#xA;&#xA;After a short delay, all replicas have the latest data, ensuring consistency over time.&#xA;&#xA;---&#xA;&#xA;22. Blob Storage&#xA;&#xA;Most modern applications don’t just store text records, they also need to handle images, videos, pdfs and other large files.&#xA;&#xA;But here’s the problem: Traditional databases are not designed to store large, unstructured files efficiently.&#xA;&#xA;So, what’s the solution?&#xA;&#xA;We use Blob Storage like Amazon S3—a highly scalable and cost-effective way to store large, unstructured files in the cloud.&#xA;&#xA;Blobs are the individual files like images, videos or documents.&#xA;&#xA;These blobs are stored inside logical containers or buckets in the cloud.&#xA;&#xA;Each file gets a unique URL, making it easy to retrieve and serve over the web.&#xA;&#xA;  Example: https://my-bucket-name.s3.amazonaws.com/videos/tutorial.mp4&#xA;&#xA;There are several advantages with using blob storage like:&#xA;&#xA;Scalability → It can store petabytes of data effortlessly.&#xA;Pay-as-you-go pricing → You only pay for storage and retrieval that you actually use.&#xA;Automatic replication → Data is copied across multiple data centers and availability zones for durability.&#xA;Easy access → Files can be retrieved using REST APIs or direct URLs.&#xA;&#xA;A common use case is to stream audio or video files to user application in real-time.&#xA;&#xA;But streaming directly from blob-storage can be slow, especially if the data is stored in a distant location.&#xA;&#xA;---&#xA;&#xA;23. CDN&#xA;&#xA;For example, imagine you’re in India trying to watch a YouTube video that’s hosted on a server in California.&#xA;&#xA;Since the video data has to travel across the world, this could lead to buffering and slow load times.&#xA;&#xA;A Content Delivery Network (or CDN) solves this problem by delivering content faster to users based on their location.&#xA;&#xA;Map of globally distributed servers serving content - What is a CDN&#xA;&#xA;source: https://www.cloudflare.com/learning/cdn/what-is-a-cdn/&#xA;&#xA;A CDN is a global network of distributed servers that work together to deliver web content (like HTML pages, JavaScript files, stylesheets, images, and videos) to users based on their geographic location.&#xA;&#xA;Instead of serving content from a single data center, a CDN caches static contents on multiple edge servers located worldwide.&#xA;&#xA;When a user requests content, the nearest CDN server delivers it instead of reaching all the way to the origin server.&#xA;&#xA;Since content is served from the closest CDN node, users experience faster load times with minimal buffering.&#xA;&#xA;To learn more about CDN, check out this article:&#xA;&#xA;What is a Content Delivery Network?&#xA;&#xA;What is a Content Delivery Network?&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;24. WebSockets&#xA;&#xA;Most web applications use HTTP, which follows a request-response model.&#xA;&#xA;The client sends a request.&#xA;&#xA;The server processes the request and sends a response.&#xA;&#xA;If the client needs new data, it must send another request.&#xA;&#xA;This works fine for static web pages but it’s too slow and inefficient for real-time applications like: live chat apps, stock market dashboards and online multiplayer games.&#xA;&#xA;With HTTP, the only way to get real-time updates is through polling—sending repeated requests every few seconds.&#xA;&#xA;But polling is inefficient because it increases server load and wastes bandwidth, as most responses are empty (when there’s no new data).&#xA;&#xA;WebSockets solve this problem by allowing continuous, two-way communication between the client and server over a single persistent connection.&#xA;&#xA;Here is how WebSockets work:&#xA;&#xA;The client initiates a WebSocket connection with the server.&#xA;&#xA;Once established, the connection remains open.&#xA;&#xA;The server can push updates to the client at any time, without waiting for a request.&#xA;&#xA;The client can also send messages instantly to the server.&#xA;&#xA;This enables real-time interactions and eliminates the need for polling.&#xA;&#xA;To learn more about WebSockets, check out this article:&#xA;&#xA;What are WebSockets and Why are they Used?&#xA;&#xA;What are WebSockets and Why are they Used?&#xA;&#xA;Read full story&#xA;&#xA;WebSockets enable real-time communication between a client and a server, but what if a server needs to notify another server when an event occurs?&#xA;&#xA;Example:&#xA;&#xA;When a user makes a payment, Stripe needs to notify your application instantly.&#xA;If someone pushes code to GitHub, a CI/CD system (e.g., Jenkins) should be triggered automatically.&#xA;&#xA;Enter Webhooks.&#xA;&#xA;---&#xA;&#xA;25. Webhooks&#xA;&#xA;Instead of constantly polling an API to check if an event has occured, Webhooks allow a server to send an HTTP request to another server as soon as the event occurs.&#xA;&#xA;Here’s how it works:&#xA;&#xA;The receiver (your app) registers a webhook URL with the provider (e.g., Stripe, GitHub, Twilio).&#xA;When an event occurs (e.g., user makes a payment), the provider sends an HTTP POST request to the webhook URL with event details.&#xA;Your app processes the incoming request and updates data accordingly.&#xA;&#xA;This saves server resources and reduces unnecessary API calls.&#xA;&#xA;---&#xA;&#xA;26. Microservices&#xA;&#xA;Traditionally, applications were built using a monolithic architecture, where:&#xA;&#xA;All features (e.g., authentication, payments, orders, shipping) are inside one large codebase.&#xA;If one part of the system fails or needs scaling, the entire system is affected.&#xA;Deployment is risky—one bad update can take down the entire app.&#xA;&#xA;Example: Imagine an e-commerce app where the order, payment, inventory, and shipping modules are all tightly connected in a single codebase.&#xA;&#xA;If the inventory system crashes, the entire app could go down.&#xA;&#xA;Monoliths work fine for small applications, but for large-scale systems, they become hard to manage, scale, and deploy.&#xA;&#xA;The solution is to break down your application into smaller, independent services called micro-services that work together.&#xA;&#xA;Each microservice:&#xA;&#xA;Handles a single responsibility&#xA;&#xA;Has its own database and logic, so it can scale independently.&#xA;&#xA;Communicates with other microservices using APIs or message queues.&#xA;&#xA;This way services can be scaled and deployed individually without affecting the entire system.&#xA;&#xA;However, when multiple microservices need to communicate, direct API calls aren’t always efficient—this is where Message Queues come in.&#xA;&#xA;---&#xA;&#xA;27. Message Queues&#xA;&#xA;In a monolithic system, functions call each other directly and wait for a response.&#xA;&#xA;But in a microservices-based system, this approach is inefficient because:&#xA;&#xA;If one service is slow or down, everything waits.&#xA;High traffic can overload a single service.&#xA;Synchronous communication (waiting for immediate responses) doesn’t scale well.&#xA;&#xA;A Message Queue enables services to communicate asynchronously, allowing requests to be processed without blocking other operations.&#xA;&#xA;Here’s How It Works:&#xA;&#xA;A producer (e.g., checkout service) places a message in the queue (e.g., &#34;Process Payment&#34;).&#xA;&#xA;The queue temporarily holds the message until a consumer (e.g., payment service) is ready to process it.&#xA;&#xA;The consumer retrieves the message and processes it.&#xA;&#xA;Using message queues, we can decouple services and improve the scalability and fault tolerance.&#xA;&#xA;  Common message queue systems include: Apache Kafka, Amazon SQS and RabbitMQ.&#xA;&#xA;To learn more about Message Queues, check out this article:&#xA;&#xA;What are Message Queues and When to Use Them?&#xA;&#xA;What are Message Queues and When to Use Them?&#xA;&#xA;Read full story&#xA;&#xA;Using message queues, we can prevent overload on internal services within our system.&#xA;&#xA;But, how do we prevent overload for the public APIs and services we deploy.&#xA;&#xA;We use rate limiting.&#xA;&#xA;---&#xA;&#xA;28. Rate Limiting&#xA;&#xA;Imagine a bot starts making thousands of requests per second to your website.&#xA;&#xA;Without restrictions, this could:&#xA;&#xA;Crash your servers by consuming all available resources.&#xA;Increase cloud costs due to excessive API usage.&#xA;and degrade performance for legitimate users.&#xA;&#xA;Rate Limiting restricts the number of requests a client can send within a specific time frame.&#xA;&#xA;Here’s How It Works:&#xA;&#xA;Every user or IP address is assigned a request quota (e.g., 100 requests per minute).&#xA;&#xA;If they exceed this limit, the server blocks additional requests temporarily and returns an error (HTTP 429 – Too Many Requests).&#xA;&#xA;There are various rate limiting algorithms. Some of the popular ones are:&#xA;&#xA;Fixed Window → Limits requests based on a fixed time window (e.g., 100 requests per minute).&#xA;Sliding Window → More flexible version that dynamically adjusts limits to smooth out request bursts.&#xA;Token Bucket → Users get tokens for requests, which replenish over time at a fixed rate.&#xA;&#xA;To learn more about rate limiting algorithms, checkout this article:&#xA;&#xA;Rate Limiting Algorithms Explained with Code&#xA;&#xA;Rate Limiting Algorithms Explained with Code&#xA;&#xA;Read full story&#xA;&#xA;We don’t need to implement our own rate limiting system - this can be handled by something called an API gateway.&#xA;&#xA;---&#xA;&#xA;29. API Gateways&#xA;&#xA;An API Gateway is a centralized service that handles authentication, rate limiting, logging and monitoring, and request routing.&#xA;&#xA;Imagine a microservices-based application with multiple services.&#xA;&#xA;Instead of exposing each service directly, an API Gateway acts as a single entry point for all client requests.&#xA;&#xA;How API Gateways Work:&#xA;&#xA;The client sends a request to the API Gateway.&#xA;&#xA;The Gateway validates the request (e.g., authentication, rate limits).&#xA;&#xA;It routes the request to the appropriate micro-service.&#xA;&#xA;The response is sent back through the Gateway to the client.&#xA;&#xA;API gateway simplifies API management and improves scalability and security.&#xA;&#xA;  Popular API Gateway solutions include NGINX, Kong and AWS API Gateway.&#xA;&#xA;If you want to learn more about API gateways, checkout this article:&#xA;&#xA;What is an API Gateway?&#xA;&#xA;What is an API Gateway?&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;30. Idempotency&#xA;&#xA;In distributed systems, network failures and service retries are common. If a user accidentally refreshes a payment page, the system might receive two payment requests instead of one.&#xA;&#xA;Idempotency ensures that repeated requests produce the same result as if the request was made only once.&#xA;&#xA;Here’s how it works:&#xA;&#xA;Each request is assigned a unique ID (e.g., request1234).&#xA;&#xA;Before processing, the system checks if the request has already been handled.&#xA;&#xA;If yes → It ignores the duplicate request.&#xA;&#xA;If no → It processes the request normally.&#xA;&#xA;Idempotency prevents duplicate transactions and ensures data consistency in distributed systems.&#xA;&#xA;If you want to learn more about idempotency, checkout this article:&#xA;&#xA;What is Idempotency in Distributed Systems?&#xA;&#xA;What is Idempotency in Distributed Systems?&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;Thank you so much for reading!&#xA;&#xA;This post is public so feel free to share it.]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://i.snap.as/dB4IRWj0.webp" alt=""/></p>

<p><a href="https://christova.writeas.com/tag:system" class="hashtag"><span>#</span><span class="p-category">system</span></a> <a href="https://christova.writeas.com/tag:systemdesign" class="hashtag"><span>#</span><span class="p-category">systemdesign</span></a> <a href="https://christova.writeas.com/tag:designconcepts" class="hashtag"><span>#</span><span class="p-category">designconcepts</span></a> <a href="https://christova.writeas.com/tag:explainwithcode" class="hashtag"><span>#</span><span class="p-category">explainwithcode</span></a></p>

<p><strong>Please Note</strong>: This article <strong>is</strong> free to share – but still, all credit and copyright remains with <strong><a href="https://substack.com/@ashishps">Ashish Pratap Singh</a></strong></p>

<p><a href="https://blog.algomaster.io/p/30-system-design-concepts" title="30 System Design Concepts">https://blog.algomaster.io/p/30-system-design-concepts</a></p>

<p>Please checkout, sign up, subscribe and support all the excellent work Ashish has created for this excellent content in among other superb excellent posts. I am merely forwarding this content; all work belongs to Ashish.</p>

<p>”I also recently created a <strong>20-minute</strong> YouTube video <strong><iframe allow="monetization" class="embedly-embed" src="//cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fs9Qh9fWeOAk%3Ffeature%3Doembed&display_name=YouTube&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Ds9Qh9fWeOAk&image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fs9Qh9fWeOAk%2Fhqdefault.jpg&type=text%2Fhtml&schema=youtube" width="640" height="360" scrolling="no" title="YouTube embed" frameborder="0" allow="autoplay; fullscreen; encrypted-media; picture-in-picture;" allowfullscreen="true"></iframe></strong> that quickly walks through all 30 concepts—<strong>packed with visuals and animations</strong> to make everything easier to understand.” **<a href="https://substack.com/@ashishps">Ashish Pratap Singh</a></p>

<p>1. Client-Server Architecture**</p>

<p>Almost every web application that you use is built on this simple yet powerful concept called <strong>client-server architecture</strong>.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!GgVl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05ba06b8-7730-4d3e-a6d9-1f8c81770b55_1364x446.png"><img src="https://substackcdn.com/image/fetch/$s_!GgVl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05ba06b8-7730-4d3e-a6d9-1f8c81770b55_1364x446.png" alt=""/></a></p>

<p>On one side, you have a <strong>client</strong>—this could be a web browser, a mobile app, or any other frontend application.</p>

<p>and on the other side, you have a <strong>server</strong>—a machine that runs continuously, waiting to handle incoming requests.</p>

<p>The client sends a request to <strong>store, retrieve, or modify data</strong>.</p>

<p>The server receives the request, processes it, performs the necessary operations, and sends back a response.</p>

<p>This sounds simple, but there’s a big question: <em><strong>How does the client even know where to find the server?</strong></em></p>

<hr/>

<h2 id="2-ip-address" id="2-ip-address"><strong>2. IP Address</strong></h2>

<p>A client doesn’t magically know where a server is, it needs an <strong>address</strong> to locate and communicate with it.</p>

<p>On the internet, computers identify each other using <strong>IP addresses</strong>, which work like phone numbers for servers.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!7vrc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbefd954a-3bf4-4000-9749-8bbe491b7881_1304x848.png"><img src="https://substackcdn.com/image/fetch/$s_!7vrc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbefd954a-3bf4-4000-9749-8bbe491b7881_1304x848.png" alt=""/></a></p>

<p>Every publicly deployed server has a <strong>unique IP address</strong>. When a client wants to interact with a service, it must send requests to the correct IP address.</p>

<p>But there’s a problem:</p>
<ul><li>When we visit a website, we don’t type its IP address—we just enter the website name.</li>
<li>We can’t expect users (or even systems) to memorize a string of random numbers for every service they connect to.</li>
<li>And if we migrate our service to another server, its IP address may change—breaking all direct connections.</li></ul>

<hr/>

<h2 id="3-dns" id="3-dns"><strong>3. DNS</strong></h2>

<p>Instead of relying on hard-to-remember IP addresses, we use something much more human-friendly: <strong>domain names</strong>.</p>

<p>But, we need a way to map a domain name to it’s corresponding IP address.</p>

<p>This is where <strong>DNS (or Domain Name System)</strong> comes in. It maps easy to remember domain names (like <a href="http://algomaster.io/">algomaster.io</a>) to their corresponding IP addresses.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!s6fZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a22b7b4-f51c-47c7-a9db-abb5ce56def7_1284x916.png"><img src="https://substackcdn.com/image/fetch/$s_!s6fZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a22b7b4-f51c-47c7-a9db-abb5ce56def7_1284x916.png" alt=""/></a></p>

<p>Here’s what happens behind the scenes:</p>
<ol><li><p>When you type <code>algomaster.io</code> into your browser, your computer asks a DNS server for the corresponding IP address.</p></li>

<li><p>Once the DNS server responds with the IP, your browser uses it to establish a connection with the server and make a request.</p></li></ol>

<p>You can find the IP address of any domain using the <strong>ping</strong> command. Just open your terminal and type ping followed by the domain name. And it’ll return the IP address currently assigned to that domain.</p>

<hr/>

<h2 id="4-proxy-reverse-proxy" id="4-proxy-reverse-proxy"><strong>4. Proxy / Reverse Proxy</strong></h2>

<p>When you visit a website, your request doesn’t always go directly to the server—sometimes, it passes through a <strong>proxy</strong> or <strong>reverse proxy</strong> first.</p>

<p>A <strong>proxy server</strong> acts as a <strong>middleman</strong> between your device and the internet.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!i5Av!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff11ff886-4db5-4550-aa0f-5f232b094b03_887x477.png"><img src="https://substackcdn.com/image/fetch/$s_!i5Av!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff11ff886-4db5-4550-aa0f-5f232b094b03_887x477.png" alt=""/></a></p>

<p>When you request a webpage, the proxy forwards your request to the target server, retrieves the response, and sends it back to you.</p>

<p>Proxy hides your IP address, keeping your location and identity private.</p>

<p>A <strong>reverse proxy</strong> works the other way around. It intercepts client requests and forwards them to backend servers based on predefined rules.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!L8Gg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3be42662-47d2-4165-b278-95d583e2d2be_904x517.png"><img src="https://substackcdn.com/image/fetch/$s_!L8Gg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3be42662-47d2-4165-b278-95d583e2d2be_904x517.png" alt=""/></a></p>

<p>Allowing direct access to servers can pose <strong>security risks</strong>, exposing them to threats like <strong>hackers</strong> and <strong>DDoS attacks</strong>.</p>

<p>A reverse proxy mitigates these risks by acting as a controlled entry point that regulates incoming traffic and hides server IPs.</p>

<p>It can also act as a load balancer, distributing traffic across multiple servers.</p>

<p>If you want to learn about Proxy vs Reverse Proxy in more detail, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/proxy-vs-reverse-proxy-explained"><img src="https://substackcdn.com/image/fetch/$s_!-vu2!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F005673b3-62cb-48a8-adc6-19fc69156a17_887x477.png" alt="Proxy vs Reverse Proxy (Explained with Examples)"/></a></p>

<p><strong><a href="https://blog.algomaster.io/p/proxy-vs-reverse-proxy-explained">Read full story</a></strong></p>

<hr/>

<h2 id="5-latency" id="5-latency"><strong>5. Latency</strong></h2>

<p>Whenever a client communicates with a server, there’s always some delay. One of the biggest causes of this delay is <strong>physical distance</strong>.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!CL6W!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664e76b6-37fa-4e36-b8a5-d41a5b0ad93a_1866x988.png"><img src="https://substackcdn.com/image/fetch/$s_!CL6W!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664e76b6-37fa-4e36-b8a5-d41a5b0ad93a_1866x988.png" alt=""/></a></p>

<p>For example, if our server is in <strong>New York</strong>, but a user in <strong>India</strong> sends a request, the data has to travel halfway across the world—and then the response has to make the same long trip back.</p>

<p>This round-trip delay is called <strong>latency</strong>—the total time it takes for data to travel between the client and the server. High latency can make applications feel slow and unresponsive.</p>

<p>One way to <strong>reduce latency</strong> is by deploying our service across <strong>multiple data centers worldwide</strong>.</p>

<p>This way, users can connect to the <strong>nearest</strong> server instead of waiting for data to travel across the globe.</p>

<p><em><strong>Once a connection is made, how do clients and servers actually communicate?</strong></em></p>

<hr/>

<h2 id="6-http-https" id="6-http-https"><strong>6. HTTP/HTTPS</strong></h2>

<p>Every time you visit a website, your browser and the server communicate using a set of rules called <strong>HTTP (Hypertext Transfer Protocol)</strong>.</p>

<p>That’s why most URLs start with <code>http://</code> or its secure version, <code>https://</code>.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!8BgK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46796792-f8b5-4e13-b4c2-6920b3d6e0e7_1942x1170.png"><img src="https://substackcdn.com/image/fetch/$s_!8BgK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46796792-f8b5-4e13-b4c2-6920b3d6e0e7_1942x1170.png" alt=""/></a></p>

<p>Here’s how it works:</p>
<ul><li>The <strong>client</strong> sends a request to the server. This request includes a <strong>header</strong> (containing details like the request type, browser type, and cookies) and sometimes a <strong>request body</strong> (which carries additional data, like form inputs).</li>
<li>The <strong>server</strong> processes the request and responds with an <strong>HTTP response</strong>—either returning the requested data or an error message if something goes wrong.</li></ul>

<p>HTTP has a major security flaw, it <strong>sends data in plain text</strong>. This is a serious problem, especially for sensitive information like passwords, credit card details, and personal data.</p>

<p>That’s why modern websites use <strong>HTTPS (Hypertext Transfer Protocol Secure)</strong> instead. HTTPS encrypts all data using <strong>SSL/TLS,</strong> ensuring that even if someone intercepts the request, they can’t read or alter it.</p>

<p>But clients and servers don’t directly exchange raw HTTP requests and response.</p>

<p>HTTP is just a <strong>protocol</strong> for transferring data but it doesn’t define:</p>
<ul><li>How requests should be structured</li>
<li>What format responses should be in</li>
<li>or how different clients should interact with the server.</li></ul>

<p>This is where <strong>APIs (or Application Programming Interfaces)</strong> come in.</p>

<hr/>

<h2 id="7-apis" id="7-apis"><strong>7. APIs</strong></h2>

<p>Think of an API as a <strong>middleman</strong> that allows clients (like web and mobile apps) to communicate with servers without worrying about low-level details.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!EH_B!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c3a0e69-9134-4bd9-9d42-a898bc838e32_1574x504.png"><img src="https://substackcdn.com/image/fetch/$s_!EH_B!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c3a0e69-9134-4bd9-9d42-a898bc838e32_1574x504.png" alt=""/></a></p>

<p>Almost every digital service you use—social media, e-commerce, online banking, ride-hailing apps—is built on APIs working together behind the scenes.</p>

<p>Here’s how it typically works:</p>
<ol><li><p>A <strong>client</strong> sends a request to an API.</p></li>

<li><p>The <strong>API</strong>, hosted on a server, processes the request, interacts with databases or other services, and prepares a response.</p></li>

<li><p>The <strong>API sends back the response</strong> in a structured format, usually <strong>JSON</strong> or <strong>XML</strong>, which the client understands and can display.</p></li></ol>

<p>APIs provide a <strong>layer of abstraction</strong>—the client doesn’t need to know <strong>how</strong> the server processes the request, only that it <strong>returns the expected data</strong>.</p>

<p>If you want to learn more about APIs, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/whats-an-api"><img src="https://substackcdn.com/image/fetch/$s_!f-cG!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae14a376-92a3-4ff6-a329-8e4f2a7ac9b5_1546x1074.png" alt="What&#39;s an API?"/></a></p>

<h4 id="what-s-an-api-https-blog-algomaster-io-p-whats-an-api" id="what-s-an-api-https-blog-algomaster-io-p-whats-an-api"><strong><a href="https://blog.algomaster.io/p/whats-an-api">What&#39;s an API?</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/whats-an-api">Read full story</a></strong></p>

<p>But, not all APIs are built the same. Different API styles exist to serve different needs. Two of the most popular ones are <strong>REST</strong> and <strong>GraphQL</strong>.</p>

<hr/>

<h2 id="8-rest-api" id="8-rest-api"><strong>8. Rest API</strong></h2>

<p>Among the different API styles, <strong>REST (Representational State Transfer)</strong> is the most widely used.</p>

<p>A <strong>REST API</strong> follows a set of rules that define how clients and servers communicate over HTTP in a structured way.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!HBtO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c704568-18c9-48e5-ba45-f8e6e1e25a6b_1554x896.png"><img src="https://substackcdn.com/image/fetch/$s_!HBtO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c704568-18c9-48e5-ba45-f8e6e1e25a6b_1554x896.png" alt=""/></a></p>

<p>Rest is:</p>
<ul><li><strong>Stateless:</strong> Every request is independent; the server doesn’t store client state.</li>
<li><strong>Resource-Based:</strong> Everything is treated as a resource (e.g., /users, /orders, /products).</li>
<li><strong>Uses Standard HTTP Methods:</strong> Clients interact with resources using <strong>HTTP methods</strong> like:
<ul><li><strong>GET</strong> → Retrieves data (e.g., fetching a user profile).</li>
<li><strong>POST</strong> → Creates new data (e.g., adding a new user).</li>
<li><strong>PUT/PATCH</strong> → Updates existing data (e.g., changing user settings).</li>
<li><strong>DELETE</strong> → Removes data (e.g., deleting an account).</li></ul></li></ul>

<p>REST APIs are great because they’re <strong>simple, scalable, and easy to cache</strong>, but they have <strong>limitations</strong>, especially when dealing with complex data retrieval.</p>

<p>REST endpoints often return <strong>more data than needed</strong>, leading to inefficient network usage. If an API doesn’t return related data, the client may need to <strong>make multiple requests</strong> to retrieve all required information.</p>

<p>To address these challenges, GraphQL was introduced in 2015 by Facebook.</p>

<hr/>

<h2 id="9-graphql" id="9-graphql"><strong>9. GraphQL</strong></h2>

<p>Unlike REST, which forces clients to retrieve <strong>fixed sets of data</strong>, <strong>GraphQL</strong> lets clients <strong>ask for exactly what they need—nothing more, nothing less</strong>.</p>

<p>With a REST API, if you need a user details, user profile details along with their recent posts, you might have to <strong>make multiple requests</strong> to different endpoints:</p>
<ol><li><p><code>GET /api/users/123</code> → fetch user details</p></li>

<li><p><code>GET /api/users/123/profile</code> → fetch user profile</p></li>

<li><p><code>GET /api/users/123/posts</code> → fetch user’s posts</p></li></ol>

<p>With GraphQL, you can <strong>combine those requests into one</strong> and fetch exactly the data you need in a single query:</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!s0a7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b40446b-9156-4e7f-9107-654235bb1e53_2138x1806.png"><img src="https://substackcdn.com/image/fetch/$s_!s0a7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b40446b-9156-4e7f-9107-654235bb1e53_2138x1806.png" alt=""/></a></p>

<p>The <strong>server responds with only the requested fields</strong>, reducing unnecessary data transfer and improving efficiency.</p>

<p>However, GraphQL also comes with trade-offs—it <strong>requires more processing on the server side</strong> and isn’t as easy to cache as REST.</p>

<p>Learn more about REST vs GraphQL here:</p>

<p><a href="https://blog.algomaster.io/p/rest-vs-graphql"><img src="https://substackcdn.com/image/fetch/$s_!cEwV!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4d86506-cb5f-4c9f-a56a-257439ec46eb_1666x1210.png" alt="REST vs GraphQL"/></a></p>

<h4 id="rest-vs-graphql-https-blog-algomaster-io-p-rest-vs-graphql" id="rest-vs-graphql-https-blog-algomaster-io-p-rest-vs-graphql"><strong><a href="https://blog.algomaster.io/p/rest-vs-graphql">REST vs GraphQL</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/rest-vs-graphql">Read full story</a></strong></p>

<p>When a client makes a request, they usually want to <strong>store or retrieve data</strong>.</p>

<p>But this brings up another question—<em><strong>where is the actual data stored?</strong></em></p>

<hr/>

<h2 id="10-databases" id="10-databases"><strong>10. Databases</strong></h2>

<p>If our application deals with <strong>small amounts of data</strong>, we could store it <strong>in memory</strong>.</p>

<p>But modern applications handle <strong>massive volumes of data</strong>—far more than what memory can efficiently handle.</p>

<p>That’s why we need a <strong>dedicated server for storing and managing data</strong>—a <strong>database</strong>.</p>

<p>A database is the backbone of any application. It ensures that data is stored, retrieved, and managed efficiently while keeping it secure, consistent, and durable.</p>

<p>When a client requests to <strong>store</strong> or <strong>retrieve</strong> data, the <strong>server communicates with the database</strong>, fetches the required information, and returns it to the client.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!Xis-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57b338e3-3cc2-4bcf-86e4-0aa42cc2c2de_1060x884.png"><img src="https://substackcdn.com/image/fetch/$s_!Xis-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57b338e3-3cc2-4bcf-86e4-0aa42cc2c2de_1060x884.png" alt=""/></a></p>

<p>But not all databases are the same. Different applications have different <strong>scalability, performance, and consistency</strong> requirements, which is choosing the right type of database is important.</p>

<p>If you want to learn about different types of databases, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/15-types-of-databases"><img src="https://substackcdn.com/image/fetch/$s_!sdB1!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F773d33c8-ab09-4d63-a6a4-ee55bd9ef0ff_1944x1148.png" alt="15 Types of Databases and When to Use Them"/></a></p>

<h4 id="15-types-of-databases-and-when-to-use-them-https-blog-algomaster-io-p-15-types-of-databases" id="15-types-of-databases-and-when-to-use-them-https-blog-algomaster-io-p-15-types-of-databases"><strong><a href="https://blog.algomaster.io/p/15-types-of-databases">15 Types of Databases and When to Use Them</a></strong></h4>

<p><strong>March 24, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/15-types-of-databases">Read full story</a></strong></p>

<p>In system design, we typically choose between <strong>SQL and NoSQL databases</strong>.</p>

<hr/>

<h2 id="11-sql-vs-nosql" id="11-sql-vs-nosql"><strong>11. SQL vs NoSQL</strong></h2>

<p><a href="https://substackcdn.com/image/fetch/$s_!3Es9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa81088b7-a188-4089-845a-63936e930a71_1632x1076.png"><img src="https://substackcdn.com/image/fetch/$s_!3Es9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa81088b7-a188-4089-845a-63936e930a71_1632x1076.png" alt=""/></a></p>

<p>SQL databases store data in tables with a <strong>strict predefined schema</strong> and follow the <strong>ACID properties</strong>.</p>
<ul><li><strong>Atomicity</strong> - A transaction is <strong>all-or-nothing</strong> (it either completes fully or not at all).</li>
<li><strong>Consistency</strong> – Data always remains <strong>valid</strong> and follows defined rules.</li>
<li><strong>Isolation</strong> – Transactions <strong>don’t interfere</strong> with each other.</li>
<li><strong>Durability</strong> – Once data is saved, it <strong>won’t be lost</strong>, even if the system crashes.</li></ul>

<p>Because of these guarantees, SQL databases are ideal for applications that require <strong>strong consistency and structured relationships</strong>, such as <strong>banking systems</strong>.</p>

<blockquote><p>Examples of popular SQL databases include: MySQL and PostgreSQL</p></blockquote>

<p>NoSQL databases on the other hand are designed for <strong>high scalability and performance</strong>.</p>

<p>They <strong>don’t require a fixed schema</strong> and use different data models, including:</p>
<ul><li><strong>Key-Value Stores</strong> – Fast lookups for simple key-value pairs (e.g., Redis).</li>
<li><strong>Document Stores</strong> – Store flexible, JSON-like documents (e.g., MongoDB).</li>
<li><strong>Graph Databases</strong> – Best for highly connected data (e.g., Neo4j).</li>
<li><strong>Wide-Column Stores</strong> – Optimized for large-scale, distributed data (e.g., Cassandra).</li></ul>

<p>So, <strong>which one should you use?</strong> It depends on the system requirements.</p>
<ul><li>If you need <strong>structured, relational data with strong consistency</strong> → <strong>SQL is a better choice.</strong></li>
<li>If you need <strong>high scalability, flexible schemas, or fast reads/writes at scale</strong> → <strong>NoSQL is a better choice.</strong></li></ul>

<p>Many modern applications <strong>use both SQL and NoSQL together.</strong></p>

<p>For example, an e-commerce platform might:</p>
<ul><li>Store customer orders in SQL (because they require strict consistency).</li>
<li>and store Product recommendations in NoSQL (because they need flexible and fast lookups).</li></ul>

<p>If you want to learn more about SQL vs NoSQL, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/sql-vs-nosql-7-key-differences"><img src="https://substackcdn.com/image/fetch/$s_!3Es9!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa81088b7-a188-4089-845a-63936e930a71_1632x1076.png" alt="SQL vs NoSQL - 7 Key Differences You Must Know"/></a></p>

<h4 id="sql-vs-nosql-7-key-differences-you-must-know-https-blog-algomaster-io-p-sql-vs-nosql-7-key-differences" id="sql-vs-nosql-7-key-differences-you-must-know-https-blog-algomaster-io-p-sql-vs-nosql-7-key-differences"><strong><a href="https://blog.algomaster.io/p/sql-vs-nosql-7-key-differences">SQL vs NoSQL – 7 Key Differences You Must Know</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/sql-vs-nosql-7-key-differences">Read full story</a></strong></p>

<hr/>

<h2 id="12-vertical-scaling" id="12-vertical-scaling"><strong>12. Vertical Scaling</strong></h2>

<p>As our <strong>user base grows</strong>, so does the number of <strong>requests hitting our application servers</strong>.</p>

<p>Initially, a <strong>single server</strong> might be enough to handle the load. But, as traffic increases, that single server can become a bottleneck, slowing everything down.</p>

<p>One of the quickest solutions is to <strong>upgrade the existing server</strong> by adding more CPU, RAM or storage.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!x4x6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F491fc8b1-02e4-490c-bb5f-87286df10730_1086x556.png"><img src="https://substackcdn.com/image/fetch/$s_!x4x6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F491fc8b1-02e4-490c-bb5f-87286df10730_1086x556.png" alt=""/></a></p>

<p>This approach is called <strong>Vertical Scaling (Scaling Up)</strong>—making a single machine more powerful.</p>

<p>But there are some major limitations with this approach:</p>
<ol><li><p><strong>Hardware limits →</strong> You can’t keep upgrading a server forever. Every machine has a maximum capacity.</p></li>

<li><p><strong>Cost →</strong> More powerful servers become exponentially more expensive.</p></li>

<li><p><strong>Single Point of Failure (SPOF)</strong> <strong>→</strong> if this one server crashes, the entire system <strong>goes down</strong>.</p></li></ol>

<p>So, while vertical scaling is a quick fix, it’s not a long-term solution for handling high traffic and ensuring system reliability.</p>

<p>Lets look at a better approach—one that makes our system more scalable and fault tolerant.</p>

<hr/>

<h2 id="13-horizontal-scaling" id="13-horizontal-scaling"><strong>13. Horizontal Scaling</strong></h2>

<p>Instead of upgrading a single server, what if we <strong>add more servers</strong> to share the load?</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!aryi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8bba98b-abf7-42de-b699-0de1bcde0454_1180x426.png"><img src="https://substackcdn.com/image/fetch/$s_!aryi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8bba98b-abf7-42de-b699-0de1bcde0454_1180x426.png" alt=""/></a></p>

<p>This approach is called <strong>Horizontal Scaling (Scaling Out)</strong>—where we <strong>distribute the workload across multiple machines</strong>.</p>

<p>This approach is better because:</p>
<ul><li><strong>More servers = More capacity →</strong> The system can handle increasing traffic more effectively.</li>
<li><strong>No Single Point of Failure →</strong> If one server goes down, others can <strong>take over</strong>, improving reliability.</li>
<li><strong>Cost-effective →</strong> Instead of investing in a single, super-expensive machine, we can use multiple affordable ones.</li></ul>

<p>But horizontal scaling introduces a new challenge: <em><strong>how do clients know which server to connect to?</strong></em></p>

<p>This is where a <strong>Load Balancer</strong> comes in.</p>

<hr/>

<h2 id="14-load-balancers" id="14-load-balancers"><strong>14. Load Balancers</strong></h2>

<p><a href="https://substackcdn.com/image/fetch/$s_!DnSE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faebd5461-34f3-47c5-bc8e-5248bb9a92c8_1304x1050.png"><img src="https://substackcdn.com/image/fetch/$s_!DnSE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faebd5461-34f3-47c5-bc8e-5248bb9a92c8_1304x1050.png" alt=""/></a></p>

<p>A <strong>Load Balancer</strong> sits between <strong>clients</strong> and <strong>backend servers</strong>, acting as a <strong>traffic manager</strong> that distributes requests across multiple servers.</p>

<p>If one server crashes, the Load Balancer automatically redirects traffic to another healthy server.</p>

<p><em><strong>But how does a Load Balancer decide which server should handle the next request?</strong></em></p>

<p>It uses <strong>Load Balancing algorithms</strong>, such as:</p>
<ol><li><p><strong>Round Robin</strong> <strong>→</strong> Requests are sent to servers sequentially, one after another in a loop.</p></li>

<li><p><strong>Least Connections</strong> <strong>→</strong> Requests are sent to the server with the fewest active connections.</p></li>

<li><p><strong>and IP Hashing</strong> <strong>→</strong> Requests from the same IP address always go to the <strong>same server</strong>, which helps with <strong>session consistency.</strong></p></li></ol>

<p>Learn more about load balancing algorithms here:</p>

<p><a href="https://blog.algomaster.io/p/load-balancing-algorithms-explained-with-code"><img src="https://substackcdn.com/image/fetch/$s_!jpjg!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54114fcc-cce5-4f0d-a678-47f8f0339fd4_1304x1076.png" alt="Load Balancing Algorithms Explained with Code"/></a></p>

<h4 id="load-balancing-algorithms-explained-with-code-https-blog-algomaster-io-p-load-balancing-algorithms-explained-with-code" id="load-balancing-algorithms-explained-with-code-https-blog-algomaster-io-p-load-balancing-algorithms-explained-with-code"><strong><a href="https://blog.algomaster.io/p/load-balancing-algorithms-explained-with-code">Load Balancing Algorithms Explained with Code</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/load-balancing-algorithms-explained-with-code">Read full story</a></strong></p>

<hr/>

<p>So far, we’ve talked about scaling our application servers, but as traffic grows, the volume of data also increases.</p>

<p>At first, we can scale a database <strong>vertically</strong> by adding more CPU, RAM, and storage, but there’s a limit to how much a single machine can handle.</p>

<p>So, let’s explore other <strong>database scaling techniques</strong> that help manage large volumes of data efficiently.</p>

<hr/>

<h2 id="15-database-indexing" id="15-database-indexing"><strong>15. Database Indexing</strong></h2>

<p>One of the quickest and most effective ways to speed up database <strong>read queries</strong> is <strong>indexing</strong>.</p>

<p>Think of it like the index page at the back of a book—instead of flipping through every page, you jump directly to the relevant section.</p>

<p>A <strong>database index</strong> works the same way. It’s is a super-efficient lookup table that helps the database quickly locate the required data without scanning the entire table.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!ABC0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6543930-e7ce-4dda-b4b2-82db93223aa7_1330x788.png"><img src="https://substackcdn.com/image/fetch/$s_!ABC0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6543930-e7ce-4dda-b4b2-82db93223aa7_1330x788.png" alt=""/></a></p>

<p>An index stores column values along with pointers to the actual data rows in the table.</p>

<p>Indexes are typically created on <strong>columns that are frequently queried</strong>, such as:</p>
<ul><li>Primary keys</li>
<li>Foreign keys</li>
<li>Columns used in WHERE conditions</li></ul>

<p>But be careful—while indexes <strong>speed up reads, they slow down writes</strong> (<code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code>) since the index needs to be updated whenever data changes.</p>

<p>That’s why we should <strong>only index the most frequently accessed columns</strong>.</p>

<p>Learn more about Database Indexes here:</p>

<p><a href="https://blog.algomaster.io/p/a-detailed-guide-on-database-indexes"><img src="https://substackcdn.com/image/fetch/$s_!ucFq!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9d51c18-fd89-4320-af15-a1dfd9d4487f_1120x738.png" alt="Database Indexes: A detailed guide"/></a></p>

<h4 id="database-indexes-a-detailed-guide-https-blog-algomaster-io-p-a-detailed-guide-on-database-indexes" id="database-indexes-a-detailed-guide-https-blog-algomaster-io-p-a-detailed-guide-on-database-indexes"><strong><a href="https://blog.algomaster.io/p/a-detailed-guide-on-database-indexes">Database Indexes: A detailed guide</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/a-detailed-guide-on-database-indexes">Read full story</a></strong></p>

<p>Indexing significantly improves <strong>read performance</strong>, but <em><strong>what if even indexing isn’t enough, and our database can’t handle the growing number of read requests?</strong></em></p>

<p>That’s where our next database scaling technique <strong>Replication</strong> comes in.</p>

<hr/>

<h2 id="16-replication" id="16-replication"><strong>16. Replication</strong></h2>

<p>Just like we added more application servers to handle traffic, we can scale our database by creating <strong>copies</strong> of it across multiple servers.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!zLIG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d8f5734-fd0b-4591-a1a5-082cea0212ce_970x730.png"><img src="https://substackcdn.com/image/fetch/$s_!zLIG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d8f5734-fd0b-4591-a1a5-082cea0212ce_970x730.png" alt=""/></a></p>

<p>Here’s how it works:</p>
<ul><li>We have <strong>one primary database</strong> (also called the <strong>Primary Replica</strong>) that handles all <strong>write operations</strong> (<code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code>).</li>
<li>We have <strong>multiple read replicas</strong> that handle <strong>read queries (SELECT)</strong>.</li>
<li>Whenever data is written to the primary database, it gets copied to the read replicas so that they stay in sync.</li></ul>

<p>Replication improves the read performance since read requests are spread across multiple replicas, reducing the load on each one.</p>

<p>This also improves availability since if the primary replica fails, a read replica can take over as the new primary.</p>

<p>Replication is great for scaling read heavy applications, <em><strong>but what if we need to scale writes or store huge amounts of data?</strong></em></p>

<hr/>

<h2 id="17-sharding" id="17-sharding"><strong>17. Sharding</strong></h2>

<p>Let’s say our service now has <strong>millions of users,</strong> and our database has grown to <strong>terabytes of data</strong>.</p>

<p>A <strong>single database server</strong> will eventually struggle to handle all this data efficiently.</p>

<p>Instead of keeping everything in one place, we <strong>split the database into smaller, more manageable pieces</strong> and distribute them across <strong>multiple servers</strong>.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!17Jc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e67c3b7-92cd-4f84-854e-e71f45f7efa2_1902x668.png"><img src="https://substackcdn.com/image/fetch/$s_!17Jc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e67c3b7-92cd-4f84-854e-e71f45f7efa2_1902x668.png" alt=""/></a></p>

<p>This technique is called <strong>Sharding</strong>.</p>
<ul><li>We divide the database into smaller parts called <strong>shards</strong>.</li>
<li>Each <strong>shard contains a subset</strong> of the total data.</li>
<li>Data is distributed based on a <strong>sharding key</strong> (e.g., <strong>user ID</strong>).</li></ul>

<p>By distributing data this way, we:</p>
<ul><li><strong>Reduce database load</strong> → Each shard handles <strong>only a portion</strong> of queries.</li>
<li><strong>Speed up read and write performance</strong> → Queries are distributed across multiple shards instead of hitting a single database.</li></ul>

<p>Sharding is also referred to as horizontal partitioning since it splits data by rows.</p>

<p>If you want to learn more about Sharding, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/what-is-database-sharding"><img src="https://substackcdn.com/image/fetch/$s_!Zxuc!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8c20c76-23d3-40a9-af20-5c9b8957fe63_1210x1068.png" alt="What is Database Sharding?"/></a></p>

<h4 id="what-is-database-sharding-https-blog-algomaster-io-p-what-is-database-sharding" id="what-is-database-sharding-https-blog-algomaster-io-p-what-is-database-sharding"><strong><a href="https://blog.algomaster.io/p/what-is-database-sharding">What is Database Sharding?</a></strong></h4>

<p><strong>May 12, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/what-is-database-sharding">Read full story</a></strong></p>

<p><em><strong>But what if the issue isn’t the number of rows, but rather the number of columns?</strong></em></p>

<p>In such cases, we use <strong>Vertical Partitioning</strong>, where we <strong>split the database by columns</strong>. Let’s explore that next.</p>

<hr/>

<h2 id="18-vertical-partitioning" id="18-vertical-partitioning"><strong>18. Vertical Partitioning</strong></h2>

<p>Imagine we have a <strong>User table</strong> that stores:</p>
<ul><li>profile details (name, email, profile picture)</li>
<li>login history (last_login, IP addresses)</li>
<li>and billing information (billing address, payment details)</li></ul>

<p>As this table <strong>grows</strong>, queries become <strong>slower</strong> because the database must scan <strong>many columns</strong> even when a request only needs a <strong>few specific fields.</strong></p>

<p>To optimize this, we use <strong>Vertical Partitioning where we split user table into smaller, more focused tables</strong> based on usage patterns.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!7S9u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75daa5e9-2a22-440f-bba3-f1336f613339_2282x1006.png"><img src="https://substackcdn.com/image/fetch/$s_!7S9u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75daa5e9-2a22-440f-bba3-f1336f613339_2282x1006.png" alt=""/></a></p>
<ul><li><strong>User_Profile</strong> → Stores name, email, profile picture.</li>
<li><strong>User_Login</strong> → Stores login timestamps.</li>
<li><strong>User_Billing</strong> → Stores billing address, payment details.</li></ul>

<p>This improves <strong>query performance</strong> since each request only scans <strong>relevant columns</strong> instead of the entire <strong>table</strong>.</p>

<p>It reduces <strong>unnecessary disk I/O</strong>, making data retrieval quicker.</p>

<p>However, no matter how much we optimize the database, <strong>retrieving data from disk is always slower than retrieving from memory</strong>.</p>

<p><em><strong>What if we could store frequently accessed data in memory for lightning-fast access?</strong></em></p>

<p>This is called <strong>caching</strong>.</p>

<hr/>

<h2 id="19-caching" id="19-caching"><strong>19. Caching</strong></h2>

<p><strong>Caching</strong> is used to optimize the performance of a system by <strong>storing frequently accessed data in memory</strong> instead of repeatedly fetching it from the database.</p>

<p>One of the most common caching strategies is the <strong>Cache Aside Pattern.</strong></p>

<p><a href="https://substackcdn.com/image/fetch/$s_!y--V!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc5992eb-9290-49c7-ad8d-594a7560ef41_2200x1102.png"><img src="https://substackcdn.com/image/fetch/$s_!y--V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc5992eb-9290-49c7-ad8d-594a7560ef41_2200x1102.png" alt=""/></a></p>

<p>Here’s how it works:</p>
<ol><li><p>When a user <strong>requests a data</strong>, the application first check the <strong>cache</strong>.</p></li>

<li><p>If the data is <strong>in the cache</strong>, it’s returned <strong>instantly, avoiding a database call</strong>.</p></li>

<li><p>If the data <strong>is not in the cache</strong>, the application <strong>retrieves it from the database</strong>, stores it in the cache for future requests, and returns it to the user.</p></li>

<li><p>Next time, the same data is requested, it’s served <strong>directly from cache</strong>, making the request much faster.</p></li></ol>

<p>To prevent outdated data from being served, we use <strong>Time-to-Live (TTL)</strong>—an expiration time set on cached data so it gets <strong>automatically refreshed</strong> after a certain period.</p>

<blockquote><p>Popular caching tools include <strong>Redis and Memcached.</strong></p></blockquote>

<p>If you want to learn more about caching strategies, check out this article:</p>

<p><a href="https://blog.algomaster.io/p/top-5-caching-strategies-explained"><img src="https://substackcdn.com/image/fetch/$s_!qQlQ!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b38086e-3798-4d29-8231-33c8e84ffbc6_665x468.png" alt="Top 5 Caching Strategies Explained"/></a></p>

<h4 id="top-5-caching-strategies-explained-https-blog-algomaster-io-p-top-5-caching-strategies-explained" id="top-5-caching-strategies-explained-https-blog-algomaster-io-p-top-5-caching-strategies-explained"><strong><a href="https://blog.algomaster.io/p/top-5-caching-strategies-explained">Top 5 Caching Strategies Explained</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/top-5-caching-strategies-explained">Read full story</a></strong></p>

<p>Lets look at the next database scaling technique.</p>

<hr/>

<h2 id="20-denormalization" id="20-denormalization"><strong>20. Denormalization</strong></h2>

<p>Most relational databases use <strong>Normalization</strong> to store data efficiently by breaking it into separate tables.</p>

<p>For example, in an e-commerce system:</p>
<ul><li>The <strong>Users table</strong> stores user details.</li>
<li>The <strong>Orders table</strong> stores their orders.</li>
<li>The <strong>Products table</strong> stores product details.</li></ul>

<p>While this <strong>reduces redundancy</strong>, it also <strong>introduces joins.</strong> When retrieving data from multiple tables, the database must <strong>combine them using JOIN operations</strong>, which can slow down queries as the dataset grows.</p>

<pre><code>SELECT o.order_id, u.name, u.email, o.product, o.amount
FROM orders o
JOIN users u ON o.user_id = u.user_id;
</code></pre>

<p><strong>Denormalization</strong> reduces the number of joins by combining related data into a single table, even if it means some data gets duplicated.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!RPfd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92757591-63fa-4a56-a7cc-e65b739b057a_1750x1398.png"><img src="https://substackcdn.com/image/fetch/$s_!RPfd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92757591-63fa-4a56-a7cc-e65b739b057a_1750x1398.png" alt=""/></a></p>

<p><strong>Example:</strong> Instead of keeping <code>Users</code> and <code>Orders</code> in separate tables, we create <code>UserOrders</code> table that stores user details along with their latest orders.</p>

<p>Now, when retrieving a user’s order history, we don’t need a <strong>JOIN operation</strong>—the data is already stored together leading to faster queries and better read performance.</p>

<pre><code>SELECT order_id, user_name AS name, user_email AS email, product, amount
FROM orders;
</code></pre>

<p>Denormalization is often used in read-heavy applications where speed is more critical but the downside is it leads to <strong>increases storage usage</strong> and more <strong>complex update requests</strong>.</p>

<hr/>

<h2 id="21-cap-theorem" id="21-cap-theorem"><strong>21.</strong> CAP Theorem</h2>

<p>As we scale our system across multiple <strong>servers, databases, and data centers</strong>, we enter the world of <strong>distributed systems</strong>.</p>

<p>One of the fundamental principles of distributed systems is the <strong>CAP Theorem</strong>, which states that: No distributed system can achieve all three of the following at the same time:</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!-Rqf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd38a5f6-aca6-44e9-aa69-321ed4b04e03_1138x904.png"><img src="https://substackcdn.com/image/fetch/$s_!-Rqf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd38a5f6-aca6-44e9-aa69-321ed4b04e03_1138x904.png" alt=""/></a></p>
<ul><li><strong>Consistency ©</strong> <strong>→</strong> Every node always returns the <strong>most recent data</strong>.</li>
<li><strong>Availability (A)</strong> <strong>→</strong> The system <strong>always responds</strong> to requests, even if some nodes are down (but the data may not be the latest).</li>
<li><strong>Partition Tolerance (P)</strong> <strong>→</strong> The system continues operating even if there’s a <strong>network failure</strong> between nodes.</li></ul>

<p>Since <strong>network failures (P) are inevitable</strong>, we must choose between:</p>
<ul><li><strong>Consistency + Partition Tolerance (CP)</strong> → Ensures every request gets the latest data but may reject requests during failures. Example: <strong>SQL databases like MySQL</strong>.</li>
<li><strong>Availability + Partition Tolerance (AP)</strong> → Ensures the system always responds, even if some data is stale. Example: <strong>NoSQL databases like Cassandra and DynamoDB</strong>.</li></ul>

<p>To learn more about CAP theorem, check out this article:</p>

<p><a href="https://blog.algomaster.io/p/cap-theorem-explained"><img src="https://substackcdn.com/image/fetch/$s_!92J7!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78cd131d-3a18-4c4d-88e1-18834b191ef2_1138x904.png" alt="CAP Theorem Explained"/></a></p>

<h4 id="cap-theorem-explained-https-blog-algomaster-io-p-cap-theorem-explained" id="cap-theorem-explained-https-blog-algomaster-io-p-cap-theorem-explained"><strong><a href="https://blog.algomaster.io/p/cap-theorem-explained">CAP Theorem Explained</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>July 31, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/cap-theorem-explained">Read full story</a></strong></p>

<p>In distributed NoSQL databases, achieving <strong>instant consistency</strong> across all servers <strong>is too slow</strong>.</p>

<p>Instead, we use <strong>Eventual Consistency</strong>—which means:</p>
<ul><li><strong>Not all nodes are updated instantly</strong>, but given enough time, they <strong>eventually</strong> sync and return the same data.</li>
<li>This allows the system to remain <strong>highly available and fast</strong>, even under extreme loads.</li></ul>

<p><strong>How Eventual Consistency Works:</strong></p>
<ol><li><p>A user updates data in <strong>one replica</strong> of the database.</p></li>

<li><p>The system <strong>immediately</strong> acknowledges the update, ensuring <strong>high availability</strong>.</p></li>

<li><p>The update is then <strong>propagated asynchronously to other replicas</strong>.</p></li>

<li><p>After a short delay, all replicas have the latest data, ensuring <strong>consistency over time</strong>.</p></li></ol>

<hr/>

<h2 id="22-blob-storage" id="22-blob-storage"><strong>22. Blob Storage</strong></h2>

<p>Most modern applications don’t just store text records, they also need to handle <strong>images</strong>, <strong>videos</strong>, <strong>pdfs</strong> and other <strong>large files</strong>.</p>

<p>But here’s the problem: <strong>Traditional databases are not designed to store large, unstructured files efficiently</strong>.</p>

<p><em><strong>So, what’s the solution?</strong></em></p>

<p>We use <strong>Blob Storage like Amazon S3</strong>—a <strong>highly scalable and cost-effective</strong> way to store <strong>large, unstructured files</strong> in the cloud.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!YYzQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc338f10-3918-49f5-a828-fced5e905acb_298x306.png"><img src="https://substackcdn.com/image/fetch/$s_!YYzQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc338f10-3918-49f5-a828-fced5e905acb_298x306.png" alt=""/></a></p>

<p>Blobs are the individual files like images, videos or documents.</p>

<p>These blobs are stored inside <strong>logical containers or buckets</strong> in the cloud.</p>

<p>Each file gets a <strong>unique URL</strong>, making it easy to retrieve and serve over the web.</p>

<blockquote><p><strong>Example:</strong> <a href="https://my-bucket-name.s3.amazonaws.com/videos/tutorial.mp4">https://my-bucket-name.s3.amazonaws.com/videos/tutorial.mp4</a></p></blockquote>

<p>There are several advantages with using blob storage like:</p>
<ul><li><strong>Scalability</strong> → It can store petabytes of data effortlessly.</li>
<li><strong>Pay-as-you-go pricing</strong> → You only pay for storage and retrieval that you actually use.</li>
<li><strong>Automatic replication</strong> → Data is copied across multiple data centers and availability zones for durability.</li>
<li><strong>Easy access</strong> → Files can be retrieved using REST APIs or direct URLs.</li></ul>

<p>A common use case is to stream audio or video files to user application in real-time.</p>

<p>But streaming directly from blob-storage can be slow, especially if the data is stored in a <strong>distant location</strong>.</p>

<hr/>

<h2 id="23-cdn" id="23-cdn"><strong>23. CDN</strong></h2>

<p>For example, imagine you’re in <strong>India</strong> trying to watch a YouTube video that’s hosted on a server in <strong>California</strong>.</p>

<p>Since the video data has to <strong>travel across the world</strong>, this could lead to <strong>buffering and slow load times</strong>.</p>

<p>A <strong>Content Delivery Network (or CDN)</strong> solves this problem by <strong>delivering content faster</strong> to users based on their location.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!sN05!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa09696e9-f98e-47bd-9eb9-08a20c60464d_5667x2834.png"><img src="https://substackcdn.com/image/fetch/$s_!sN05!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa09696e9-f98e-47bd-9eb9-08a20c60464d_5667x2834.png" alt="Map of globally distributed servers serving content - What is a CDN" title="Map of globally distributed servers serving content - What is a CDN"/></a></p>

<p>source: <a href="https://www.cloudflare.com/learning/cdn/what-is-a-cdn/">https://www.cloudflare.com/learning/cdn/what-is-a-cdn/</a></p>

<p>A CDN is a global network of distributed servers that work together to deliver <strong>web content</strong> (like HTML pages, JavaScript files, stylesheets, images, and videos) to users based on their <strong>geographic location</strong>.</p>

<p>Instead of serving content from a <strong>single data center</strong>, a CDN <strong>caches static contents</strong> on multiple <strong>edge servers located worldwide</strong>.</p>

<p>When a user requests content, the <strong>nearest CDN server</strong> delivers it instead of reaching all the way to the <strong>origin server</strong>.</p>

<p>Since content is served from the <strong>closest CDN node</strong>, users experience <strong>faster load times</strong> with minimal buffering.</p>

<p>To learn more about CDN, check out this article:</p>

<p><a href="https://blog.algomaster.io/p/content-delivery-networks"><img src="https://substackcdn.com/image/fetch/$s_!fUV6!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1ef9c83-5fd9-46e3-8469-c2a43f8b7dd2_1670x1046.png" alt="What is a Content Delivery Network?"/></a></p>

<h4 id="what-is-a-content-delivery-network-https-blog-algomaster-io-p-content-delivery-networks" id="what-is-a-content-delivery-network-https-blog-algomaster-io-p-content-delivery-networks"><strong><a href="https://blog.algomaster.io/p/content-delivery-networks">What is a Content Delivery Network?</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/content-delivery-networks">Read full story</a></strong></p>

<hr/>

<h2 id="24-websockets" id="24-websockets"><strong>24. WebSockets</strong></h2>

<p>Most web applications use <strong>HTTP</strong>, which follows a <strong>request-response</strong> model.</p>
<ol><li><p>The client sends a request.</p></li>

<li><p>The <strong>server</strong> processes the request and sends a response.</p></li>

<li><p>If the client needs new data, it must <strong>send another request</strong>.</p></li></ol>

<p>This works fine for <strong>static web pages</strong> but it’s <strong>too slow and inefficient for real-time applications</strong> like: live chat apps, stock market dashboards and online multiplayer games.</p>

<p>With HTTP, the only way to get real-time updates is through <strong>polling</strong>—sending repeated requests every few seconds.</p>

<p>But polling is inefficient because it increases server load and wastes bandwidth, as <strong>most responses are empty</strong> (when there’s no new data).</p>

<p>WebSockets solve this problem by allowing <strong>continuous, two-way communication</strong> between the <strong>client and server</strong> over a <strong>single persistent connection</strong>.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!5FHd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57a93491-9dae-4a6d-a661-81ff1437c256_1071x969.png"><img src="https://substackcdn.com/image/fetch/$s_!5FHd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57a93491-9dae-4a6d-a661-81ff1437c256_1071x969.png" alt=""/></a></p>

<p>Here is how WebSockets work:</p>
<ol><li><p>The <strong>client initiates a WebSocket connection</strong> with the server.</p></li>

<li><p>Once established, the connection <strong>remains open</strong>.</p></li>

<li><p><strong>The server can push updates</strong> to the client <strong>at any time</strong>, without waiting for a request.</p></li>

<li><p>The client can also send messages <strong>instantly to the server.</strong></p></li></ol>

<p>This enables real-time interactions and eliminates the need for polling.</p>

<p>To learn more about WebSockets, check out this article:</p>

<p><a href="https://blog.algomaster.io/p/websockets"><img src="https://substackcdn.com/image/fetch/$s_!yu18!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bde57be-682f-4254-944b-bcade624e544_1008x908.png" alt="What are WebSockets and Why are they Used?"/></a></p>

<h4 id="what-are-websockets-and-why-are-they-used-https-blog-algomaster-io-p-websockets" id="what-are-websockets-and-why-are-they-used-https-blog-algomaster-io-p-websockets"><strong><a href="https://blog.algomaster.io/p/websockets">What are WebSockets and Why are they Used?</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/websockets">Read full story</a></strong></p>

<p>WebSockets enable real-time communication between a client and a server, <em><strong>but what if a server needs to notify another server when an event occurs?</strong></em></p>

<p>Example:</p>
<ul><li>When a user makes a payment, Stripe needs to notify your application <strong>instantly</strong>.</li>
<li>If someone pushes code to GitHub, a CI/CD system (e.g., Jenkins) should be triggered automatically.</li></ul>

<p>Enter Webhooks.</p>

<hr/>

<h2 id="25-webhooks" id="25-webhooks"><strong>25. Webhooks</strong></h2>

<p>Instead of constantly <strong>polling an API</strong> to check if an event has occured, <strong>Webhooks</strong> allow a server to <strong>send an HTTP request</strong> to another server as soon as the event occurs.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!Bipe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa833712f-f11d-4d48-b0b4-47e5616c8351_1890x766.png"><img src="https://substackcdn.com/image/fetch/$s_!Bipe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa833712f-f11d-4d48-b0b4-47e5616c8351_1890x766.png" alt=""/></a></p>

<p>Here’s how it works:</p>
<ul><li>The <strong>receiver (your app)</strong> registers a webhook URL with the <strong>provider (e.g., Stripe, GitHub, Twilio)</strong>.</li>
<li>When an event occurs (e.g., user makes a payment), the <strong>provider sends an HTTP POST request to the webhook URL</strong> with event details.</li>
<li>Your app <strong>processes the incoming request</strong> and updates data accordingly.</li></ul>

<p>This saves server resources and reduces unnecessary API calls.</p>

<hr/>

<h2 id="26-microservices" id="26-microservices"><strong>26. Microservices</strong></h2>

<p>Traditionally, applications were built using a <strong>monolithic architecture</strong>, where:</p>
<ul><li>All features (e.g., authentication, payments, orders, shipping) are inside <strong>one large codebase</strong>.</li>
<li>If one part of the system <strong>fails or needs scaling</strong>, the <strong>entire system</strong> is affected.</li>
<li><strong>Deployment is risky</strong>—one bad update can take down the entire app.</li></ul>

<p><strong>Example:</strong> Imagine an e-commerce app where the <strong>order</strong>, <strong>payment, inventory</strong>, and <strong>shipping</strong> modules are all tightly connected in a <strong>single codebase</strong>.</p>

<p>If the inventory system crashes, the entire app could go down.</p>

<p>Monoliths work <strong>fine for small applications</strong>, but for <strong>large-scale systems</strong>, they become <strong>hard to manage, scale, and deploy</strong>.</p>

<p>The solution is to break down your application into smaller, independent services called <strong>micro-services</strong> that work together.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!N6tU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b2ef6df-0f55-4663-ad2a-7f8a11121753_2136x826.png"><img src="https://substackcdn.com/image/fetch/$s_!N6tU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b2ef6df-0f55-4663-ad2a-7f8a11121753_2136x826.png" alt=""/></a></p>

<p>Each <strong>microservice</strong>:</p>
<ol><li><p>Handles <strong>a single responsibility</strong></p></li>

<li><p>Has its <strong>own database and logic</strong>, so it can scale <strong>independently</strong>.</p></li>

<li><p>Communicates with other microservices using <strong>APIs or message queues</strong>.</p></li></ol>

<p>This way services can be scaled and deployed individually without affecting the entire system.</p>

<p>However, when multiple microservices need to communicate, direct <strong>API calls</strong> aren’t always efficient—this is where <strong>Message Queues</strong> come in.</p>

<hr/>

<h2 id="27-message-queues" id="27-message-queues"><strong>27. Message Queues</strong></h2>

<p>In a <strong>monolithic system</strong>, functions call each other <strong>directly</strong> and wait for a response.</p>

<p>But in a <strong>microservices-based system</strong>, this approach is inefficient because:</p>
<ul><li>If one service is <strong>slow</strong> or <strong>down</strong>, everything waits.</li>
<li>High traffic can <strong>overload</strong> a single service.</li>
<li><strong>Synchronous communication</strong> (waiting for immediate responses) doesn’t scale well.</li></ul>

<p>A <strong>Message Queue</strong> enables services to <strong>communicate asynchronously</strong>, allowing requests to be processed <strong>without blocking</strong> other operations.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!uKwi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d148e2f-f1a4-4b94-8027-fa19ea6b5c61_1590x728.png"><img src="https://substackcdn.com/image/fetch/$s_!uKwi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d148e2f-f1a4-4b94-8027-fa19ea6b5c61_1590x728.png" alt=""/></a></p>

<p><strong>Here’s How It Works:</strong></p>
<ol><li><p>A <strong>producer</strong> (e.g., checkout service) <strong>places a message in the queue</strong> (e.g., “Process Payment”).</p></li>

<li><p>The <strong>queue temporarily holds the message</strong> until a <strong>consumer</strong> (e.g., payment service) is ready to process it.</p></li>

<li><p>The <strong>consumer retrieves the message</strong> and processes it.</p></li></ol>

<p>Using message queues, we can decouple services and improve the scalability and fault tolerance.</p>

<blockquote><p>Common message queue systems include: Apache Kafka, Amazon SQS and RabbitMQ.</p></blockquote>

<p>To learn more about Message Queues, check out this article:</p>

<p><a href="https://blog.algomaster.io/p/message-queues"><img src="https://substackcdn.com/image/fetch/$s_!hW_t!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a5f36fe-a10e-4b34-924c-5f32fd65adda_1194x764.png" alt="What are Message Queues and When to Use Them?"/></a></p>

<h4 id="what-are-message-queues-and-when-to-use-them-https-blog-algomaster-io-p-message-queues" id="what-are-message-queues-and-when-to-use-them-https-blog-algomaster-io-p-message-queues"><strong><a href="https://blog.algomaster.io/p/message-queues">What are Message Queues and When to Use Them?</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/message-queues">Read full story</a></strong></p>

<p>Using message queues, we can prevent overload on internal services within our system.</p>

<p><em><strong>But, how do we prevent overload for the public APIs and services we deploy.</strong></em></p>

<p>We use <strong>rate limiting</strong>.</p>

<hr/>

<h2 id="28-rate-limiting" id="28-rate-limiting"><strong>28. Rate Limiting</strong></h2>

<p>Imagine a <strong>bot starts making thousands of requests per second</strong> to your website.</p>

<p>Without restrictions, this could:</p>
<ul><li><strong>Crash your servers</strong> by consuming all available resources.</li>
<li><strong>Increase cloud costs</strong> due to excessive API usage.</li>
<li>and <strong>degrade performance</strong> for legitimate users.</li></ul>

<p>Rate Limiting <strong>restricts the number of requests</strong> a client can send within a specific time frame.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!H4QU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6c2b184-bb2e-421a-bf4d-03bd8bb80840_1704x436.png"><img src="https://substackcdn.com/image/fetch/$s_!H4QU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6c2b184-bb2e-421a-bf4d-03bd8bb80840_1704x436.png" alt=""/></a></p>

<p><strong>Here’s How It Works:</strong></p>
<ol><li><p>Every user or IP address is assigned a <strong>request quota</strong> (e.g., <strong>100 requests per minute</strong>).</p></li>

<li><p>If they <strong>exceed this limit</strong>, the server <strong>blocks additional requests temporarily</strong> and <strong>returns an error (HTTP 429 – Too Many Requests)</strong>.</p></li></ol>

<p>There are various rate limiting algorithms. Some of the popular ones are:</p>
<ul><li><strong>Fixed Window</strong> → Limits requests based on a fixed time window (e.g., 100 requests per minute).</li>
<li><strong>Sliding Window</strong> → More flexible version that dynamically adjusts limits to smooth out request bursts.</li>
<li><strong>Token Bucket</strong> → Users get <strong>tokens</strong> for requests, which <strong>replenish over time</strong> at a fixed rate.</li></ul>

<p>To learn more about rate limiting algorithms, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/rate-limiting-algorithms-explained-with-code"><img src="https://substackcdn.com/image/fetch/$s_!vVHH!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0815d30e-dc9c-4ff4-9eb8-ac76d21ba52d_1048x684.png" alt="Rate Limiting Algorithms Explained with Code"/></a></p>

<h4 id="rate-limiting-algorithms-explained-with-code-https-blog-algomaster-io-p-rate-limiting-algorithms-explained-with-code" id="rate-limiting-algorithms-explained-with-code-https-blog-algomaster-io-p-rate-limiting-algorithms-explained-with-code"><strong><a href="https://blog.algomaster.io/p/rate-limiting-algorithms-explained-with-code">Rate Limiting Algorithms Explained with Code</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/rate-limiting-algorithms-explained-with-code">Read full story</a></strong></p>

<p>We don’t need to implement our own rate limiting system – this can be handled by something called an <strong>API gateway</strong>.</p>

<hr/>

<h2 id="29-api-gateways" id="29-api-gateways"><strong>29. API Gateways</strong></h2>

<p>An API Gateway is a <strong>centralized service</strong> that handles <strong>authentication, rate limiting, logging and monitoring, and request routing</strong>.</p>

<p>Imagine a <strong>microservices-based application</strong> with multiple services.</p>

<p>Instead of exposing each service <strong>directly</strong>, an <strong>API Gateway</strong> acts as a <strong>single entry point</strong> for all client requests.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!_AFR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2f627d6-6141-413f-a528-4726d8869a0b_2218x1166.png"><img src="https://substackcdn.com/image/fetch/$s_!_AFR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2f627d6-6141-413f-a528-4726d8869a0b_2218x1166.png" alt=""/></a></p>

<p><strong>How API Gateways Work:</strong></p>
<ol><li><p>The <strong>client sends a request</strong> to the API Gateway.</p></li>

<li><p>The Gateway <strong>validates the request</strong> (e.g., authentication, rate limits).</p></li>

<li><p>It <strong>routes the request</strong> to the appropriate micro-service.</p></li>

<li><p>The response is sent back <strong>through the Gateway</strong> to the client.</p></li></ol>

<p>API gateway simplifies API management and improves scalability and security.</p>

<blockquote><p>Popular API Gateway solutions include <strong>NGINX, Kong and AWS API Gateway.</strong></p></blockquote>

<p>If you want to learn more about API gateways, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/what-is-an-api-gateway"><img src="https://substackcdn.com/image/fetch/$s_!_ZNj!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb0c8192-4b1b-4834-b068-20d8cfb65050_1856x1412.png" alt="What is an API Gateway?"/></a></p>

<h4 id="what-is-an-api-gateway-https-blog-algomaster-io-p-what-is-an-api-gateway" id="what-is-an-api-gateway-https-blog-algomaster-io-p-what-is-an-api-gateway"><strong><a href="https://blog.algomaster.io/p/what-is-an-api-gateway">What is an API Gateway?</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/what-is-an-api-gateway">Read full story</a></strong></p>

<hr/>

<h2 id="30-idempotency" id="30-idempotency"><strong>30. Idempotency</strong></h2>

<p>In distributed systems, <strong>network failures</strong> and <strong>service retries</strong> are common. If a user <strong>accidentally refreshes a payment page</strong>, the system might receive <strong>two payment requests</strong> instead of one.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!czYH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F637607fe-3d2c-49db-be80-3d247bea6ab8_1212x394.png"><img src="https://substackcdn.com/image/fetch/$s_!czYH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F637607fe-3d2c-49db-be80-3d247bea6ab8_1212x394.png" alt=""/></a></p>

<p>Idempotency ensures that <strong>repeated requests</strong> produce the <strong>same result</strong> as if the request was made <strong>only once</strong>.</p>

<p><strong>Here’s how it works:</strong></p>
<ol><li><p>Each request is assigned a <strong>unique ID</strong> (e.g., <code>request_1234</code>).</p></li>

<li><p>Before processing, the system checks if the request <strong>has already been handled</strong>.</p></li>

<li><p>If yes → It <strong>ignores the duplicate request</strong>.</p></li>

<li><p>If no → It <strong>processes the request normally</strong>.</p></li></ol>

<p>Idempotency prevents duplicate transactions and ensures data consistency in distributed systems.</p>

<p>If you want to learn more about idempotency, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/idempotency-in-distributed-systems"><img src="https://substackcdn.com/image/fetch/$s_!yjks!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538d3bda-046f-48f0-b62d-730327bf3bd7_954x696.png" alt="What is Idempotency in Distributed Systems?"/></a></p>

<h4 id="what-is-idempotency-in-distributed-systems-https-blog-algomaster-io-p-idempotency-in-distributed-systems" id="what-is-idempotency-in-distributed-systems-https-blog-algomaster-io-p-idempotency-in-distributed-systems"><strong><a href="https://blog.algomaster.io/p/idempotency-in-distributed-systems">What is Idempotency in Distributed Systems?</a></strong></h4>

<p><strong><a href="https://blog.algomaster.io/p/idempotency-in-distributed-systems">Read full story</a></strong></p>

<hr/>

<p>Thank you so much for reading!</p>

<p>This post is public so feel free to share it.</p>
]]></content:encoded>
      <guid>https://christova.writeas.com/30-system-design-concepts-easier-to-learn-than-you-think</guid>
      <pubDate>Wed, 29 Apr 2026 07:08:12 +0000</pubDate>
    </item>
    <item>
      <title>System Design Concepts</title>
      <link>https://christova.writeas.com/system-design-concepts?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[&#xA;#SystemDesign #systemdesignconcepts #must-know&#xA;&#xA;https://blog.algomaster.io/p/30-system-design-concepts &#xA;&#xA;1. Client-Server Architecture&#xA;&#xA;Almost every web application that you use is built on this simple yet powerful concept called client-server architecture.&#xA;&#xA;On one side, you have a client—this could be a web browser, a mobile app, or any other frontend application.&#xA;&#xA;and on the other side, you have a server—a machine that runs continuously, waiting to handle incoming requests.&#xA;&#xA;The client sends a request to store, retrieve, or modify data.&#xA;&#xA;The server receives the request, processes it, performs the necessary operations, and sends back a response.&#xA;&#xA;This sounds simple, but there’s a big question: How does the client even know where to find the server?&#xA;&#xA;---&#xA;&#xA;2. IP Address&#xA;&#xA;A client doesn’t magically know where a server is, it needs an address to locate and communicate with it.&#xA;&#xA;On the internet, computers identify each other using IP addresses, which work like phone numbers for servers.&#xA;&#xA;Every publicly deployed server has a unique IP address. When a client wants to interact with a service, it must send requests to the correct IP address.&#xA;&#xA;But there’s a problem:&#xA;&#xA;When we visit a website, we don’t type its IP address—we just enter the website name.&#xA;We can’t expect users (or even systems) to memorize a string of random numbers for every service they connect to.&#xA;And if we migrate our service to another server, its IP address may change—breaking all direct connections.&#xA;&#xA;---&#xA;&#xA;3. DNS&#xA;&#xA;Instead of relying on hard-to-remember IP addresses, we use something much more human-friendly: domain names.&#xA;&#xA;But, we need a way to map a domain name to it’s corresponding IP address.&#xA;&#xA;This is where DNS (or Domain Name System) comes in. It maps easy to remember domain names (like algomaster.io) to their corresponding IP addresses.&#xA;&#xA;Here’s what happens behind the scenes:&#xA;&#xA;When you type algomaster.io into your browser, your computer asks a DNS server for the corresponding IP address.&#xA;&#xA;Once the DNS server responds with the IP, your browser uses it to establish a connection with the server and make a request.&#xA;&#xA;You can find the IP address of any domain using the ping command. Just open your terminal and type ping followed by the domain name. And it’ll return the IP address currently assigned to that domain.&#xA;&#xA;Share&#xA;&#xA;---&#xA;&#xA;4. Proxy / Reverse Proxy&#xA;&#xA;When you visit a website, your request doesn’t always go directly to the server—sometimes, it passes through a proxy or reverse proxy first.&#xA;&#xA;A proxy server acts as a middleman between your device and the internet.&#xA;&#xA;When you request a webpage, the proxy forwards your request to the target server, retrieves the response, and sends it back to you.&#xA;&#xA;Proxy hides your IP address, keeping your location and identity private.&#xA;&#xA;A reverse proxy works the other way around. It intercepts client requests and forwards them to backend servers based on predefined rules.&#xA;&#xA;Allowing direct access to servers can pose security risks, exposing them to threats like hackers and DDoS attacks.&#xA;&#xA;A reverse proxy mitigates these risks by acting as a controlled entry point that regulates incoming traffic and hides server IPs.&#xA;&#xA;It can also act as a load balancer, distributing traffic across multiple servers.&#xA;&#xA;If you want to learn about Proxy vs Reverse Proxy in more detail, checkout this article:&#xA;&#xA;Proxy vs Reverse Proxy (Explained with Examples)&#xA;&#xA;Proxy vs Reverse Proxy (Explained with Examples)&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;October 30, 2024&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;5. Latency&#xA;&#xA;Whenever a client communicates with a server, there’s always some delay. One of the biggest causes of this delay is physical distance.&#xA;&#xA;For example, if our server is in New York, but a user in India sends a request, the data has to travel halfway across the world—and then the response has to make the same long trip back.&#xA;&#xA;This round-trip delay is called latency—the total time it takes for data to travel between the client and the server. High latency can make applications feel slow and unresponsive.&#xA;&#xA;One way to reduce latency is by deploying our service across multiple data centers worldwide.&#xA;&#xA;This way, users can connect to the nearest server instead of waiting for data to travel across the globe.&#xA;&#xA;Once a connection is made, how do clients and servers actually communicate?&#xA;&#xA;---&#xA;&#xA;6. HTTP/HTTPS&#xA;&#xA;Every time you visit a website, your browser and the server communicate using a set of rules called HTTP (Hypertext Transfer Protocol).&#xA;&#xA;That’s why most URLs start with http:// or its secure version, https://.&#xA;&#xA;Here’s how it works:&#xA;&#xA;The client sends a request to the server. This request includes a header (containing details like the request type, browser type, and cookies) and sometimes a request body (which carries additional data, like form inputs).&#xA;The server processes the request and responds with an HTTP response—either returning the requested data or an error message if something goes wrong.&#xA;&#xA;HTTP has a major security flaw, it sends data in plain text. This is a serious problem, especially for sensitive information like passwords, credit card details, and personal data.&#xA;&#xA;That’s why modern websites use HTTPS (Hypertext Transfer Protocol Secure) instead. HTTPS encrypts all data using SSL/TLS, ensuring that even if someone intercepts the request, they can’t read or alter it.&#xA;&#xA;But clients and servers don’t directly exchange raw HTTP requests and response.&#xA;&#xA;HTTP is just a protocol for transferring data but it doesn’t define:&#xA;&#xA;How requests should be structured&#xA;What format responses should be in&#xA;or how different clients should interact with the server.&#xA;&#xA;This is where APIs (or Application Programming Interfaces) come in.&#xA;&#xA;---&#xA;&#xA;7. APIs&#xA;&#xA;Think of an API as a middleman that allows clients (like web and mobile apps) to communicate with servers without worrying about low-level details.&#xA;&#xA;Almost every digital service you use—social media, e-commerce, online banking, ride-hailing apps—is built on APIs working together behind the scenes.&#xA;&#xA;Here’s how it typically works:&#xA;&#xA;A client sends a request to an API.&#xA;&#xA;The API, hosted on a server, processes the request, interacts with databases or other services, and prepares a response.&#xA;&#xA;The API sends back the response in a structured format, usually JSON or XML, which the client understands and can display.&#xA;&#xA;APIs provide a layer of abstraction—the client doesn’t need to know how the server processes the request, only that it returns the expected data.&#xA;&#xA;If you want to learn more about APIs, checkout this article:&#xA;&#xA;What&#39;s an API?&#xA;&#xA;What&#39;s an API?&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;January 21, 2025&#xA;&#xA;Read full story&#xA;&#xA;But, not all APIs are built the same. Different API styles exist to serve different needs. Two of the most popular ones are REST and GraphQL.&#xA;&#xA;---&#xA;&#xA;8. Rest API&#xA;&#xA;Among the different API styles, REST (Representational State Transfer) is the most widely used.&#xA;&#xA;A REST API follows a set of rules that define how clients and servers communicate over HTTP in a structured way.&#xA;&#xA;Rest is:&#xA;&#xA;Stateless: Every request is independent; the server doesn’t store client state.&#xA;Resource-Based: Everything is treated as a resource (e.g., /users, /orders, /products).&#xA;Uses Standard HTTP Methods: Clients interact with resources using HTTP methods like:&#xA;  GET → Retrieves data (e.g., fetching a user profile).&#xA;  POST → Creates new data (e.g., adding a new user).&#xA;  PUT/PATCH → Updates existing data (e.g., changing user settings).&#xA;  DELETE → Removes data (e.g., deleting an account).&#xA;&#xA;REST APIs are great because they’re simple, scalable, and easy to cache, but they have limitations, especially when dealing with complex data retrieval.&#xA;&#xA;REST endpoints often return more data than needed, leading to inefficient network usage. If an API doesn’t return related data, the client may need to make multiple requests to retrieve all required information.&#xA;&#xA;To address these challenges, GraphQL was introduced in 2015 by Facebook.&#xA;&#xA;---&#xA;&#xA;9. GraphQL&#xA;&#xA;Unlike REST, which forces clients to retrieve fixed sets of data, GraphQL lets clients ask for exactly what they need—nothing more, nothing less.&#xA;&#xA;With a REST API, if you need a user details, user profile details along with their recent posts, you might have to make multiple requests to different endpoints:&#xA;&#xA;GET /api/users/123 → fetch user details&#xA;&#xA;GET /api/users/123/profile → fetch user profile&#xA;&#xA;GET /api/users/123/posts → fetch user’s posts&#xA;&#xA;With GraphQL, you can combine those requests into one and fetch exactly the data you need in a single query:&#xA;&#xA;The server responds with only the requested fields, reducing unnecessary data transfer and improving efficiency.&#xA;&#xA;However, GraphQL also comes with trade-offs—it requires more processing on the server side and isn’t as easy to cache as REST.&#xA;&#xA;Learn more about REST vs GraphQL here:&#xA;&#xA;REST vs GraphQL&#xA;&#xA;REST vs GraphQL&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;March 11, 2025&#xA;&#xA;Read full story&#xA;&#xA;When a client makes a request, they usually want to store or retrieve data.&#xA;&#xA;But this brings up another question—where is the actual data stored?&#xA;&#xA;---&#xA;&#xA;10. Databases&#xA;&#xA;If our application deals with small amounts of data, we could store it in memory.&#xA;&#xA;But modern applications handle massive volumes of data—far more than what memory can efficiently handle.&#xA;&#xA;That’s why we need a dedicated server for storing and managing data—a database.&#xA;&#xA;A database is the backbone of any application. It ensures that data is stored, retrieved, and managed efficiently while keeping it secure, consistent, and durable.&#xA;&#xA;When a client requests to store or retrieve data, the server communicates with the database, fetches the required information, and returns it to the client.&#xA;&#xA;But not all databases are the same. Different applications have different scalability, performance, and consistency requirements, which is choosing the right type of database is important.&#xA;&#xA;If you want to learn about different types of databases, checkout this article:&#xA;&#xA;15 Types of Databases and When to Use Them&#xA;&#xA;15 Types of Databases and When to Use Them&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;March 24, 2024&#xA;&#xA;Read full story&#xA;&#xA;In system design, we typically choose between SQL and NoSQL databases.&#xA;&#xA;---&#xA;&#xA;11. SQL vs NoSQL&#xA;&#xA;SQL databases store data in tables with a strict predefined schema and follow the ACID properties.&#xA;&#xA;Atomicity - A transaction is all-or-nothing (it either completes fully or not at all).&#xA;Consistency – Data always remains valid and follows defined rules.&#xA;Isolation – Transactions don’t interfere with each other.&#xA;Durability – Once data is saved, it won’t be lost, even if the system crashes.&#xA;&#xA;Because of these guarantees, SQL databases are ideal for applications that require strong consistency and structured relationships, such as banking systems.&#xA;&#xA;  Examples of popular SQL databases include: MySQL and PostgreSQL&#xA;&#xA;NoSQL databases on the other hand are designed for high scalability and performance.&#xA;&#xA;They don’t require a fixed schema and use different data models, including:&#xA;&#xA;Key-Value Stores – Fast lookups for simple key-value pairs (e.g., Redis).&#xA;Document Stores – Store flexible, JSON-like documents (e.g., MongoDB).&#xA;Graph Databases – Best for highly connected data (e.g., Neo4j).&#xA;Wide-Column Stores – Optimized for large-scale, distributed data (e.g., Cassandra).&#xA;&#xA;So, which one should you use? It depends on the system requirements.&#xA;&#xA;If you need structured, relational data with strong consistency → SQL is a better choice.&#xA;If you need high scalability, flexible schemas, or fast reads/writes at scale → NoSQL is a better choice.&#xA;&#xA;Many modern applications use both SQL and NoSQL together.&#xA;&#xA;For example, an e-commerce platform might:&#xA;&#xA;Store customer orders in SQL (because they require strict consistency).&#xA;and store Product recommendations in NoSQL (because they need flexible and fast lookups).&#xA;&#xA;If you want to learn more about SQL vs NoSQL, checkout this article:&#xA;&#xA;SQL vs NoSQL - 7 Key Differences You Must Know&#xA;&#xA;SQL vs NoSQL - 7 Key Differences You Must Know&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;September 20, 2024&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;12. Vertical Scaling&#xA;&#xA;As our user base grows, so does the number of requests hitting our application servers.&#xA;&#xA;Initially, a single server might be enough to handle the load. But, as traffic increases, that single server can become a bottleneck, slowing everything down.&#xA;&#xA;One of the quickest solutions is to upgrade the existing server by adding more CPU, RAM or storage.&#xA;&#xA;This approach is called Vertical Scaling (Scaling Up)—making a single machine more powerful.&#xA;&#xA;But there are some major limitations with this approach:&#xA;&#xA;Hardware limits → You can’t keep upgrading a server forever. Every machine has a maximum capacity.&#xA;&#xA;Cost → More powerful servers become exponentially more expensive.&#xA;&#xA;Single Point of Failure (SPOF) → if this one server crashes, the entire system goes down.&#xA;&#xA;So, while vertical scaling is a quick fix, it’s not a long-term solution for handling high traffic and ensuring system reliability.&#xA;&#xA;Lets look at a better approach—one that makes our system more scalable and fault tolerant.&#xA;&#xA;---&#xA;&#xA;13. Horizontal Scaling&#xA;&#xA;Instead of upgrading a single server, what if we add more servers to share the load?&#xA;&#xA;This approach is called Horizontal Scaling (Scaling Out)—where we distribute the workload across multiple machines.&#xA;&#xA;This approach is better because:&#xA;&#xA;More servers = More capacity → The system can handle increasing traffic more effectively.&#xA;No Single Point of Failure → If one server goes down, others can take over, improving reliability.&#xA;Cost-effective → Instead of investing in a single, super-expensive machine, we can use multiple affordable ones.&#xA;&#xA;But horizontal scaling introduces a new challenge: how do clients know which server to connect to?&#xA;&#xA;This is where a Load Balancer comes in.&#xA;&#xA;---&#xA;&#xA;14. Load Balancers&#xA;&#xA;A Load Balancer sits between clients and backend servers, acting as a traffic manager that distributes requests across multiple servers.&#xA;&#xA;If one server crashes, the Load Balancer automatically redirects traffic to another healthy server.&#xA;&#xA;But how does a Load Balancer decide which server should handle the next request?&#xA;&#xA;It uses Load Balancing algorithms, such as:&#xA;&#xA;Round Robin → Requests are sent to servers sequentially, one after another in a loop.&#xA;&#xA;Least Connections → Requests are sent to the server with the fewest active connections.&#xA;&#xA;and IP Hashing → Requests from the same IP address always go to the same server, which helps with session consistency.&#xA;&#xA;Learn more about load balancing algorithms here:&#xA;&#xA;Load Balancing Algorithms Explained with Code&#xA;&#xA;Load Balancing Algorithms Explained with Code&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;June 2, 2024&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;So far, we’ve talked about scaling our application servers, but as traffic grows, the volume of data also increases.&#xA;&#xA;At first, we can scale a database vertically by adding more CPU, RAM, and storage, but there’s a limit to how much a single machine can handle.&#xA;&#xA;So, let’s explore other database scaling techniques that help manage large volumes of data efficiently.&#xA;&#xA;---&#xA;&#xA;15. Database Indexing&#xA;&#xA;One of the quickest and most effective ways to speed up database read queries is indexing.&#xA;&#xA;Think of it like the index page at the back of a book—instead of flipping through every page, you jump directly to the relevant section.&#xA;&#xA;A database index works the same way. It’s is a super-efficient lookup table that helps the database quickly locate the required data without scanning the entire table.&#xA;&#xA;An index stores column values along with pointers to the actual data rows in the table.&#xA;&#xA;Indexes are typically created on columns that are frequently queried, such as:&#xA;&#xA;Primary keys&#xA;Foreign keys&#xA;Columns used in WHERE conditions&#xA;&#xA;But be careful—while indexes speed up reads, they slow down writes (INSERT, UPDATE, DELETE) since the index needs to be updated whenever data changes.&#xA;&#xA;That’s why we should only index the most frequently accessed columns.&#xA;&#xA;Learn more about Database Indexes here:&#xA;&#xA;Database Indexes: A detailed guide&#xA;&#xA;Database Indexes: A detailed guide&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;May 5, 2024&#xA;&#xA;Read full story&#xA;&#xA;Indexing significantly improves read performance, but what if even indexing isn’t enough, and our database can’t handle the growing number of read requests?&#xA;&#xA;That’s where our next database scaling technique Replication comes in.&#xA;&#xA;---&#xA;&#xA;16. Replication&#xA;&#xA;Just like we added more application servers to handle traffic, we can scale our database by creating copies of it across multiple servers.&#xA;&#xA;Here’s how it works:&#xA;&#xA;We have one primary database (also called the Primary Replica) that handles all write operations (INSERT, UPDATE, DELETE).&#xA;We have multiple read replicas that handle read queries (SELECT).&#xA;Whenever data is written to the primary database, it gets copied to the read replicas so that they stay in sync.&#xA;&#xA;Replication improves the read performance since read requests are spread across multiple replicas, reducing the load on each one.&#xA;&#xA;This also improves availability since if the primary replica fails, a read replica can take over as the new primary.&#xA;&#xA;Replication is great for scaling read heavy applications, but what if we need to scale writes or store huge amounts of data?&#xA;&#xA;---&#xA;&#xA;17. Sharding&#xA;&#xA;Let’s say our service now has millions of users, and our database has grown to terabytes of data.&#xA;&#xA;A single database server will eventually struggle to handle all this data efficiently.&#xA;&#xA;Instead of keeping everything in one place, we split the database into smaller, more manageable pieces and distribute them across multiple servers.&#xA;&#xA;This technique is called Sharding.&#xA;&#xA;We divide the database into smaller parts called shards.&#xA;Each shard contains a subset of the total data.&#xA;Data is distributed based on a sharding key (e.g., user ID).&#xA;&#xA;By distributing data this way, we:&#xA;&#xA;Reduce database load → Each shard handles only a portion of queries.&#xA;Speed up read and write performance → Queries are distributed across multiple shards instead of hitting a single database.&#xA;&#xA;Sharding is also referred to as horizontal partitioning since it splits data by rows.&#xA;&#xA;If you want to learn more about Sharding, checkout this article:&#xA;&#xA;What is Database Sharding?&#xA;&#xA;What is Database Sharding?&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;May 12, 2024&#xA;&#xA;Read full story&#xA;&#xA;But what if the issue isn’t the number of rows, but rather the number of columns?&#xA;&#xA;In such cases, we use Vertical Partitioning, where we split the database by columns. Let’s explore that next.&#xA;&#xA;---&#xA;&#xA;18. Vertical Partitioning&#xA;&#xA;Imagine we have a User table that stores:&#xA;&#xA;profile details (name, email, profile picture)&#xA;login history (lastlogin, IP addresses)&#xA;and billing information (billing address, payment details)&#xA;&#xA;As this table grows, queries become slower because the database must scan many columns even when a request only needs a few specific fields.&#xA;&#xA;To optimize this, we use Vertical Partitioning where we split user table into smaller, more focused tables based on usage patterns.&#xA;&#xA;UserProfile → Stores name, email, profile picture.&#xA;UserLogin → Stores login timestamps.&#xA;UserBilling → Stores billing address, payment details.&#xA;&#xA;This improves query performance since each request only scans relevant columns instead of the entire table.&#xA;&#xA;It reduces unnecessary disk I/O, making data retrieval quicker.&#xA;&#xA;However, no matter how much we optimize the database, retrieving data from disk is always slower than retrieving from memory.&#xA;&#xA;What if we could store frequently accessed data in memory for lightning-fast access?&#xA;&#xA;This is called caching.&#xA;&#xA;---&#xA;&#xA;19. Caching&#xA;&#xA;Caching is used to optimize the performance of a system by storing frequently accessed data in memory instead of repeatedly fetching it from the database.&#xA;&#xA;One of the most common caching strategies is the Cache Aside Pattern.&#xA;&#xA;Here’s how it works:&#xA;&#xA;When a user requests a data, the application first check the cache.&#xA;&#xA;If the data is in the cache, it’s returned instantly, avoiding a database call.&#xA;&#xA;If the data is not in the cache, the application retrieves it from the database, stores it in the cache for future requests, and returns it to the user.&#xA;&#xA;Next time, the same data is requested, it’s served directly from cache, making the request much faster.&#xA;&#xA;To prevent outdated data from being served, we use Time-to-Live (TTL)—an expiration time set on cached data so it gets automatically refreshed after a certain period.&#xA;&#xA;  Popular caching tools include Redis and Memcached.&#xA;&#xA;If you want to learn more about caching strategies, check out this article:&#xA;&#xA;Top 5 Caching Strategies Explained&#xA;&#xA;Top 5 Caching Strategies Explained&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;October 24, 2024&#xA;&#xA;Read full story&#xA;&#xA;Lets look at the next database scaling technique.&#xA;&#xA;---&#xA;&#xA;20. Denormalization&#xA;&#xA;Most relational databases use Normalization to store data efficiently by breaking it into separate tables.&#xA;&#xA;For example, in an e-commerce system:&#xA;&#xA;The Users table stores user details.&#xA;The Orders table stores their orders.&#xA;The Products table stores product details.&#xA;&#xA;While this reduces redundancy, it also introduces joins. When retrieving data from multiple tables, the database must combine them using JOIN operations, which can slow down queries as the dataset grows.&#xA;&#xA;SELECT o.orderid, u.name, u.email, o.product, o.amount&#xA;FROM orders o&#xA;JOIN users u ON o.userid = u.userid;&#xA;&#xA;Denormalization reduces the number of joins by combining related data into a single table, even if it means some data gets duplicated.&#xA;&#xA;Example: Instead of keeping Users and Orders in separate tables, we create UserOrders table that stores user details along with their latest orders.&#xA;&#xA;Now, when retrieving a user’s order history, we don’t need a JOIN operation—the data is already stored together leading to faster queries and better read performance.&#xA;&#xA;SELECT orderid, username AS name, useremail AS email, product, amount&#xA;FROM orders;&#xA;&#xA;Denormalization is often used in read-heavy applications where speed is more critical but the downside is it leads to increases storage usage and more complex update requests.&#xA;&#xA;---&#xA;&#xA;21. CAP Theorem&#xA;&#xA;As we scale our system across multiple servers, databases, and data centers, we enter the world of distributed systems.&#xA;&#xA;One of the fundamental principles of distributed systems is the CAP Theorem, which states that: No distributed system can achieve all three of the following at the same time:&#xA;&#xA;Consistency (C) → Every node always returns the most recent data.&#xA;Availability (A) → The system always responds to requests, even if some nodes are down (but the data may not be the latest).&#xA;Partition Tolerance (P) → The system continues operating even if there’s a network failure between nodes.&#xA;&#xA;Since network failures (P) are inevitable, we must choose between:&#xA;&#xA;Consistency + Partition Tolerance (CP) → Ensures every request gets the latest data but may reject requests during failures. Example: SQL databases like MySQL.&#xA;Availability + Partition Tolerance (AP) → Ensures the system always responds, even if some data is stale. Example: NoSQL databases like Cassandra and DynamoDB.&#xA;&#xA;To learn more about CAP theorem, check out this article:&#xA;&#xA;CAP Theorem Explained&#xA;&#xA;CAP Theorem Explained&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;July 31, 2024&#xA;&#xA;Read full story&#xA;&#xA;In distributed NoSQL databases, achieving instant consistency across all servers is too slow.&#xA;&#xA;Instead, we use Eventual Consistency—which means:&#xA;&#xA;Not all nodes are updated instantly, but given enough time, they eventually sync and return the same data.&#xA;This allows the system to remain highly available and fast, even under extreme loads.&#xA;&#xA;How Eventual Consistency Works:&#xA;&#xA;A user updates data in one replica of the database.&#xA;&#xA;The system immediately acknowledges the update, ensuring high availability.&#xA;&#xA;The update is then propagated asynchronously to other replicas.&#xA;&#xA;After a short delay, all replicas have the latest data, ensuring consistency over time.&#xA;&#xA;---&#xA;&#xA;22. Blob Storage&#xA;&#xA;Most modern applications don’t just store text records, they also need to handle images, videos, pdfs and other large files.&#xA;&#xA;But here’s the problem: Traditional databases are not designed to store large, unstructured files efficiently.&#xA;&#xA;So, what’s the solution?&#xA;&#xA;We use Blob Storage like Amazon S3—a highly scalable and cost-effective way to store large, unstructured files in the cloud.&#xA;&#xA;Blobs are the individual files like images, videos or documents.&#xA;&#xA;These blobs are stored inside logical containers or buckets in the cloud.&#xA;&#xA;Each file gets a unique URL, making it easy to retrieve and serve over the web.&#xA;&#xA;  Example: https://my-bucket-name.s3.amazonaws.com/videos/tutorial.mp4&#xA;&#xA;There are several advantages with using blob storage like:&#xA;&#xA;Scalability → It can store petabytes of data effortlessly.&#xA;Pay-as-you-go pricing → You only pay for storage and retrieval that you actually use.&#xA;Automatic replication → Data is copied across multiple data centers and availability zones for durability.&#xA;Easy access → Files can be retrieved using REST APIs or direct URLs.&#xA;&#xA;A common use case is to stream audio or video files to user application in real-time.&#xA;&#xA;But streaming directly from blob-storage can be slow, especially if the data is stored in a distant location.&#xA;&#xA;---&#xA;&#xA;23. CDN&#xA;&#xA;For example, imagine you’re in India trying to watch a YouTube video that’s hosted on a server in California.&#xA;&#xA;Since the video data has to travel across the world, this could lead to buffering and slow load times.&#xA;&#xA;A Content Delivery Network (or CDN) solves this problem by delivering content faster to users based on their location.&#xA;&#xA;Map of globally distributed servers serving content - What is a CDN&#xA;&#xA;source: https://www.cloudflare.com/learning/cdn/what-is-a-cdn/&#xA;&#xA;A CDN is a global network of distributed servers that work together to deliver web content (like HTML pages, JavaScript files, stylesheets, images, and videos) to users based on their geographic location.&#xA;&#xA;Instead of serving content from a single data center, a CDN caches static contents on multiple edge servers located worldwide.&#xA;&#xA;When a user requests content, the nearest CDN server delivers it instead of reaching all the way to the origin server.&#xA;&#xA;Since content is served from the closest CDN node, users experience faster load times with minimal buffering.&#xA;&#xA;To learn more about CDN, check out this article:&#xA;&#xA;What is a Content Delivery Network?&#xA;&#xA;What is a Content Delivery Network?&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;March 4, 2025&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;24. WebSockets&#xA;&#xA;Most web applications use HTTP, which follows a request-response model.&#xA;&#xA;The client sends a request.&#xA;&#xA;The server processes the request and sends a response.&#xA;&#xA;If the client needs new data, it must send another request.&#xA;&#xA;This works fine for static web pages but it’s too slow and inefficient for real-time applications like: live chat apps, stock market dashboards and online multiplayer games.&#xA;&#xA;With HTTP, the only way to get real-time updates is through polling—sending repeated requests every few seconds.&#xA;&#xA;But polling is inefficient because it increases server load and wastes bandwidth, as most responses are empty (when there’s no new data).&#xA;&#xA;WebSockets solve this problem by allowing continuous, two-way communication between the client and server over a single persistent connection.&#xA;&#xA;Here is how WebSockets work:&#xA;&#xA;The client initiates a WebSocket connection with the server.&#xA;&#xA;Once established, the connection remains open.&#xA;&#xA;The server can push updates to the client at any time, without waiting for a request.&#xA;&#xA;The client can also send messages instantly to the server.&#xA;&#xA;This enables real-time interactions and eliminates the need for polling.&#xA;&#xA;To learn more about WebSockets, check out this article:&#xA;&#xA;What are WebSockets and Why are they Used?&#xA;&#xA;What are WebSockets and Why are they Used?&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;August 28, 2024&#xA;&#xA;Read full story&#xA;&#xA;WebSockets enable real-time communication between a client and a server, but what if a server needs to notify another server when an event occurs?&#xA;&#xA;Example:&#xA;&#xA;When a user makes a payment, Stripe needs to notify your application instantly.&#xA;If someone pushes code to GitHub, a CI/CD system (e.g., Jenkins) should be triggered automatically.&#xA;&#xA;Enter Webhooks.&#xA;&#xA;---&#xA;&#xA;25. Webhooks&#xA;&#xA;Instead of constantly polling an API to check if an event has occured, Webhooks allow a server to send an HTTP request to another server as soon as the event occurs.&#xA;&#xA;Here’s how it works:&#xA;&#xA;The receiver (your app) registers a webhook URL with the provider (e.g., Stripe, GitHub, Twilio).&#xA;When an event occurs (e.g., user makes a payment), the provider sends an HTTP POST request to the webhook URL with event details.&#xA;Your app processes the incoming request and updates data accordingly.&#xA;&#xA;This saves server resources and reduces unnecessary API calls.&#xA;&#xA;---&#xA;&#xA;26. Microservices&#xA;&#xA;Traditionally, applications were built using a monolithic architecture, where:&#xA;&#xA;All features (e.g., authentication, payments, orders, shipping) are inside one large codebase.&#xA;If one part of the system fails or needs scaling, the entire system is affected.&#xA;Deployment is risky—one bad update can take down the entire app.&#xA;&#xA;Example: Imagine an e-commerce app where the order, payment, inventory, and shipping modules are all tightly connected in a single codebase.&#xA;&#xA;If the inventory system crashes, the entire app could go down.&#xA;&#xA;Monoliths work fine for small applications, but for large-scale systems, they become hard to manage, scale, and deploy.&#xA;&#xA;The solution is to break down your application into smaller, independent services called micro-services that work together.&#xA;&#xA;Each microservice:&#xA;&#xA;Handles a single responsibility&#xA;&#xA;Has its own database and logic, so it can scale independently.&#xA;&#xA;Communicates with other microservices using APIs or message queues.&#xA;&#xA;This way services can be scaled and deployed individually without affecting the entire system.&#xA;&#xA;However, when multiple microservices need to communicate, direct API calls aren’t always efficient—this is where Message Queues come in.&#xA;&#xA;---&#xA;&#xA;27. Message Queues&#xA;&#xA;In a monolithic system, functions call each other directly and wait for a response.&#xA;&#xA;But in a microservices-based system, this approach is inefficient because:&#xA;&#xA;If one service is slow or down, everything waits.&#xA;High traffic can overload a single service.&#xA;Synchronous communication (waiting for immediate responses) doesn’t scale well.&#xA;&#xA;A Message Queue enables services to communicate asynchronously, allowing requests to be processed without blocking other operations.&#xA;&#xA;Here’s How It Works:&#xA;&#xA;A producer (e.g., checkout service) places a message in the queue (e.g., &#34;Process Payment&#34;).&#xA;&#xA;The queue temporarily holds the message until a consumer (e.g., payment service) is ready to process it.&#xA;&#xA;The consumer retrieves the message and processes it.&#xA;&#xA;Using message queues, we can decouple services and improve the scalability and fault tolerance.&#xA;&#xA;  Common message queue systems include: Apache Kafka, Amazon SQS and RabbitMQ.&#xA;&#xA;To learn more about Message Queues, check out this article:&#xA;&#xA;What are Message Queues and When to Use Them?&#xA;&#xA;What are Message Queues and When to Use Them?&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;August 18, 2024&#xA;&#xA;Read full story&#xA;&#xA;Using message queues, we can prevent overload on internal services within our system.&#xA;&#xA;But, how do we prevent overload for the public APIs and services we deploy.&#xA;&#xA;We use rate limiting.&#xA;&#xA;---&#xA;&#xA;28. Rate Limiting&#xA;&#xA;Imagine a bot starts making thousands of requests per second to your website.&#xA;&#xA;Without restrictions, this could:&#xA;&#xA;Crash your servers by consuming all available resources.&#xA;Increase cloud costs due to excessive API usage.&#xA;and degrade performance for legitimate users.&#xA;&#xA;Rate Limiting restricts the number of requests a client can send within a specific time frame.&#xA;&#xA;Here’s How It Works:&#xA;&#xA;Every user or IP address is assigned a request quota (e.g., 100 requests per minute).&#xA;&#xA;If they exceed this limit, the server blocks additional requests temporarily and returns an error (HTTP 429 – Too Many Requests).&#xA;&#xA;There are various rate limiting algorithms. Some of the popular ones are:&#xA;&#xA;Fixed Window → Limits requests based on a fixed time window (e.g., 100 requests per minute).&#xA;Sliding Window → More flexible version that dynamically adjusts limits to smooth out request bursts.&#xA;Token Bucket → Users get tokens for requests, which replenish over time at a fixed rate.&#xA;&#xA;To learn more about rate limiting algorithms, checkout this article:&#xA;&#xA;Rate Limiting Algorithms Explained with Code&#xA;&#xA;Rate Limiting Algorithms Explained with Code&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;July 17, 2024&#xA;&#xA;Read full story&#xA;&#xA;We don’t need to implement our own rate limiting system - this can be handled by something called an API gateway.&#xA;&#xA;---&#xA;&#xA;29. API Gateways&#xA;&#xA;An API Gateway is a centralized service that handles authentication, rate limiting, logging and monitoring, and request routing.&#xA;&#xA;Imagine a microservices-based application with multiple services.&#xA;&#xA;Instead of exposing each service directly, an API Gateway acts as a single entry point for all client requests.&#xA;&#xA;How API Gateways Work:&#xA;&#xA;The client sends a request to the API Gateway.&#xA;&#xA;The Gateway validates the request (e.g., authentication, rate limits).&#xA;&#xA;It routes the request to the appropriate micro-service.&#xA;&#xA;The response is sent back through the Gateway to the client.&#xA;&#xA;API gateway simplifies API management and improves scalability and security.&#xA;&#xA;  Popular API Gateway solutions include NGINX, Kong and AWS API Gateway.&#xA;&#xA;If you want to learn more about API gateways, checkout this article:&#xA;&#xA;What is an API Gateway?&#xA;&#xA;What is an API Gateway?&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;December 8, 2024&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;30. Idempotency&#xA;&#xA;In distributed systems, network failures and service retries are common. If a user accidentally refreshes a payment page, the system might receive two payment requests instead of one.&#xA;&#xA;Idempotency ensures that repeated requests produce the same result as if the request was made only once.&#xA;&#xA;Here’s how it works:&#xA;&#xA;Each request is assigned a unique ID (e.g., request1234).&#xA;&#xA;Before processing, the system checks if the request has already been handled.&#xA;&#xA;If yes → It ignores the duplicate request.&#xA;&#xA;If no → It processes the request normally.&#xA;&#xA;Idempotency prevents duplicate transactions and ensures data consistency in distributed systems.&#xA;&#xA;If you want to learn more about idempotency, checkout this article:&#xA;&#xA;What is Idempotency in Distributed Systems?&#xA;&#xA;What is Idempotency in Distributed Systems?&#xA;&#xA;Ashish Pratap Singh&#xA;&#xA;·&#xA;&#xA;November 3, 2024&#xA;&#xA;Read full story&#xA;&#xA;---&#xA;&#xA;Thank you so much for reading!&#xA;&#xA;If you found it valuable, hit a like ❤️ and consider subscribing for more such content every week.&#xA;&#xA;This post is public so feel free to share it.&#xA;&#xA;Share&#xA;&#xA;---&#xA;&#xA;P.S. If you’re enjoying this newsletter and want to get even more value, consider becoming a paid subscriber.&#xA;&#xA;As a paid subscriber, you&#39;ll unlock all premium articles and gain full access to all premium courses on algomaster.io.]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://i.snap.as/qKImsBHH.jpg" alt=""/>
<a href="https://christova.writeas.com/tag:SystemDesign" class="hashtag"><span>#</span><span class="p-category">SystemDesign</span></a> <a href="https://christova.writeas.com/tag:systemdesignconcepts" class="hashtag"><span>#</span><span class="p-category">systemdesignconcepts</span></a> <a href="https://christova.writeas.com/tag:must" class="hashtag"><span>#</span><span class="p-category">must</span></a>-know</p>

<p><a href="https://blog.algomaster.io/p/30-system-design-concepts">https://blog.algomaster.io/p/30-system-design-concepts</a></p>

<p><strong>1. Client-Server Architecture</strong></p>

<p>Almost every web application that you use is built on this simple yet powerful concept called <strong>client-server architecture</strong>.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!GgVl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05ba06b8-7730-4d3e-a6d9-1f8c81770b55_1364x446.png"><img src="https://substackcdn.com/image/fetch/$s_!GgVl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F05ba06b8-7730-4d3e-a6d9-1f8c81770b55_1364x446.png" alt=""/></a></p>

<p>On one side, you have a <strong>client</strong>—this could be a web browser, a mobile app, or any other frontend application.</p>

<p>and on the other side, you have a <strong>server</strong>—a machine that runs continuously, waiting to handle incoming requests.</p>

<p>The client sends a request to <strong>store, retrieve, or modify data</strong>.</p>

<p>The server receives the request, processes it, performs the necessary operations, and sends back a response.</p>

<p>This sounds simple, but there’s a big question: <em><strong>How does the client even know where to find the server?</strong></em></p>

<hr/>

<h2 id="2-ip-address" id="2-ip-address"><strong>2. IP Address</strong></h2>

<p>A client doesn’t magically know where a server is, it needs an <strong>address</strong> to locate and communicate with it.</p>

<p>On the internet, computers identify each other using <strong>IP addresses</strong>, which work like phone numbers for servers.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!7vrc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbefd954a-3bf4-4000-9749-8bbe491b7881_1304x848.png"><img src="https://substackcdn.com/image/fetch/$s_!7vrc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbefd954a-3bf4-4000-9749-8bbe491b7881_1304x848.png" alt=""/></a></p>

<p>Every publicly deployed server has a <strong>unique IP address</strong>. When a client wants to interact with a service, it must send requests to the correct IP address.</p>

<p>But there’s a problem:</p>
<ul><li>When we visit a website, we don’t type its IP address—we just enter the website name.</li>
<li>We can’t expect users (or even systems) to memorize a string of random numbers for every service they connect to.</li>
<li>And if we migrate our service to another server, its IP address may change—breaking all direct connections.</li></ul>

<hr/>

<h2 id="3-dns" id="3-dns"><strong>3. DNS</strong></h2>

<p>Instead of relying on hard-to-remember IP addresses, we use something much more human-friendly: <strong>domain names</strong>.</p>

<p>But, we need a way to map a domain name to it’s corresponding IP address.</p>

<p>This is where <strong>DNS (or Domain Name System)</strong> comes in. It maps easy to remember domain names (like <a href="http://algomaster.io/">algomaster.io</a>) to their corresponding IP addresses.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!s6fZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a22b7b4-f51c-47c7-a9db-abb5ce56def7_1284x916.png"><img src="https://substackcdn.com/image/fetch/$s_!s6fZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7a22b7b4-f51c-47c7-a9db-abb5ce56def7_1284x916.png" alt=""/></a></p>

<p>Here’s what happens behind the scenes:</p>
<ol><li><p>When you type <code>algomaster.io</code> into your browser, your computer asks a DNS server for the corresponding IP address.</p></li>

<li><p>Once the DNS server responds with the IP, your browser uses it to establish a connection with the server and make a request.</p></li></ol>

<p>You can find the IP address of any domain using the <strong>ping</strong> command. Just open your terminal and type ping followed by the domain name. And it’ll return the IP address currently assigned to that domain.</p>

<p><strong><a href="https://blog.algomaster.io/p/30-system-design-concepts?utm_source=substack&amp;utm_medium=email&amp;utm_content=share&amp;action=share">Share</a></strong></p>

<hr/>

<h2 id="4-proxy-reverse-proxy" id="4-proxy-reverse-proxy"><strong>4. Proxy / Reverse Proxy</strong></h2>

<p>When you visit a website, your request doesn’t always go directly to the server—sometimes, it passes through a <strong>proxy</strong> or <strong>reverse proxy</strong> first.</p>

<p>A <strong>proxy server</strong> acts as a <strong>middleman</strong> between your device and the internet.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!i5Av!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff11ff886-4db5-4550-aa0f-5f232b094b03_887x477.png"><img src="https://substackcdn.com/image/fetch/$s_!i5Av!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff11ff886-4db5-4550-aa0f-5f232b094b03_887x477.png" alt=""/></a></p>

<p>When you request a webpage, the proxy forwards your request to the target server, retrieves the response, and sends it back to you.</p>

<p>Proxy hides your IP address, keeping your location and identity private.</p>

<p>A <strong>reverse proxy</strong> works the other way around. It intercepts client requests and forwards them to backend servers based on predefined rules.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!L8Gg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3be42662-47d2-4165-b278-95d583e2d2be_904x517.png"><img src="https://substackcdn.com/image/fetch/$s_!L8Gg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3be42662-47d2-4165-b278-95d583e2d2be_904x517.png" alt=""/></a></p>

<p>Allowing direct access to servers can pose <strong>security risks</strong>, exposing them to threats like <strong>hackers</strong> and <strong>DDoS attacks</strong>.</p>

<p>A reverse proxy mitigates these risks by acting as a controlled entry point that regulates incoming traffic and hides server IPs.</p>

<p>It can also act as a load balancer, distributing traffic across multiple servers.</p>

<p>If you want to learn about Proxy vs Reverse Proxy in more detail, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/proxy-vs-reverse-proxy-explained"><img src="https://substackcdn.com/image/fetch/$s_!-vu2!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F005673b3-62cb-48a8-adc6-19fc69156a17_887x477.png" alt="Proxy vs Reverse Proxy (Explained with Examples)"/></a></p>

<h4 id="proxy-vs-reverse-proxy-explained-with-examples-https-blog-algomaster-io-p-proxy-vs-reverse-proxy-explained" id="proxy-vs-reverse-proxy-explained-with-examples-https-blog-algomaster-io-p-proxy-vs-reverse-proxy-explained"><strong><a href="https://blog.algomaster.io/p/proxy-vs-reverse-proxy-explained">Proxy vs Reverse Proxy (Explained with Examples)</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>October 30, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/proxy-vs-reverse-proxy-explained">Read full story</a></strong></p>

<hr/>

<h2 id="5-latency" id="5-latency"><strong>5. Latency</strong></h2>

<p>Whenever a client communicates with a server, there’s always some delay. One of the biggest causes of this delay is <strong>physical distance</strong>.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!CL6W!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664e76b6-37fa-4e36-b8a5-d41a5b0ad93a_1866x988.png"><img src="https://substackcdn.com/image/fetch/$s_!CL6W!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F664e76b6-37fa-4e36-b8a5-d41a5b0ad93a_1866x988.png" alt=""/></a></p>

<p>For example, if our server is in <strong>New York</strong>, but a user in <strong>India</strong> sends a request, the data has to travel halfway across the world—and then the response has to make the same long trip back.</p>

<p>This round-trip delay is called <strong>latency</strong>—the total time it takes for data to travel between the client and the server. High latency can make applications feel slow and unresponsive.</p>

<p>One way to <strong>reduce latency</strong> is by deploying our service across <strong>multiple data centers worldwide</strong>.</p>

<p>This way, users can connect to the <strong>nearest</strong> server instead of waiting for data to travel across the globe.</p>

<p><em><strong>Once a connection is made, how do clients and servers actually communicate?</strong></em></p>

<hr/>

<h2 id="6-http-https" id="6-http-https"><strong>6. HTTP/HTTPS</strong></h2>

<p>Every time you visit a website, your browser and the server communicate using a set of rules called <strong>HTTP (Hypertext Transfer Protocol)</strong>.</p>

<p>That’s why most URLs start with <code>http://</code> or its secure version, <code>https://</code>.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!8BgK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46796792-f8b5-4e13-b4c2-6920b3d6e0e7_1942x1170.png"><img src="https://substackcdn.com/image/fetch/$s_!8BgK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F46796792-f8b5-4e13-b4c2-6920b3d6e0e7_1942x1170.png" alt=""/></a></p>

<p>Here’s how it works:</p>
<ul><li>The <strong>client</strong> sends a request to the server. This request includes a <strong>header</strong> (containing details like the request type, browser type, and cookies) and sometimes a <strong>request body</strong> (which carries additional data, like form inputs).</li>
<li>The <strong>server</strong> processes the request and responds with an <strong>HTTP response</strong>—either returning the requested data or an error message if something goes wrong.</li></ul>

<p>HTTP has a major security flaw, it <strong>sends data in plain text</strong>. This is a serious problem, especially for sensitive information like passwords, credit card details, and personal data.</p>

<p>That’s why modern websites use <strong>HTTPS (Hypertext Transfer Protocol Secure)</strong> instead. HTTPS encrypts all data using <strong>SSL/TLS,</strong> ensuring that even if someone intercepts the request, they can’t read or alter it.</p>

<p>But clients and servers don’t directly exchange raw HTTP requests and response.</p>

<p>HTTP is just a <strong>protocol</strong> for transferring data but it doesn’t define:</p>
<ul><li>How requests should be structured</li>
<li>What format responses should be in</li>
<li>or how different clients should interact with the server.</li></ul>

<p>This is where <strong>APIs (or Application Programming Interfaces)</strong> come in.</p>

<hr/>

<h2 id="7-apis" id="7-apis"><strong>7. APIs</strong></h2>

<p>Think of an API as a <strong>middleman</strong> that allows clients (like web and mobile apps) to communicate with servers without worrying about low-level details.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!EH_B!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c3a0e69-9134-4bd9-9d42-a898bc838e32_1574x504.png"><img src="https://substackcdn.com/image/fetch/$s_!EH_B!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0c3a0e69-9134-4bd9-9d42-a898bc838e32_1574x504.png" alt=""/></a></p>

<p>Almost every digital service you use—social media, e-commerce, online banking, ride-hailing apps—is built on APIs working together behind the scenes.</p>

<p>Here’s how it typically works:</p>
<ol><li><p>A <strong>client</strong> sends a request to an API.</p></li>

<li><p>The <strong>API</strong>, hosted on a server, processes the request, interacts with databases or other services, and prepares a response.</p></li>

<li><p>The <strong>API sends back the response</strong> in a structured format, usually <strong>JSON</strong> or <strong>XML</strong>, which the client understands and can display.</p></li></ol>

<p>APIs provide a <strong>layer of abstraction</strong>—the client doesn’t need to know <strong>how</strong> the server processes the request, only that it <strong>returns the expected data</strong>.</p>

<p>If you want to learn more about APIs, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/whats-an-api"><img src="https://substackcdn.com/image/fetch/$s_!f-cG!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae14a376-92a3-4ff6-a329-8e4f2a7ac9b5_1546x1074.png" alt="What&#39;s an API?"/></a></p>

<h4 id="what-s-an-api-https-blog-algomaster-io-p-whats-an-api" id="what-s-an-api-https-blog-algomaster-io-p-whats-an-api"><strong><a href="https://blog.algomaster.io/p/whats-an-api">What&#39;s an API?</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>January 21, 2025</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/whats-an-api">Read full story</a></strong></p>

<p>But, not all APIs are built the same. Different API styles exist to serve different needs. Two of the most popular ones are <strong>REST</strong> and <strong>GraphQL</strong>.</p>

<hr/>

<h2 id="8-rest-api" id="8-rest-api"><strong>8. Rest API</strong></h2>

<p>Among the different API styles, <strong>REST (Representational State Transfer)</strong> is the most widely used.</p>

<p>A <strong>REST API</strong> follows a set of rules that define how clients and servers communicate over HTTP in a structured way.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!HBtO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c704568-18c9-48e5-ba45-f8e6e1e25a6b_1554x896.png"><img src="https://substackcdn.com/image/fetch/$s_!HBtO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c704568-18c9-48e5-ba45-f8e6e1e25a6b_1554x896.png" alt=""/></a></p>

<p>Rest is:</p>
<ul><li><strong>Stateless:</strong> Every request is independent; the server doesn’t store client state.</li>
<li><strong>Resource-Based:</strong> Everything is treated as a resource (e.g., /users, /orders, /products).</li>
<li><strong>Uses Standard HTTP Methods:</strong> Clients interact with resources using <strong>HTTP methods</strong> like:
<ul><li><strong>GET</strong> → Retrieves data (e.g., fetching a user profile).</li>
<li><strong>POST</strong> → Creates new data (e.g., adding a new user).</li>
<li><strong>PUT/PATCH</strong> → Updates existing data (e.g., changing user settings).</li>
<li><strong>DELETE</strong> → Removes data (e.g., deleting an account).</li></ul></li></ul>

<p>REST APIs are great because they’re <strong>simple, scalable, and easy to cache</strong>, but they have <strong>limitations</strong>, especially when dealing with complex data retrieval.</p>

<p>REST endpoints often return <strong>more data than needed</strong>, leading to inefficient network usage. If an API doesn’t return related data, the client may need to <strong>make multiple requests</strong> to retrieve all required information.</p>

<p>To address these challenges, GraphQL was introduced in 2015 by Facebook.</p>

<hr/>

<h2 id="9-graphql" id="9-graphql"><strong>9. GraphQL</strong></h2>

<p>Unlike REST, which forces clients to retrieve <strong>fixed sets of data</strong>, <strong>GraphQL</strong> lets clients <strong>ask for exactly what they need—nothing more, nothing less</strong>.</p>

<p>With a REST API, if you need a user details, user profile details along with their recent posts, you might have to <strong>make multiple requests</strong> to different endpoints:</p>
<ol><li><p><code>GET /api/users/123</code> → fetch user details</p></li>

<li><p><code>GET /api/users/123/profile</code> → fetch user profile</p></li>

<li><p><code>GET /api/users/123/posts</code> → fetch user’s posts</p></li></ol>

<p>With GraphQL, you can <strong>combine those requests into one</strong> and fetch exactly the data you need in a single query:</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!s0a7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b40446b-9156-4e7f-9107-654235bb1e53_2138x1806.png"><img src="https://substackcdn.com/image/fetch/$s_!s0a7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5b40446b-9156-4e7f-9107-654235bb1e53_2138x1806.png" alt=""/></a></p>

<p>The <strong>server responds with only the requested fields</strong>, reducing unnecessary data transfer and improving efficiency.</p>

<p>However, GraphQL also comes with trade-offs—it <strong>requires more processing on the server side</strong> and isn’t as easy to cache as REST.</p>

<p>Learn more about REST vs GraphQL here:</p>

<p><a href="https://blog.algomaster.io/p/rest-vs-graphql"><img src="https://substackcdn.com/image/fetch/$s_!cEwV!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc4d86506-cb5f-4c9f-a56a-257439ec46eb_1666x1210.png" alt="REST vs GraphQL"/></a></p>

<h4 id="rest-vs-graphql-https-blog-algomaster-io-p-rest-vs-graphql" id="rest-vs-graphql-https-blog-algomaster-io-p-rest-vs-graphql"><strong><a href="https://blog.algomaster.io/p/rest-vs-graphql">REST vs GraphQL</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>March 11, 2025</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/rest-vs-graphql">Read full story</a></strong></p>

<p>When a client makes a request, they usually want to <strong>store or retrieve data</strong>.</p>

<p>But this brings up another question—<em><strong>where is the actual data stored?</strong></em></p>

<hr/>

<h2 id="10-databases" id="10-databases"><strong>10. Databases</strong></h2>

<p>If our application deals with <strong>small amounts of data</strong>, we could store it <strong>in memory</strong>.</p>

<p>But modern applications handle <strong>massive volumes of data</strong>—far more than what memory can efficiently handle.</p>

<p>That’s why we need a <strong>dedicated server for storing and managing data</strong>—a <strong>database</strong>.</p>

<p>A database is the backbone of any application. It ensures that data is stored, retrieved, and managed efficiently while keeping it secure, consistent, and durable.</p>

<p>When a client requests to <strong>store</strong> or <strong>retrieve</strong> data, the <strong>server communicates with the database</strong>, fetches the required information, and returns it to the client.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!Xis-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57b338e3-3cc2-4bcf-86e4-0aa42cc2c2de_1060x884.png"><img src="https://substackcdn.com/image/fetch/$s_!Xis-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57b338e3-3cc2-4bcf-86e4-0aa42cc2c2de_1060x884.png" alt=""/></a></p>

<p>But not all databases are the same. Different applications have different <strong>scalability, performance, and consistency</strong> requirements, which is choosing the right type of database is important.</p>

<p>If you want to learn about different types of databases, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/15-types-of-databases"><img src="https://substackcdn.com/image/fetch/$s_!sdB1!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F773d33c8-ab09-4d63-a6a4-ee55bd9ef0ff_1944x1148.png" alt="15 Types of Databases and When to Use Them"/></a></p>

<h4 id="15-types-of-databases-and-when-to-use-them-https-blog-algomaster-io-p-15-types-of-databases" id="15-types-of-databases-and-when-to-use-them-https-blog-algomaster-io-p-15-types-of-databases"><strong><a href="https://blog.algomaster.io/p/15-types-of-databases">15 Types of Databases and When to Use Them</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>March 24, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/15-types-of-databases">Read full story</a></strong></p>

<p>In system design, we typically choose between <strong>SQL and NoSQL databases</strong>.</p>

<hr/>

<h2 id="11-sql-vs-nosql" id="11-sql-vs-nosql"><strong>11. SQL vs NoSQL</strong></h2>

<p><a href="https://substackcdn.com/image/fetch/$s_!3Es9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa81088b7-a188-4089-845a-63936e930a71_1632x1076.png"><img src="https://substackcdn.com/image/fetch/$s_!3Es9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa81088b7-a188-4089-845a-63936e930a71_1632x1076.png" alt=""/></a></p>

<p>SQL databases store data in tables with a <strong>strict predefined schema</strong> and follow the <strong>ACID properties</strong>.</p>
<ul><li><strong>Atomicity</strong> - A transaction is <strong>all-or-nothing</strong> (it either completes fully or not at all).</li>
<li><strong>Consistency</strong> – Data always remains <strong>valid</strong> and follows defined rules.</li>
<li><strong>Isolation</strong> – Transactions <strong>don’t interfere</strong> with each other.</li>
<li><strong>Durability</strong> – Once data is saved, it <strong>won’t be lost</strong>, even if the system crashes.</li></ul>

<p>Because of these guarantees, SQL databases are ideal for applications that require <strong>strong consistency and structured relationships</strong>, such as <strong>banking systems</strong>.</p>

<blockquote><p>Examples of popular SQL databases include: MySQL and PostgreSQL</p></blockquote>

<p>NoSQL databases on the other hand are designed for <strong>high scalability and performance</strong>.</p>

<p>They <strong>don’t require a fixed schema</strong> and use different data models, including:</p>
<ul><li><strong>Key-Value Stores</strong> – Fast lookups for simple key-value pairs (e.g., Redis).</li>
<li><strong>Document Stores</strong> – Store flexible, JSON-like documents (e.g., MongoDB).</li>
<li><strong>Graph Databases</strong> – Best for highly connected data (e.g., Neo4j).</li>
<li><strong>Wide-Column Stores</strong> – Optimized for large-scale, distributed data (e.g., Cassandra).</li></ul>

<p>So, <strong>which one should you use?</strong> It depends on the system requirements.</p>
<ul><li>If you need <strong>structured, relational data with strong consistency</strong> → <strong>SQL is a better choice.</strong></li>
<li>If you need <strong>high scalability, flexible schemas, or fast reads/writes at scale</strong> → <strong>NoSQL is a better choice.</strong></li></ul>

<p>Many modern applications <strong>use both SQL and NoSQL together.</strong></p>

<p>For example, an e-commerce platform might:</p>
<ul><li>Store customer orders in SQL (because they require strict consistency).</li>
<li>and store Product recommendations in NoSQL (because they need flexible and fast lookups).</li></ul>

<p>If you want to learn more about SQL vs NoSQL, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/sql-vs-nosql-7-key-differences"><img src="https://substackcdn.com/image/fetch/$s_!3Es9!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa81088b7-a188-4089-845a-63936e930a71_1632x1076.png" alt="SQL vs NoSQL - 7 Key Differences You Must Know"/></a></p>

<h4 id="sql-vs-nosql-7-key-differences-you-must-know-https-blog-algomaster-io-p-sql-vs-nosql-7-key-differences" id="sql-vs-nosql-7-key-differences-you-must-know-https-blog-algomaster-io-p-sql-vs-nosql-7-key-differences"><strong><a href="https://blog.algomaster.io/p/sql-vs-nosql-7-key-differences">SQL vs NoSQL – 7 Key Differences You Must Know</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>September 20, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/sql-vs-nosql-7-key-differences">Read full story</a></strong></p>

<hr/>

<h2 id="12-vertical-scaling" id="12-vertical-scaling"><strong>12. Vertical Scaling</strong></h2>

<p>As our <strong>user base grows</strong>, so does the number of <strong>requests hitting our application servers</strong>.</p>

<p>Initially, a <strong>single server</strong> might be enough to handle the load. But, as traffic increases, that single server can become a bottleneck, slowing everything down.</p>

<p>One of the quickest solutions is to <strong>upgrade the existing server</strong> by adding more CPU, RAM or storage.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!x4x6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F491fc8b1-02e4-490c-bb5f-87286df10730_1086x556.png"><img src="https://substackcdn.com/image/fetch/$s_!x4x6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F491fc8b1-02e4-490c-bb5f-87286df10730_1086x556.png" alt=""/></a></p>

<p>This approach is called <strong>Vertical Scaling (Scaling Up)</strong>—making a single machine more powerful.</p>

<p>But there are some major limitations with this approach:</p>
<ol><li><p><strong>Hardware limits →</strong> You can’t keep upgrading a server forever. Every machine has a maximum capacity.</p></li>

<li><p><strong>Cost →</strong> More powerful servers become exponentially more expensive.</p></li>

<li><p><strong>Single Point of Failure (SPOF)</strong> <strong>→</strong> if this one server crashes, the entire system <strong>goes down</strong>.</p></li></ol>

<p>So, while vertical scaling is a quick fix, it’s not a long-term solution for handling high traffic and ensuring system reliability.</p>

<p>Lets look at a better approach—one that makes our system more scalable and fault tolerant.</p>

<hr/>

<h2 id="13-horizontal-scaling" id="13-horizontal-scaling"><strong>13. Horizontal Scaling</strong></h2>

<p>Instead of upgrading a single server, what if we <strong>add more servers</strong> to share the load?</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!aryi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8bba98b-abf7-42de-b699-0de1bcde0454_1180x426.png"><img src="https://substackcdn.com/image/fetch/$s_!aryi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8bba98b-abf7-42de-b699-0de1bcde0454_1180x426.png" alt=""/></a></p>

<p>This approach is called <strong>Horizontal Scaling (Scaling Out)</strong>—where we <strong>distribute the workload across multiple machines</strong>.</p>

<p>This approach is better because:</p>
<ul><li><strong>More servers = More capacity →</strong> The system can handle increasing traffic more effectively.</li>
<li><strong>No Single Point of Failure →</strong> If one server goes down, others can <strong>take over</strong>, improving reliability.</li>
<li><strong>Cost-effective →</strong> Instead of investing in a single, super-expensive machine, we can use multiple affordable ones.</li></ul>

<p>But horizontal scaling introduces a new challenge: <em><strong>how do clients know which server to connect to?</strong></em></p>

<p>This is where a <strong>Load Balancer</strong> comes in.</p>

<hr/>

<h2 id="14-load-balancers" id="14-load-balancers"><strong>14. Load Balancers</strong></h2>

<p><a href="https://substackcdn.com/image/fetch/$s_!DnSE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faebd5461-34f3-47c5-bc8e-5248bb9a92c8_1304x1050.png"><img src="https://substackcdn.com/image/fetch/$s_!DnSE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Faebd5461-34f3-47c5-bc8e-5248bb9a92c8_1304x1050.png" alt=""/></a></p>

<p>A <strong>Load Balancer</strong> sits between <strong>clients</strong> and <strong>backend servers</strong>, acting as a <strong>traffic manager</strong> that distributes requests across multiple servers.</p>

<p>If one server crashes, the Load Balancer automatically redirects traffic to another healthy server.</p>

<p><em><strong>But how does a Load Balancer decide which server should handle the next request?</strong></em></p>

<p>It uses <strong>Load Balancing algorithms</strong>, such as:</p>
<ol><li><p><strong>Round Robin</strong> <strong>→</strong> Requests are sent to servers sequentially, one after another in a loop.</p></li>

<li><p><strong>Least Connections</strong> <strong>→</strong> Requests are sent to the server with the fewest active connections.</p></li>

<li><p><strong>and IP Hashing</strong> <strong>→</strong> Requests from the same IP address always go to the <strong>same server</strong>, which helps with <strong>session consistency.</strong></p></li></ol>

<p>Learn more about load balancing algorithms here:</p>

<p><a href="https://blog.algomaster.io/p/load-balancing-algorithms-explained-with-code"><img src="https://substackcdn.com/image/fetch/$s_!jpjg!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54114fcc-cce5-4f0d-a678-47f8f0339fd4_1304x1076.png" alt="Load Balancing Algorithms Explained with Code"/></a></p>

<h4 id="load-balancing-algorithms-explained-with-code-https-blog-algomaster-io-p-load-balancing-algorithms-explained-with-code" id="load-balancing-algorithms-explained-with-code-https-blog-algomaster-io-p-load-balancing-algorithms-explained-with-code"><strong><a href="https://blog.algomaster.io/p/load-balancing-algorithms-explained-with-code">Load Balancing Algorithms Explained with Code</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>June 2, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/load-balancing-algorithms-explained-with-code">Read full story</a></strong></p>

<hr/>

<p>So far, we’ve talked about scaling our application servers, but as traffic grows, the volume of data also increases.</p>

<p>At first, we can scale a database <strong>vertically</strong> by adding more CPU, RAM, and storage, but there’s a limit to how much a single machine can handle.</p>

<p>So, let’s explore other <strong>database scaling techniques</strong> that help manage large volumes of data efficiently.</p>

<hr/>

<h2 id="15-database-indexing" id="15-database-indexing"><strong>15. Database Indexing</strong></h2>

<p>One of the quickest and most effective ways to speed up database <strong>read queries</strong> is <strong>indexing</strong>.</p>

<p>Think of it like the index page at the back of a book—instead of flipping through every page, you jump directly to the relevant section.</p>

<p>A <strong>database index</strong> works the same way. It’s is a super-efficient lookup table that helps the database quickly locate the required data without scanning the entire table.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!ABC0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6543930-e7ce-4dda-b4b2-82db93223aa7_1330x788.png"><img src="https://substackcdn.com/image/fetch/$s_!ABC0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6543930-e7ce-4dda-b4b2-82db93223aa7_1330x788.png" alt=""/></a></p>

<p>An index stores column values along with pointers to the actual data rows in the table.</p>

<p>Indexes are typically created on <strong>columns that are frequently queried</strong>, such as:</p>
<ul><li>Primary keys</li>
<li>Foreign keys</li>
<li>Columns used in WHERE conditions</li></ul>

<p>But be careful—while indexes <strong>speed up reads, they slow down writes</strong> (<code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code>) since the index needs to be updated whenever data changes.</p>

<p>That’s why we should <strong>only index the most frequently accessed columns</strong>.</p>

<p>Learn more about Database Indexes here:</p>

<p><a href="https://blog.algomaster.io/p/a-detailed-guide-on-database-indexes"><img src="https://substackcdn.com/image/fetch/$s_!ucFq!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9d51c18-fd89-4320-af15-a1dfd9d4487f_1120x738.png" alt="Database Indexes: A detailed guide"/></a></p>

<h4 id="database-indexes-a-detailed-guide-https-blog-algomaster-io-p-a-detailed-guide-on-database-indexes" id="database-indexes-a-detailed-guide-https-blog-algomaster-io-p-a-detailed-guide-on-database-indexes"><strong><a href="https://blog.algomaster.io/p/a-detailed-guide-on-database-indexes">Database Indexes: A detailed guide</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>May 5, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/a-detailed-guide-on-database-indexes">Read full story</a></strong></p>

<p>Indexing significantly improves <strong>read performance</strong>, but <em><strong>what if even indexing isn’t enough, and our database can’t handle the growing number of read requests?</strong></em></p>

<p>That’s where our next database scaling technique <strong>Replication</strong> comes in.</p>

<hr/>

<h2 id="16-replication" id="16-replication"><strong>16. Replication</strong></h2>

<p>Just like we added more application servers to handle traffic, we can scale our database by creating <strong>copies</strong> of it across multiple servers.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!zLIG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d8f5734-fd0b-4591-a1a5-082cea0212ce_970x730.png"><img src="https://substackcdn.com/image/fetch/$s_!zLIG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d8f5734-fd0b-4591-a1a5-082cea0212ce_970x730.png" alt=""/></a></p>

<p>Here’s how it works:</p>
<ul><li>We have <strong>one primary database</strong> (also called the <strong>Primary Replica</strong>) that handles all <strong>write operations</strong> (<code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code>).</li>
<li>We have <strong>multiple read replicas</strong> that handle <strong>read queries (SELECT)</strong>.</li>
<li>Whenever data is written to the primary database, it gets copied to the read replicas so that they stay in sync.</li></ul>

<p>Replication improves the read performance since read requests are spread across multiple replicas, reducing the load on each one.</p>

<p>This also improves availability since if the primary replica fails, a read replica can take over as the new primary.</p>

<p>Replication is great for scaling read heavy applications, <em><strong>but what if we need to scale writes or store huge amounts of data?</strong></em></p>

<hr/>

<h2 id="17-sharding" id="17-sharding"><strong>17. Sharding</strong></h2>

<p>Let’s say our service now has <strong>millions of users,</strong> and our database has grown to <strong>terabytes of data</strong>.</p>

<p>A <strong>single database server</strong> will eventually struggle to handle all this data efficiently.</p>

<p>Instead of keeping everything in one place, we <strong>split the database into smaller, more manageable pieces</strong> and distribute them across <strong>multiple servers</strong>.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!17Jc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e67c3b7-92cd-4f84-854e-e71f45f7efa2_1902x668.png"><img src="https://substackcdn.com/image/fetch/$s_!17Jc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6e67c3b7-92cd-4f84-854e-e71f45f7efa2_1902x668.png" alt=""/></a></p>

<p>This technique is called <strong>Sharding</strong>.</p>
<ul><li>We divide the database into smaller parts called <strong>shards</strong>.</li>
<li>Each <strong>shard contains a subset</strong> of the total data.</li>
<li>Data is distributed based on a <strong>sharding key</strong> (e.g., <strong>user ID</strong>).</li></ul>

<p>By distributing data this way, we:</p>
<ul><li><strong>Reduce database load</strong> → Each shard handles <strong>only a portion</strong> of queries.</li>
<li><strong>Speed up read and write performance</strong> → Queries are distributed across multiple shards instead of hitting a single database.</li></ul>

<p>Sharding is also referred to as horizontal partitioning since it splits data by rows.</p>

<p>If you want to learn more about Sharding, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/what-is-database-sharding"><img src="https://substackcdn.com/image/fetch/$s_!Zxuc!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc8c20c76-23d3-40a9-af20-5c9b8957fe63_1210x1068.png" alt="What is Database Sharding?"/></a></p>

<h4 id="what-is-database-sharding-https-blog-algomaster-io-p-what-is-database-sharding" id="what-is-database-sharding-https-blog-algomaster-io-p-what-is-database-sharding"><strong><a href="https://blog.algomaster.io/p/what-is-database-sharding">What is Database Sharding?</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>May 12, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/what-is-database-sharding">Read full story</a></strong></p>

<p><em><strong>But what if the issue isn’t the number of rows, but rather the number of columns?</strong></em></p>

<p>In such cases, we use <strong>Vertical Partitioning</strong>, where we <strong>split the database by columns</strong>. Let’s explore that next.</p>

<hr/>

<h2 id="18-vertical-partitioning" id="18-vertical-partitioning"><strong>18. Vertical Partitioning</strong></h2>

<p>Imagine we have a <strong>User table</strong> that stores:</p>
<ul><li>profile details (name, email, profile picture)</li>
<li>login history (last_login, IP addresses)</li>
<li>and billing information (billing address, payment details)</li></ul>

<p>As this table <strong>grows</strong>, queries become <strong>slower</strong> because the database must scan <strong>many columns</strong> even when a request only needs a <strong>few specific fields.</strong></p>

<p>To optimize this, we use <strong>Vertical Partitioning where we split user table into smaller, more focused tables</strong> based on usage patterns.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!7S9u!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75daa5e9-2a22-440f-bba3-f1336f613339_2282x1006.png"><img src="https://substackcdn.com/image/fetch/$s_!7S9u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75daa5e9-2a22-440f-bba3-f1336f613339_2282x1006.png" alt=""/></a></p>
<ul><li><strong>User_Profile</strong> → Stores name, email, profile picture.</li>
<li><strong>User_Login</strong> → Stores login timestamps.</li>
<li><strong>User_Billing</strong> → Stores billing address, payment details.</li></ul>

<p>This improves <strong>query performance</strong> since each request only scans <strong>relevant columns</strong> instead of the entire <strong>table</strong>.</p>

<p>It reduces <strong>unnecessary disk I/O</strong>, making data retrieval quicker.</p>

<p>However, no matter how much we optimize the database, <strong>retrieving data from disk is always slower than retrieving from memory</strong>.</p>

<p><em><strong>What if we could store frequently accessed data in memory for lightning-fast access?</strong></em></p>

<p>This is called <strong>caching</strong>.</p>

<hr/>

<h2 id="19-caching" id="19-caching"><strong>19. Caching</strong></h2>

<p><strong>Caching</strong> is used to optimize the performance of a system by <strong>storing frequently accessed data in memory</strong> instead of repeatedly fetching it from the database.</p>

<p>One of the most common caching strategies is the <strong>Cache Aside Pattern.</strong></p>

<p><a href="https://substackcdn.com/image/fetch/$s_!y--V!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc5992eb-9290-49c7-ad8d-594a7560ef41_2200x1102.png"><img src="https://substackcdn.com/image/fetch/$s_!y--V!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc5992eb-9290-49c7-ad8d-594a7560ef41_2200x1102.png" alt=""/></a></p>

<p>Here’s how it works:</p>
<ol><li><p>When a user <strong>requests a data</strong>, the application first check the <strong>cache</strong>.</p></li>

<li><p>If the data is <strong>in the cache</strong>, it’s returned <strong>instantly, avoiding a database call</strong>.</p></li>

<li><p>If the data <strong>is not in the cache</strong>, the application <strong>retrieves it from the database</strong>, stores it in the cache for future requests, and returns it to the user.</p></li>

<li><p>Next time, the same data is requested, it’s served <strong>directly from cache</strong>, making the request much faster.</p></li></ol>

<p>To prevent outdated data from being served, we use <strong>Time-to-Live (TTL)</strong>—an expiration time set on cached data so it gets <strong>automatically refreshed</strong> after a certain period.</p>

<blockquote><p>Popular caching tools include <strong>Redis and Memcached.</strong></p></blockquote>

<p>If you want to learn more about caching strategies, check out this article:</p>

<p><a href="https://blog.algomaster.io/p/top-5-caching-strategies-explained"><img src="https://substackcdn.com/image/fetch/$s_!qQlQ!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1b38086e-3798-4d29-8231-33c8e84ffbc6_665x468.png" alt="Top 5 Caching Strategies Explained"/></a></p>

<h4 id="top-5-caching-strategies-explained-https-blog-algomaster-io-p-top-5-caching-strategies-explained" id="top-5-caching-strategies-explained-https-blog-algomaster-io-p-top-5-caching-strategies-explained"><strong><a href="https://blog.algomaster.io/p/top-5-caching-strategies-explained">Top 5 Caching Strategies Explained</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>October 24, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/top-5-caching-strategies-explained">Read full story</a></strong></p>

<p>Lets look at the next database scaling technique.</p>

<hr/>

<h2 id="20-denormalization" id="20-denormalization"><strong>20. Denormalization</strong></h2>

<p>Most relational databases use <strong>Normalization</strong> to store data efficiently by breaking it into separate tables.</p>

<p>For example, in an e-commerce system:</p>
<ul><li>The <strong>Users table</strong> stores user details.</li>
<li>The <strong>Orders table</strong> stores their orders.</li>
<li>The <strong>Products table</strong> stores product details.</li></ul>

<p>While this <strong>reduces redundancy</strong>, it also <strong>introduces joins.</strong> When retrieving data from multiple tables, the database must <strong>combine them using JOIN operations</strong>, which can slow down queries as the dataset grows.</p>

<pre><code>SELECT o.order_id, u.name, u.email, o.product, o.amount
FROM orders o
JOIN users u ON o.user_id = u.user_id;
</code></pre>

<p><strong>Denormalization</strong> reduces the number of joins by combining related data into a single table, even if it means some data gets duplicated.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!RPfd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92757591-63fa-4a56-a7cc-e65b739b057a_1750x1398.png"><img src="https://substackcdn.com/image/fetch/$s_!RPfd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F92757591-63fa-4a56-a7cc-e65b739b057a_1750x1398.png" alt=""/></a></p>

<p><strong>Example:</strong> Instead of keeping <code>Users</code> and <code>Orders</code> in separate tables, we create <code>UserOrders</code> table that stores user details along with their latest orders.</p>

<p>Now, when retrieving a user’s order history, we don’t need a <strong>JOIN operation</strong>—the data is already stored together leading to faster queries and better read performance.</p>

<pre><code>SELECT order_id, user_name AS name, user_email AS email, product, amount
FROM orders;
</code></pre>

<p>Denormalization is often used in read-heavy applications where speed is more critical but the downside is it leads to <strong>increases storage usage</strong> and more <strong>complex update requests</strong>.</p>

<hr/>

<h2 id="21-cap-theorem" id="21-cap-theorem"><strong>21.</strong> CAP Theorem</h2>

<p>As we scale our system across multiple <strong>servers, databases, and data centers</strong>, we enter the world of <strong>distributed systems</strong>.</p>

<p>One of the fundamental principles of distributed systems is the <strong>CAP Theorem</strong>, which states that: No distributed system can achieve all three of the following at the same time:</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!-Rqf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd38a5f6-aca6-44e9-aa69-321ed4b04e03_1138x904.png"><img src="https://substackcdn.com/image/fetch/$s_!-Rqf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcd38a5f6-aca6-44e9-aa69-321ed4b04e03_1138x904.png" alt=""/></a></p>
<ul><li><strong>Consistency ©</strong> <strong>→</strong> Every node always returns the <strong>most recent data</strong>.</li>
<li><strong>Availability (A)</strong> <strong>→</strong> The system <strong>always responds</strong> to requests, even if some nodes are down (but the data may not be the latest).</li>
<li><strong>Partition Tolerance (P)</strong> <strong>→</strong> The system continues operating even if there’s a <strong>network failure</strong> between nodes.</li></ul>

<p>Since <strong>network failures (P) are inevitable</strong>, we must choose between:</p>
<ul><li><strong>Consistency + Partition Tolerance (CP)</strong> → Ensures every request gets the latest data but may reject requests during failures. Example: <strong>SQL databases like MySQL</strong>.</li>
<li><strong>Availability + Partition Tolerance (AP)</strong> → Ensures the system always responds, even if some data is stale. Example: <strong>NoSQL databases like Cassandra and DynamoDB</strong>.</li></ul>

<p>To learn more about CAP theorem, check out this article:</p>

<p><a href="https://blog.algomaster.io/p/cap-theorem-explained"><img src="https://substackcdn.com/image/fetch/$s_!92J7!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78cd131d-3a18-4c4d-88e1-18834b191ef2_1138x904.png" alt="CAP Theorem Explained"/></a></p>

<h4 id="cap-theorem-explained-https-blog-algomaster-io-p-cap-theorem-explained" id="cap-theorem-explained-https-blog-algomaster-io-p-cap-theorem-explained"><strong><a href="https://blog.algomaster.io/p/cap-theorem-explained">CAP Theorem Explained</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>July 31, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/cap-theorem-explained">Read full story</a></strong></p>

<p>In distributed NoSQL databases, achieving <strong>instant consistency</strong> across all servers <strong>is too slow</strong>.</p>

<p>Instead, we use <strong>Eventual Consistency</strong>—which means:</p>
<ul><li><strong>Not all nodes are updated instantly</strong>, but given enough time, they <strong>eventually</strong> sync and return the same data.</li>
<li>This allows the system to remain <strong>highly available and fast</strong>, even under extreme loads.</li></ul>

<p><strong>How Eventual Consistency Works:</strong></p>
<ol><li><p>A user updates data in <strong>one replica</strong> of the database.</p></li>

<li><p>The system <strong>immediately</strong> acknowledges the update, ensuring <strong>high availability</strong>.</p></li>

<li><p>The update is then <strong>propagated asynchronously to other replicas</strong>.</p></li>

<li><p>After a short delay, all replicas have the latest data, ensuring <strong>consistency over time</strong>.</p></li></ol>

<hr/>

<h2 id="22-blob-storage" id="22-blob-storage"><strong>22. Blob Storage</strong></h2>

<p>Most modern applications don’t just store text records, they also need to handle <strong>images</strong>, <strong>videos</strong>, <strong>pdfs</strong> and other <strong>large files</strong>.</p>

<p>But here’s the problem: <strong>Traditional databases are not designed to store large, unstructured files efficiently</strong>.</p>

<p><em><strong>So, what’s the solution?</strong></em></p>

<p>We use <strong>Blob Storage like Amazon S3</strong>—a <strong>highly scalable and cost-effective</strong> way to store <strong>large, unstructured files</strong> in the cloud.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!YYzQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc338f10-3918-49f5-a828-fced5e905acb_298x306.png"><img src="https://substackcdn.com/image/fetch/$s_!YYzQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc338f10-3918-49f5-a828-fced5e905acb_298x306.png" alt=""/></a></p>

<p>Blobs are the individual files like images, videos or documents.</p>

<p>These blobs are stored inside <strong>logical containers or buckets</strong> in the cloud.</p>

<p>Each file gets a <strong>unique URL</strong>, making it easy to retrieve and serve over the web.</p>

<blockquote><p><strong>Example:</strong> <a href="https://my-bucket-name.s3.amazonaws.com/videos/tutorial.mp4">https://my-bucket-name.s3.amazonaws.com/videos/tutorial.mp4</a></p></blockquote>

<p>There are several advantages with using blob storage like:</p>
<ul><li><strong>Scalability</strong> → It can store petabytes of data effortlessly.</li>
<li><strong>Pay-as-you-go pricing</strong> → You only pay for storage and retrieval that you actually use.</li>
<li><strong>Automatic replication</strong> → Data is copied across multiple data centers and availability zones for durability.</li>
<li><strong>Easy access</strong> → Files can be retrieved using REST APIs or direct URLs.</li></ul>

<p>A common use case is to stream audio or video files to user application in real-time.</p>

<p>But streaming directly from blob-storage can be slow, especially if the data is stored in a <strong>distant location</strong>.</p>

<hr/>

<h2 id="23-cdn" id="23-cdn"><strong>23. CDN</strong></h2>

<p>For example, imagine you’re in <strong>India</strong> trying to watch a YouTube video that’s hosted on a server in <strong>California</strong>.</p>

<p>Since the video data has to <strong>travel across the world</strong>, this could lead to <strong>buffering and slow load times</strong>.</p>

<p>A <strong>Content Delivery Network (or CDN)</strong> solves this problem by <strong>delivering content faster</strong> to users based on their location.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!sN05!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa09696e9-f98e-47bd-9eb9-08a20c60464d_5667x2834.png"><img src="https://substackcdn.com/image/fetch/$s_!sN05!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa09696e9-f98e-47bd-9eb9-08a20c60464d_5667x2834.png" alt="Map of globally distributed servers serving content - What is a CDN" title="Map of globally distributed servers serving content - What is a CDN"/></a></p>

<p>source: <a href="https://www.cloudflare.com/learning/cdn/what-is-a-cdn/">https://www.cloudflare.com/learning/cdn/what-is-a-cdn/</a></p>

<p>A CDN is a global network of distributed servers that work together to deliver <strong>web content</strong> (like HTML pages, JavaScript files, stylesheets, images, and videos) to users based on their <strong>geographic location</strong>.</p>

<p>Instead of serving content from a <strong>single data center</strong>, a CDN <strong>caches static contents</strong> on multiple <strong>edge servers located worldwide</strong>.</p>

<p>When a user requests content, the <strong>nearest CDN server</strong> delivers it instead of reaching all the way to the <strong>origin server</strong>.</p>

<p>Since content is served from the <strong>closest CDN node</strong>, users experience <strong>faster load times</strong> with minimal buffering.</p>

<p>To learn more about CDN, check out this article:</p>

<p><a href="https://blog.algomaster.io/p/content-delivery-networks"><img src="https://substackcdn.com/image/fetch/$s_!fUV6!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc1ef9c83-5fd9-46e3-8469-c2a43f8b7dd2_1670x1046.png" alt="What is a Content Delivery Network?"/></a></p>

<h4 id="what-is-a-content-delivery-network-https-blog-algomaster-io-p-content-delivery-networks" id="what-is-a-content-delivery-network-https-blog-algomaster-io-p-content-delivery-networks"><strong><a href="https://blog.algomaster.io/p/content-delivery-networks">What is a Content Delivery Network?</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>March 4, 2025</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/content-delivery-networks">Read full story</a></strong></p>

<hr/>

<h2 id="24-websockets" id="24-websockets"><strong>24. WebSockets</strong></h2>

<p>Most web applications use <strong>HTTP</strong>, which follows a <strong>request-response</strong> model.</p>
<ol><li><p>The client sends a request.</p></li>

<li><p>The <strong>server</strong> processes the request and sends a response.</p></li>

<li><p>If the client needs new data, it must <strong>send another request</strong>.</p></li></ol>

<p>This works fine for <strong>static web pages</strong> but it’s <strong>too slow and inefficient for real-time applications</strong> like: live chat apps, stock market dashboards and online multiplayer games.</p>

<p>With HTTP, the only way to get real-time updates is through <strong>polling</strong>—sending repeated requests every few seconds.</p>

<p>But polling is inefficient because it increases server load and wastes bandwidth, as <strong>most responses are empty</strong> (when there’s no new data).</p>

<p>WebSockets solve this problem by allowing <strong>continuous, two-way communication</strong> between the <strong>client and server</strong> over a <strong>single persistent connection</strong>.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!5FHd!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57a93491-9dae-4a6d-a661-81ff1437c256_1071x969.png"><img src="https://substackcdn.com/image/fetch/$s_!5FHd!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F57a93491-9dae-4a6d-a661-81ff1437c256_1071x969.png" alt=""/></a></p>

<p>Here is how WebSockets work:</p>
<ol><li><p>The <strong>client initiates a WebSocket connection</strong> with the server.</p></li>

<li><p>Once established, the connection <strong>remains open</strong>.</p></li>

<li><p><strong>The server can push updates</strong> to the client <strong>at any time</strong>, without waiting for a request.</p></li>

<li><p>The client can also send messages <strong>instantly to the server.</strong></p></li></ol>

<p>This enables real-time interactions and eliminates the need for polling.</p>

<p>To learn more about WebSockets, check out this article:</p>

<p><a href="https://blog.algomaster.io/p/websockets"><img src="https://substackcdn.com/image/fetch/$s_!yu18!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bde57be-682f-4254-944b-bcade624e544_1008x908.png" alt="What are WebSockets and Why are they Used?"/></a></p>

<h4 id="what-are-websockets-and-why-are-they-used-https-blog-algomaster-io-p-websockets" id="what-are-websockets-and-why-are-they-used-https-blog-algomaster-io-p-websockets"><strong><a href="https://blog.algomaster.io/p/websockets">What are WebSockets and Why are they Used?</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>August 28, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/websockets">Read full story</a></strong></p>

<p>WebSockets enable real-time communication between a client and a server, <em><strong>but what if a server needs to notify another server when an event occurs?</strong></em></p>

<p>Example:</p>
<ul><li>When a user makes a payment, Stripe needs to notify your application <strong>instantly</strong>.</li>
<li>If someone pushes code to GitHub, a CI/CD system (e.g., Jenkins) should be triggered automatically.</li></ul>

<p>Enter Webhooks.</p>

<hr/>

<h2 id="25-webhooks" id="25-webhooks"><strong>25. Webhooks</strong></h2>

<p>Instead of constantly <strong>polling an API</strong> to check if an event has occured, <strong>Webhooks</strong> allow a server to <strong>send an HTTP request</strong> to another server as soon as the event occurs.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!Bipe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa833712f-f11d-4d48-b0b4-47e5616c8351_1890x766.png"><img src="https://substackcdn.com/image/fetch/$s_!Bipe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa833712f-f11d-4d48-b0b4-47e5616c8351_1890x766.png" alt=""/></a></p>

<p>Here’s how it works:</p>
<ul><li>The <strong>receiver (your app)</strong> registers a webhook URL with the <strong>provider (e.g., Stripe, GitHub, Twilio)</strong>.</li>
<li>When an event occurs (e.g., user makes a payment), the <strong>provider sends an HTTP POST request to the webhook URL</strong> with event details.</li>
<li>Your app <strong>processes the incoming request</strong> and updates data accordingly.</li></ul>

<p>This saves server resources and reduces unnecessary API calls.</p>

<hr/>

<h2 id="26-microservices" id="26-microservices"><strong>26. Microservices</strong></h2>

<p>Traditionally, applications were built using a <strong>monolithic architecture</strong>, where:</p>
<ul><li>All features (e.g., authentication, payments, orders, shipping) are inside <strong>one large codebase</strong>.</li>
<li>If one part of the system <strong>fails or needs scaling</strong>, the <strong>entire system</strong> is affected.</li>
<li><strong>Deployment is risky</strong>—one bad update can take down the entire app.</li></ul>

<p><strong>Example:</strong> Imagine an e-commerce app where the <strong>order</strong>, <strong>payment, inventory</strong>, and <strong>shipping</strong> modules are all tightly connected in a <strong>single codebase</strong>.</p>

<p>If the inventory system crashes, the entire app could go down.</p>

<p>Monoliths work <strong>fine for small applications</strong>, but for <strong>large-scale systems</strong>, they become <strong>hard to manage, scale, and deploy</strong>.</p>

<p>The solution is to break down your application into smaller, independent services called <strong>micro-services</strong> that work together.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!N6tU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b2ef6df-0f55-4663-ad2a-7f8a11121753_2136x826.png"><img src="https://substackcdn.com/image/fetch/$s_!N6tU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9b2ef6df-0f55-4663-ad2a-7f8a11121753_2136x826.png" alt=""/></a></p>

<p>Each <strong>microservice</strong>:</p>
<ol><li><p>Handles <strong>a single responsibility</strong></p></li>

<li><p>Has its <strong>own database and logic</strong>, so it can scale <strong>independently</strong>.</p></li>

<li><p>Communicates with other microservices using <strong>APIs or message queues</strong>.</p></li></ol>

<p>This way services can be scaled and deployed individually without affecting the entire system.</p>

<p>However, when multiple microservices need to communicate, direct <strong>API calls</strong> aren’t always efficient—this is where <strong>Message Queues</strong> come in.</p>

<hr/>

<h2 id="27-message-queues" id="27-message-queues"><strong>27. Message Queues</strong></h2>

<p>In a <strong>monolithic system</strong>, functions call each other <strong>directly</strong> and wait for a response.</p>

<p>But in a <strong>microservices-based system</strong>, this approach is inefficient because:</p>
<ul><li>If one service is <strong>slow</strong> or <strong>down</strong>, everything waits.</li>
<li>High traffic can <strong>overload</strong> a single service.</li>
<li><strong>Synchronous communication</strong> (waiting for immediate responses) doesn’t scale well.</li></ul>

<p>A <strong>Message Queue</strong> enables services to <strong>communicate asynchronously</strong>, allowing requests to be processed <strong>without blocking</strong> other operations.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!uKwi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d148e2f-f1a4-4b94-8027-fa19ea6b5c61_1590x728.png"><img src="https://substackcdn.com/image/fetch/$s_!uKwi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3d148e2f-f1a4-4b94-8027-fa19ea6b5c61_1590x728.png" alt=""/></a></p>

<p><strong>Here’s How It Works:</strong></p>
<ol><li><p>A <strong>producer</strong> (e.g., checkout service) <strong>places a message in the queue</strong> (e.g., “Process Payment”).</p></li>

<li><p>The <strong>queue temporarily holds the message</strong> until a <strong>consumer</strong> (e.g., payment service) is ready to process it.</p></li>

<li><p>The <strong>consumer retrieves the message</strong> and processes it.</p></li></ol>

<p>Using message queues, we can decouple services and improve the scalability and fault tolerance.</p>

<blockquote><p>Common message queue systems include: Apache Kafka, Amazon SQS and RabbitMQ.</p></blockquote>

<p>To learn more about Message Queues, check out this article:</p>

<p><a href="https://blog.algomaster.io/p/message-queues"><img src="https://substackcdn.com/image/fetch/$s_!hW_t!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2a5f36fe-a10e-4b34-924c-5f32fd65adda_1194x764.png" alt="What are Message Queues and When to Use Them?"/></a></p>

<h4 id="what-are-message-queues-and-when-to-use-them-https-blog-algomaster-io-p-message-queues" id="what-are-message-queues-and-when-to-use-them-https-blog-algomaster-io-p-message-queues"><strong><a href="https://blog.algomaster.io/p/message-queues">What are Message Queues and When to Use Them?</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>August 18, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/message-queues">Read full story</a></strong></p>

<p>Using message queues, we can prevent overload on internal services within our system.</p>

<p><em><strong>But, how do we prevent overload for the public APIs and services we deploy.</strong></em></p>

<p>We use <strong>rate limiting</strong>.</p>

<hr/>

<h2 id="28-rate-limiting" id="28-rate-limiting"><strong>28. Rate Limiting</strong></h2>

<p>Imagine a <strong>bot starts making thousands of requests per second</strong> to your website.</p>

<p>Without restrictions, this could:</p>
<ul><li><strong>Crash your servers</strong> by consuming all available resources.</li>
<li><strong>Increase cloud costs</strong> due to excessive API usage.</li>
<li>and <strong>degrade performance</strong> for legitimate users.</li></ul>

<p>Rate Limiting <strong>restricts the number of requests</strong> a client can send within a specific time frame.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!H4QU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6c2b184-bb2e-421a-bf4d-03bd8bb80840_1704x436.png"><img src="https://substackcdn.com/image/fetch/$s_!H4QU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6c2b184-bb2e-421a-bf4d-03bd8bb80840_1704x436.png" alt=""/></a></p>

<p><strong>Here’s How It Works:</strong></p>
<ol><li><p>Every user or IP address is assigned a <strong>request quota</strong> (e.g., <strong>100 requests per minute</strong>).</p></li>

<li><p>If they <strong>exceed this limit</strong>, the server <strong>blocks additional requests temporarily</strong> and <strong>returns an error (HTTP 429 – Too Many Requests)</strong>.</p></li></ol>

<p>There are various rate limiting algorithms. Some of the popular ones are:</p>
<ul><li><strong>Fixed Window</strong> → Limits requests based on a fixed time window (e.g., 100 requests per minute).</li>
<li><strong>Sliding Window</strong> → More flexible version that dynamically adjusts limits to smooth out request bursts.</li>
<li><strong>Token Bucket</strong> → Users get <strong>tokens</strong> for requests, which <strong>replenish over time</strong> at a fixed rate.</li></ul>

<p>To learn more about rate limiting algorithms, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/rate-limiting-algorithms-explained-with-code"><img src="https://substackcdn.com/image/fetch/$s_!vVHH!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0815d30e-dc9c-4ff4-9eb8-ac76d21ba52d_1048x684.png" alt="Rate Limiting Algorithms Explained with Code"/></a></p>

<h4 id="rate-limiting-algorithms-explained-with-code-https-blog-algomaster-io-p-rate-limiting-algorithms-explained-with-code" id="rate-limiting-algorithms-explained-with-code-https-blog-algomaster-io-p-rate-limiting-algorithms-explained-with-code"><strong><a href="https://blog.algomaster.io/p/rate-limiting-algorithms-explained-with-code">Rate Limiting Algorithms Explained with Code</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>July 17, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/rate-limiting-algorithms-explained-with-code">Read full story</a></strong></p>

<p>We don’t need to implement our own rate limiting system – this can be handled by something called an <strong>API gateway</strong>.</p>

<hr/>

<h2 id="29-api-gateways" id="29-api-gateways"><strong>29. API Gateways</strong></h2>

<p>An API Gateway is a <strong>centralized service</strong> that handles <strong>authentication, rate limiting, logging and monitoring, and request routing</strong>.</p>

<p>Imagine a <strong>microservices-based application</strong> with multiple services.</p>

<p>Instead of exposing each service <strong>directly</strong>, an <strong>API Gateway</strong> acts as a <strong>single entry point</strong> for all client requests.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!_AFR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2f627d6-6141-413f-a528-4726d8869a0b_2218x1166.png"><img src="https://substackcdn.com/image/fetch/$s_!_AFR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb2f627d6-6141-413f-a528-4726d8869a0b_2218x1166.png" alt=""/></a></p>

<p><strong>How API Gateways Work:</strong></p>
<ol><li><p>The <strong>client sends a request</strong> to the API Gateway.</p></li>

<li><p>The Gateway <strong>validates the request</strong> (e.g., authentication, rate limits).</p></li>

<li><p>It <strong>routes the request</strong> to the appropriate micro-service.</p></li>

<li><p>The response is sent back <strong>through the Gateway</strong> to the client.</p></li></ol>

<p>API gateway simplifies API management and improves scalability and security.</p>

<blockquote><p>Popular API Gateway solutions include <strong>NGINX, Kong and AWS API Gateway.</strong></p></blockquote>

<p>If you want to learn more about API gateways, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/what-is-an-api-gateway"><img src="https://substackcdn.com/image/fetch/$s_!_ZNj!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcb0c8192-4b1b-4834-b068-20d8cfb65050_1856x1412.png" alt="What is an API Gateway?"/></a></p>

<h4 id="what-is-an-api-gateway-https-blog-algomaster-io-p-what-is-an-api-gateway" id="what-is-an-api-gateway-https-blog-algomaster-io-p-what-is-an-api-gateway"><strong><a href="https://blog.algomaster.io/p/what-is-an-api-gateway">What is an API Gateway?</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>December 8, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/what-is-an-api-gateway">Read full story</a></strong></p>

<hr/>

<h2 id="30-idempotency" id="30-idempotency"><strong>30. Idempotency</strong></h2>

<p>In distributed systems, <strong>network failures</strong> and <strong>service retries</strong> are common. If a user <strong>accidentally refreshes a payment page</strong>, the system might receive <strong>two payment requests</strong> instead of one.</p>

<p><a href="https://substackcdn.com/image/fetch/$s_!czYH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F637607fe-3d2c-49db-be80-3d247bea6ab8_1212x394.png"><img src="https://substackcdn.com/image/fetch/$s_!czYH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F637607fe-3d2c-49db-be80-3d247bea6ab8_1212x394.png" alt=""/></a></p>

<p>Idempotency ensures that <strong>repeated requests</strong> produce the <strong>same result</strong> as if the request was made <strong>only once</strong>.</p>

<p><strong>Here’s how it works:</strong></p>
<ol><li><p>Each request is assigned a <strong>unique ID</strong> (e.g., <code>request_1234</code>).</p></li>

<li><p>Before processing, the system checks if the request <strong>has already been handled</strong>.</p></li>

<li><p>If yes → It <strong>ignores the duplicate request</strong>.</p></li>

<li><p>If no → It <strong>processes the request normally</strong>.</p></li></ol>

<p>Idempotency prevents duplicate transactions and ensures data consistency in distributed systems.</p>

<p>If you want to learn more about idempotency, checkout this article:</p>

<p><a href="https://blog.algomaster.io/p/idempotency-in-distributed-systems"><img src="https://substackcdn.com/image/fetch/$s_!yjks!,w_140,h_140,c_fill,f_auto,q_auto:good,fl_progressive:steep,g_auto/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F538d3bda-046f-48f0-b62d-730327bf3bd7_954x696.png" alt="What is Idempotency in Distributed Systems?"/></a></p>

<h4 id="what-is-idempotency-in-distributed-systems-https-blog-algomaster-io-p-idempotency-in-distributed-systems" id="what-is-idempotency-in-distributed-systems-https-blog-algomaster-io-p-idempotency-in-distributed-systems"><strong><a href="https://blog.algomaster.io/p/idempotency-in-distributed-systems">What is Idempotency in Distributed Systems?</a></strong></h4>

<p><strong><a href="https://substack.com/profile/83602743-ashish-pratap-singh">Ashish Pratap Singh</a></strong></p>

<p>·</p>

<p><strong>November 3, 2024</strong></p>

<p><strong><a href="https://blog.algomaster.io/p/idempotency-in-distributed-systems">Read full story</a></strong></p>

<hr/>

<p>Thank you so much for reading!</p>

<p>If you found it valuable, hit a like ❤️ and consider subscribing for more such content every week.</p>

<p>This post is public so feel free to share it.</p>

<p><strong><a href="https://blog.algomaster.io/p/30-system-design-concepts?utm_source=substack&amp;utm_medium=email&amp;utm_content=share&amp;action=share">Share</a></strong></p>

<hr/>

<p><strong>P.S.</strong> If you’re enjoying this newsletter and want to get even more value, consider becoming a <strong><a href="https://blog.algomaster.io/subscribe">paid subscriber</a></strong>.</p>

<p>As a paid subscriber, you&#39;ll unlock all <strong>premium articles</strong> and gain full access to all <strong><a href="https://algomaster.io/newsletter/paid/resources">premium courses</a></strong> on <strong><a href="https://algomaster.io/">algomaster.io</a></strong>.</p>
]]></content:encoded>
      <guid>https://christova.writeas.com/system-design-concepts</guid>
      <pubDate>Wed, 29 Apr 2026 00:44:29 +0000</pubDate>
    </item>
    <item>
      <title>YouTube System Design</title>
      <link>https://christova.writeas.com/youtube-system-design?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[&#xA;&#xA;#YouTube #SystemDesign&#xA;&#xA;🔹 1. User Interaction&#xA;Users engage via Web/App, where they search, watch, upload, comment, like, and subscribe. A robust engagement system ensures real-time updates.&#xA;&#xA;🔹 2. Video Processing&#xA;Uploaded videos go through a Video Encoding Pipeline, enabling adaptive bitrate streaming for smooth playback across devices. Metadata is extracted to optimize search and recommendations.&#xA;&#xA;🔹 3. Content Distribution&#xA;A global CDN (Content Delivery Network) and Edge Servers cache and serve videos efficiently, reducing load times and enhancing playback performance. Traffic Management Layers balance load dynamically.&#xA;&#xA;🔹 4. Recommendation System&#xA;AI-powered Machine Learning Pipelines analyze user behavior to suggest highly relevant videos, boosting engagement and retention.&#xA;&#xA;🔹 5. Monetization&#xA;YouTube leverages Google Ads for targeted advertising while revenue-sharing with creators. Premium subscriptions offer ad-free experiences and exclusive content.&#xA;&#xA;🔹 6. Security &amp; Compliance&#xA;Copyright Detection, Content ID, and Moderation Systems safeguard creators’ content and ensure platform integrity while filtering inappropriate material.&#xA;&#xA;🎯 The Outcome?&#xA;A fault-tolerant, AI-driven, and scalable architecture that delivers seamless content consumption at an unprecedented scale! 🌍📺]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://i.snap.as/TOxXbWJ2.gif" alt=""/></p>

<p><a href="https://christova.writeas.com/tag:YouTube" class="hashtag"><span>#</span><span class="p-category">YouTube</span></a> <a href="https://christova.writeas.com/tag:SystemDesign" class="hashtag"><span>#</span><span class="p-category">SystemDesign</span></a></p>

<p>🔹 1. User Interaction
Users engage via Web/App, where they search, watch, upload, comment, like, and subscribe. A robust engagement system ensures real-time updates.</p>

<p>🔹 2. Video Processing
Uploaded videos go through a Video Encoding Pipeline, enabling adaptive bitrate streaming for smooth playback across devices. Metadata is extracted to optimize search and recommendations.</p>

<p>🔹 3. Content Distribution
A global CDN (Content Delivery Network) and Edge Servers cache and serve videos efficiently, reducing load times and enhancing playback performance. Traffic Management Layers balance load dynamically.</p>

<p>🔹 4. Recommendation System
AI-powered Machine Learning Pipelines analyze user behavior to suggest highly relevant videos, boosting engagement and retention.</p>

<p>🔹 5. Monetization
YouTube leverages Google Ads for targeted advertising while revenue-sharing with creators. Premium subscriptions offer ad-free experiences and exclusive content.</p>

<p>🔹 6. Security &amp; Compliance
Copyright Detection, Content ID, and Moderation Systems safeguard creators’ content and ensure platform integrity while filtering inappropriate material.</p>

<p>🎯 The Outcome?
A fault-tolerant, AI-driven, and scalable architecture that delivers seamless content consumption at an unprecedented scale! 🌍📺</p>
]]></content:encoded>
      <guid>https://christova.writeas.com/youtube-system-design</guid>
      <pubDate>Sun, 29 Mar 2026 03:33:34 +0000</pubDate>
    </item>
    <item>
      <title>SOLID Principles</title>
      <link>https://christova.writeas.com/solid-principles-k0qk?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[&#xA;&#xA;#solid #designprinciples #designpatterns #systemdesign&#xA;&#xA;𝐒 - 𝐒𝐢𝐧𝐠𝐥𝐞 𝐑𝐞𝐬𝐩𝐨𝐧𝐬𝐢𝐛𝐢𝐥𝐢𝐭𝐲 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞&#xA;A class should have only one reason to change.&#xA;\- Example: Instead of one giant User class that handles authentication, profile updates, and sending emails, split it into UserAuth, UserProfile, and EmailService.&#xA;&#xA;𝐎 - 𝐎𝐩𝐞𝐧/𝐂𝐥𝐨𝐬𝐞𝐝 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞&#xA;Classes should be open for extension but closed for modification.&#xA;\- Example: Define a Shape interface with an area() method. When you need a new shape, just add a Circle or Triangle class that implements it.&#xA;&#xA;𝐋 - 𝐋𝐢𝐬𝐤𝐨𝐯 𝐒𝐮𝐛𝐬𝐭𝐢𝐭𝐮𝐭𝐢𝐨𝐧 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞&#xA;Subtypes must be substitutable for their base types without breaking behavior.&#xA;\- Example: If Bird has a fly() method, then Eagle and Sparrow should both work anywhere a Bird is expected.&#xA;&#xA;𝐈 - 𝐈𝐧𝐭𝐞𝐫𝐟𝐚𝐜𝐞 𝐒𝐞𝐠𝐫𝐞𝐠𝐚𝐭𝐢𝐨𝐧 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞&#xA;Don&#39;t force classes to implement interfaces they don&#39;t use.&#xA;\- Example: Instead of one fat Machine interface with print(), scan(), and fax(), break it into Printable, Scannable, and Faxable. A SimplePrinter only implements Printable.&#xA;&#xA;𝐃 - 𝐃𝐞𝐩𝐞𝐧𝐝𝐞𝐧𝐜𝐲 𝐈𝐧𝐯𝐞𝐫𝐬𝐢𝐨𝐧 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞&#xA;High-level modules should not depend on low-level modules. Both should depend on abstractions.&#xA;\- Example: Your OrderService should depend on a PaymentGateway interface, not directly on Stripe or PayPal.&#xA;&#xA;The real power of SOLID is not in following each principle in isolation. It&#39;s in how they work together to make your code easier to change, test, and extend.]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://i.snap.as/03Fhn8Zu.jpg" alt=""/></p>

<p><a href="https://christova.writeas.com/tag:solid" class="hashtag"><span>#</span><span class="p-category">solid</span></a> <a href="https://christova.writeas.com/tag:designprinciples" class="hashtag"><span>#</span><span class="p-category">designprinciples</span></a> <a href="https://christova.writeas.com/tag:designpatterns" class="hashtag"><span>#</span><span class="p-category">designpatterns</span></a> <a href="https://christova.writeas.com/tag:systemdesign" class="hashtag"><span>#</span><span class="p-category">systemdesign</span></a></p>

<p>𝐒 – 𝐒𝐢𝐧𝐠𝐥𝐞 𝐑𝐞𝐬𝐩𝐨𝐧𝐬𝐢𝐛𝐢𝐥𝐢𝐭𝐲 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞
A class should have only one reason to change.
- Example: Instead of one giant User class that handles authentication, profile updates, and sending emails, split it into UserAuth, UserProfile, and EmailService.</p>

<p>𝐎 – 𝐎𝐩𝐞𝐧/𝐂𝐥𝐨𝐬𝐞𝐝 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞
Classes should be open for extension but closed for modification.
- Example: Define a Shape interface with an area() method. When you need a new shape, just add a Circle or Triangle class that implements it.</p>

<p>𝐋 – 𝐋𝐢𝐬𝐤𝐨𝐯 𝐒𝐮𝐛𝐬𝐭𝐢𝐭𝐮𝐭𝐢𝐨𝐧 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞
Subtypes must be substitutable for their base types without breaking behavior.
- Example: If Bird has a fly() method, then Eagle and Sparrow should both work anywhere a Bird is expected.</p>

<p>𝐈 – 𝐈𝐧𝐭𝐞𝐫𝐟𝐚𝐜𝐞 𝐒𝐞𝐠𝐫𝐞𝐠𝐚𝐭𝐢𝐨𝐧 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞
Don&#39;t force classes to implement interfaces they don&#39;t use.
- Example: Instead of one fat Machine interface with print(), scan(), and fax(), break it into Printable, Scannable, and Faxable. A SimplePrinter only implements Printable.</p>

<p>𝐃 – 𝐃𝐞𝐩𝐞𝐧𝐝𝐞𝐧𝐜𝐲 𝐈𝐧𝐯𝐞𝐫𝐬𝐢𝐨𝐧 𝐏𝐫𝐢𝐧𝐜𝐢𝐩𝐥𝐞
High-level modules should not depend on low-level modules. Both should depend on abstractions.
- Example: Your OrderService should depend on a PaymentGateway interface, not directly on Stripe or PayPal.</p>

<p>The real power of SOLID is not in following each principle in isolation. It&#39;s in how they work together to make your code easier to change, test, and extend.</p>
]]></content:encoded>
      <guid>https://christova.writeas.com/solid-principles-k0qk</guid>
      <pubDate>Thu, 26 Mar 2026 16:53:06 +0000</pubDate>
    </item>
    <item>
      <title>12 Essential Programmer Concepts</title>
      <link>https://christova.writeas.com/12-essential-programmer-concepts?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[&#xA;&#xA;#programmingconcepts #systemdesign #security #coding #datastructures #algorithms #networking #versioncontrol #git #databases #api #agile&#xA;&#xA;These comprehensive set of concepts forms a strong foundation for programmers, covering a range of skills from programming fundamentals to system design and security considerations.&#xA;&#xA;1. Introduction to Programming Languages:&#xA;A foundational understanding of at least one programming language (e.g., Python, Java, C++), enabling the ability to comprehend and switch between languages as needed.&#xA;&#xA;2. Data Structures Mastery:&#xA;Proficiency in fundamental data structures such as arrays, linked lists, stacks, queues, trees, and graphs, essential for effective algorithmic problem solving.&#xA;&#xA;3. Algorithms Proficiency:&#xA;Familiarity with common algorithms and problem solving techniques, including sorting, searching, and dynamic programming, to optimise code efficiency.&#xA;\\&#xA;4\. Database Systems Knowledge:\\&#xA;Understanding of database systems, covering relational databases (e.g., SQL) and NoSQL databases (e.g., MongoDB), crucial for efficient data storage and retrieval.&#xA;&#xA;5. Version Control Mastery:&#xA;Proficiency with version control systems like Git, encompassing skills in branching, merging, and collaboration workflows for effective team development.&#xA;&#xA;6. Agile Methodology Understanding:&#xA;Knowledge of the Agile Software Development Life Cycle (Agile SDLC) principles, emphasizing iterative development, Scrum, and Kanban for adaptable project management.&#xA;&#xA;7. Web Development Basics (Networking):&#xA;Fundamental understanding of networking concepts, including protocols, IP addressing, and HTTP, essential for web development and communication between systems.&#xA;&#xA;8. APIs (Application Programming Interfaces) Expertise:&#xA;Understanding how to use and create APIs, critical for integrating different software systems and enabling seamless communication between applications.&#xA;&#xA;9. Testing and Debugging Skills:&#xA;Proficiency in testing methodologies, unit testing, and debugging techniques to ensure code quality and identify and fix errors effectively.&#xA;&#xA;10. Design Patterns Familiarity:&#xA;Knowledge of common design patterns in object-oriented programming, aiding in solving recurring design problems and enhancing code maintainability.&#xA;&#xA;11. System Design Principles:&#xA;Understanding of system design, including architectural patterns, scalability, and reliability, to create robust and efficient software systems.&#xA;&#xA;12. Security Awareness:&#xA;Fundamental knowledge of security principles, including encryption, authentication, and best practices for securing applications and data.&#xA;&#xA;Other areas could be OS, containers, concurrency and parallelism , basic web development etc.]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://i.snap.as/HeIIWHFK.jpg" alt=""/></p>

<p><a href="https://christova.writeas.com/tag:programmingconcepts" class="hashtag"><span>#</span><span class="p-category">programmingconcepts</span></a> <a href="https://christova.writeas.com/tag:systemdesign" class="hashtag"><span>#</span><span class="p-category">systemdesign</span></a> <a href="https://christova.writeas.com/tag:security" class="hashtag"><span>#</span><span class="p-category">security</span></a> <a href="https://christova.writeas.com/tag:coding" class="hashtag"><span>#</span><span class="p-category">coding</span></a> <a href="https://christova.writeas.com/tag:datastructures" class="hashtag"><span>#</span><span class="p-category">datastructures</span></a> <a href="https://christova.writeas.com/tag:algorithms" class="hashtag"><span>#</span><span class="p-category">algorithms</span></a> <a href="https://christova.writeas.com/tag:networking" class="hashtag"><span>#</span><span class="p-category">networking</span></a> <a href="https://christova.writeas.com/tag:versioncontrol" class="hashtag"><span>#</span><span class="p-category">versioncontrol</span></a> <a href="https://christova.writeas.com/tag:git" class="hashtag"><span>#</span><span class="p-category">git</span></a> <a href="https://christova.writeas.com/tag:databases" class="hashtag"><span>#</span><span class="p-category">databases</span></a> <a href="https://christova.writeas.com/tag:api" class="hashtag"><span>#</span><span class="p-category">api</span></a> <a href="https://christova.writeas.com/tag:agile" class="hashtag"><span>#</span><span class="p-category">agile</span></a></p>

<p>These comprehensive set of concepts forms a strong foundation for programmers, covering a range of skills from programming fundamentals to system design and security considerations.</p>

<p><strong>1. Introduction to Programming Languages:</strong>
A foundational understanding of at least one programming language (e.g., Python, Java, C++), enabling the ability to comprehend and switch between languages as needed.</p>

<p><strong>2. Data Structures Mastery:</strong>
Proficiency in fundamental data structures such as arrays, linked lists, stacks, queues, trees, and graphs, essential for effective algorithmic problem solving.</p>

<p><strong>3. Algorithms Proficiency:</strong>
Familiarity with common algorithms and problem solving techniques, including sorting, searching, and dynamic programming, to optimise code efficiency.
**
4. Database Systems Knowledge:**
Understanding of database systems, covering relational databases (e.g., SQL) and NoSQL databases (e.g., MongoDB), crucial for efficient data storage and retrieval.</p>

<p><strong>5. Version Control Mastery:</strong>
Proficiency with version control systems like Git, encompassing skills in branching, merging, and collaboration workflows for effective team development.</p>

<p><strong>6. Agile Methodology Understanding:</strong>
Knowledge of the Agile Software Development Life Cycle (Agile SDLC) principles, emphasizing iterative development, Scrum, and Kanban for adaptable project management.</p>

<p><strong>7. Web Development Basics (Networking):</strong>
Fundamental understanding of networking concepts, including protocols, IP addressing, and HTTP, essential for web development and communication between systems.</p>

<p><strong>8. APIs (Application Programming Interfaces) Expertise:</strong>
Understanding how to use and create APIs, critical for integrating different software systems and enabling seamless communication between applications.</p>

<p><strong>9. Testing and Debugging Skills:</strong>
Proficiency in testing methodologies, unit testing, and debugging techniques to ensure code quality and identify and fix errors effectively.</p>

<p><strong>10. Design Patterns Familiarity:</strong>
Knowledge of common design patterns in object-oriented programming, aiding in solving recurring design problems and enhancing code maintainability.</p>

<p><strong>11. System Design Principles:</strong>
Understanding of system design, including architectural patterns, scalability, and reliability, to create robust and efficient software systems.</p>

<p><strong>12. Security Awareness:</strong>
Fundamental knowledge of security principles, including encryption, authentication, and best practices for securing applications and data.</p>

<p>Other areas could be OS, containers, concurrency and parallelism , basic web development etc.</p>
]]></content:encoded>
      <guid>https://christova.writeas.com/12-essential-programmer-concepts</guid>
      <pubDate>Thu, 26 Mar 2026 15:10:02 +0000</pubDate>
    </item>
    <item>
      <title>Instagram System Design</title>
      <link>https://christova.writeas.com/instagram-system-design?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[&#xA;&#xA;#instagram #systemdesign&#xA;&#xA;Designing a system like Instagram involves a complex network of components and services. &#xA;&#xA;Below is the overview of the system of Instagram:&#xA;&#xA;Client Interaction: Users interact through mobile or web apps.&#xA;&#xA;Load Balancer: Helps in providing a balance of requests for API gateways.&#xA;&#xA;API Gateways: Gateway to the micro services.&#xA;&#xA;Write Operations: Uploading comments and uploads sent to the App Server, which further validates the request and writes data along with video processing.&#xA;&#xA;Feed Generation Service: Feeds generation and update service for users.&#xA;&#xA;Read Operations: Routes read operations (e.g., view feed) to appropriate service(s).&#xA;&#xA;Metadata Database: Stores user profiles and post metadata.&#xA;&#xA;Caching: Utilises Redis or Memcached for caching, thereby reducing response times and database load.&#xA;&#xA;Search Service (Elastic search): Indexes users and content for quickly returning relevant results.&#xA;&#xA;Blob Storage: Stores user-uploaded media files (e.g., images, videos).&#xA;&#xA;CDN: Caches and serves static content with low latency.&#xA;&#xA;Video Processing: Responsible for transcoding, resizing, and creating thumbnails for all user-uploaded videos.&#xA;&#xA;Activity Feeds: It lets users know about the likes, comments, and interactions.]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://i.snap.as/fhk5x0xu.gif" alt=""/></p>

<p><a href="https://christova.writeas.com/tag:instagram" class="hashtag"><span>#</span><span class="p-category">instagram</span></a> <a href="https://christova.writeas.com/tag:systemdesign" class="hashtag"><span>#</span><span class="p-category">systemdesign</span></a></p>

<p><strong>Designing a system like Instagram involves a complex network of components and services.</strong></p>

<p>Below is the overview of the system of Instagram:</p>

<p><strong>Client Interaction</strong>: Users interact through mobile or web apps.</p>

<p><strong>Load Balancer</strong>: Helps in providing a balance of requests for API gateways.</p>

<p><strong>API Gateways:</strong> Gateway to the micro services.</p>

<p><strong>Write Operations:</strong> Uploading comments and uploads sent to the App Server, which further validates the request and writes data along with video processing.</p>

<p><strong>Feed Generation Service:</strong> Feeds generation and update service for users.</p>

<p><strong>Read Operations</strong>: Routes read operations (e.g., view feed) to appropriate service(s).</p>

<p><strong>Metadata Database</strong>: Stores user profiles and post metadata.</p>

<p><strong>Caching</strong>: Utilises Redis or Memcached for caching, thereby reducing response times and database load.</p>

<p><strong>Search Service (Elastic search)</strong>: Indexes users and content for quickly returning relevant results.</p>

<p><strong>Blob Storage</strong>: Stores user-uploaded media files (e.g., images, videos).</p>

<p><strong>CDN</strong>: Caches and serves static content with low latency.</p>

<p><strong>Video Processing</strong>: Responsible for transcoding, resizing, and creating thumbnails for all user-uploaded videos.</p>

<p><strong>Activity Feeds:</strong> It lets users know about the likes, comments, and interactions.</p>
]]></content:encoded>
      <guid>https://christova.writeas.com/instagram-system-design</guid>
      <pubDate>Thu, 26 Mar 2026 13:17:55 +0000</pubDate>
    </item>
    <item>
      <title>System Design Blueprint</title>
      <link>https://christova.writeas.com/system-design-blueprint?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[&#xA;&#xA;#systemdesign #blueprint]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://i.snap.as/bfyfCEyt.webp" alt=""/></p>

<p><a href="https://christova.writeas.com/tag:systemdesign" class="hashtag"><span>#</span><span class="p-category">systemdesign</span></a> <a href="https://christova.writeas.com/tag:blueprint" class="hashtag"><span>#</span><span class="p-category">blueprint</span></a></p>
]]></content:encoded>
      <guid>https://christova.writeas.com/system-design-blueprint</guid>
      <pubDate>Thu, 26 Mar 2026 07:41:05 +0000</pubDate>
    </item>
    <item>
      <title>System Architecture Patterns</title>
      <link>https://christova.writeas.com/system-architecture-patterns?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[&#xA;&#xA;#architecturepatterns #systemdesign #mvc #microservices #layers #eventdriven&#xA;&#xA;1. Model-View-Controller (MVC):&#xA;&#xA;Overview: The Model-View-Controller (MVC) pattern is a time-honored architectural paradigm that separates an application into three interconnected components:&#xA;&#xA;Model: This component represents the data and business logic of the application. It encapsulates the application’s data structure and the rules for manipulating that data.&#xA;View: Responsible for managing the user interface and displaying information to the user. It receives input from users and sends commands to the controller.&#xA;Controller: The controller handles user input, updates the model, and refreshes the view accordingly. It acts as an intermediary that processes user input and manages the flow of data between the model and the view.&#xA;&#xA;Uses: MVC is widely employed in web development and GUI-based applications, offering a clear separation of concerns and facilitating easier maintenance and development. This architectural pattern enhances modularity, making it easier to scale and maintain applications over time.&#xA;&#xA;How it Works: Consider a web application where a user interacts with a webpage. When the user performs an action, such as clicking a button, the controller captures this input, updates the underlying data model, and triggers a refresh in the view to reflect the changes. This separation of concerns simplifies the development process and enhances the application’s maintainability.&#xA;&#xA;2. Master-Slave:&#xA;&#xA;Overview: The Master-Slave architecture is a distributed computing model where one central entity, the master node, controls and delegates tasks to subordinate entities known as slave nodes.&#xA;&#xA;Master Node: The master node manages the overall state of the system and delegates specific tasks to slave nodes.&#xA;Slave Node: Each slave node operates independently and reports back to the master node after completing its assigned tasks.&#xA;&#xA;Uses: Master-Slave architecture is commonly employed in scenarios where workload distribution, fault tolerance, and parallel processing are critical. This architecture is particularly useful in data-intensive applications and distributed computing systems.&#xA;&#xA;How it Works: Consider a scenario where a master node is responsible for processing a large dataset. The master node divides the dataset into smaller chunks and assigns each chunk to different slave nodes. Each slave node processes its assigned chunk independently and reports the results back to the master node. This parallel processing approach enhances system performance and fault tolerance.&#xA;&#xA;3. Monolithic Architecture:&#xA;&#xA;Overview: Monolithic Architecture represents a traditional and unified approach where all components of an application are tightly integrated into a single, cohesive unit.&#xA;&#xA;Uses: Suited for smaller projects or those with simpler requirements, Monolithic Architecture simplifies the development process by consolidating all modules, including the user interface, business logic, and data storage, into a single executable unit.&#xA;&#xA;How it Works: In a monolithic architecture, the entire application is treated as a single, indivisible unit. All requests are processed within this unit, and components share the same codebase and memory space. While this architecture simplifies deployment and testing, it may pose challenges as the application grows, particularly in terms of scalability and maintenance.&#xA;&#xA;4. Microservices Architecture:&#xA;&#xA;Overview: Microservices Architecture is a modern approach that decomposes an application into a set of small, independent services. Each service runs its own process and communicates with other services through APIs.&#xA;&#xA;Uses: Ideal for large, complex applications, Microservices Architecture promotes flexibility, scalability, and easier maintenance. It allows services to be developed, deployed, and scaled independently.&#xA;&#xA;How it Works: In a microservices architecture, each service is a self-contained unit with its own data storage, business logic, and user interface. Services communicate with each other through APIs, enabling them to operate independently. This approach enhances scalability, as specific services can be scaled based on demand, and it facilitates continuous delivery and deployment.&#xA;&#xA;5. Event-Driven:&#xA;&#xA;Overview: Event-Driven Architecture relies on events to trigger and communicate between different components. It operates on the principle of asynchronous communication, where events in one part of the system trigger actions or responses in another part.&#xA;&#xA;Uses: Event-Driven Architecture is particularly effective in scenarios with asynchronous communication needs, real-time responsiveness, and loose coupling between components.&#xA;&#xA;How it Works: Components or services in an event-driven architecture communicate through events. When an event occurs, it triggers an action or response in another part of the system. For example, in a messaging application, when a user sends a message, an event is triggered to update the chat interface for both the sender and the recipient.&#xA;&#xA;6. Service-Oriented Architecture (SOA):&#xA;&#xA;Overview: Service-Oriented Architecture (SOA) structures an application as a set of loosely coupled, independent services that communicate with each other. Each service exposes its functionality through standardized protocols.&#xA;&#xA;Uses: SOA is commonly used in enterprise-level applications where interoperability, reusability, and flexibility in integrating diverse systems are essential.&#xA;&#xA;How it Works: In SOA, services are designed to be independent and self-contained, with each service offering specific functionality. These services communicate with each other through standardized protocols, such as Simple Object Access Protocol (SOAP) or Representational State Transfer (REST). SOA fosters reusability, allowing services to be used in various contexts and promoting interoperability between different systems.&#xA;&#xA;7. Layered Architecture:&#xA;&#xA;Overview: Layered Architecture organizes components into horizontal layers, each responsible for specific functionality. This architectural pattern promotes the separation of concerns and modularity.&#xA;&#xA;Uses: Widely employed in applications where a clear separation of concerns is crucial for maintainability and scalability.&#xA;&#xA;How it Works: Each layer in a layered architecture has a specific responsibility, such as presentation, business logic, and data storage. Data flows vertically between layers, ensuring a clear and modular structure. For example, in a web application, the presentation layer handles user input and displays information, the business logic layer processes and manipulates data, and the data storage layer manages the persistence of data.&#xA;&#xA;Conclusion:&#xA;&#xA;As we conclude our deep dive into various architectural patterns, it becomes evident that the choice of a suitable pattern is akin to selecting the right blueprint for constructing a building. Each architectural pattern brings its unique advantages and trade-offs, addressing specific use cases and project requirements.&#xA;&#xA;In the ever-advancing world of technology, the diversity of architectural patterns empowers developers to choose frameworks aligned with their project goals. Whether it’s the modular independence of Microservices Architecture, the structured separation in Layered Architecture, or the responsiveness of Event-Driven architecture, each pattern contributes to the evolution and progress of software design.&#xA;&#xA;Understanding architecture patterns is not just a matter of academic interest; it is a crucial aspect for architects and developers alike. This understanding empowers them to make informed decisions, guiding the creation of software systems that are not only functional but also scalable, maintainable, and adaptable to the ever-changing demands of the digital landscape. As we continue to innovate and push the boundaries of what’s possible in software development, architecture patterns stand as the cornerstone upon which future technological marvels will be built. Their significance lies not only in the past and present but in the continuous shaping of the digital future.]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://i.snap.as/C5S6ZeFM.gif" alt=""/></p>

<p><a href="https://christova.writeas.com/tag:architecturepatterns" class="hashtag"><span>#</span><span class="p-category">architecturepatterns</span></a> <a href="https://christova.writeas.com/tag:systemdesign" class="hashtag"><span>#</span><span class="p-category">systemdesign</span></a> <a href="https://christova.writeas.com/tag:mvc" class="hashtag"><span>#</span><span class="p-category">mvc</span></a> <a href="https://christova.writeas.com/tag:microservices" class="hashtag"><span>#</span><span class="p-category">microservices</span></a> <a href="https://christova.writeas.com/tag:layers" class="hashtag"><span>#</span><span class="p-category">layers</span></a> <a href="https://christova.writeas.com/tag:eventdriven" class="hashtag"><span>#</span><span class="p-category">eventdriven</span></a></p>

<p><strong>1. Model-View-Controller (MVC):</strong></p>

<p><strong>Overview:</strong> The Model-View-Controller (MVC) pattern is a time-honored architectural paradigm that separates an application into three interconnected components:</p>
<ul><li><strong>Model:</strong> This component represents the data and business logic of the application. It encapsulates the application’s data structure and the rules for manipulating that data.</li>
<li><strong>View:</strong> Responsible for managing the user interface and displaying information to the user. It receives input from users and sends commands to the controller.</li>
<li><strong>Controller:</strong> The controller handles user input, updates the model, and refreshes the view accordingly. It acts as an intermediary that processes user input and manages the flow of data between the model and the view.</li></ul>

<p><strong>Uses:</strong> MVC is widely employed in web development and GUI-based applications, offering a clear separation of concerns and facilitating easier maintenance and development. This architectural pattern enhances modularity, making it easier to scale and maintain applications over time.</p>

<p><strong>How it Works:</strong> Consider a web application where a user interacts with a webpage. When the user performs an action, such as clicking a button, the controller captures this input, updates the underlying data model, and triggers a refresh in the view to reflect the changes. This separation of concerns simplifies the development process and enhances the application’s maintainability.</p>

<h3 id="2-master-slave" id="2-master-slave"><strong>2. Master-Slave:</strong></h3>

<p><strong>Overview:</strong> The Master-Slave architecture is a distributed computing model where one central entity, the master node, controls and delegates tasks to subordinate entities known as slave nodes.</p>
<ul><li><strong>Master Node:</strong> The master node manages the overall state of the system and delegates specific tasks to slave nodes.</li>
<li><strong>Slave Node:</strong> Each slave node operates independently and reports back to the master node after completing its assigned tasks.</li></ul>

<p><strong>Uses:</strong> Master-Slave architecture is commonly employed in scenarios where workload distribution, fault tolerance, and parallel processing are critical. This architecture is particularly useful in data-intensive applications and distributed computing systems.</p>

<p><strong>How it Works:</strong> Consider a scenario where a master node is responsible for processing a large dataset. The master node divides the dataset into smaller chunks and assigns each chunk to different slave nodes. Each slave node processes its assigned chunk independently and reports the results back to the master node. This parallel processing approach enhances system performance and fault tolerance.</p>

<h3 id="3-monolithic-architecture" id="3-monolithic-architecture"><strong>3. Monolithic Architecture:</strong></h3>

<p><strong>Overview:</strong> Monolithic Architecture represents a traditional and unified approach where all components of an application are tightly integrated into a single, cohesive unit.</p>

<p><strong>Uses:</strong> Suited for smaller projects or those with simpler requirements, Monolithic Architecture simplifies the development process by consolidating all modules, including the user interface, business logic, and data storage, into a single executable unit.</p>

<p><strong>How it Works:</strong> In a monolithic architecture, the entire application is treated as a single, indivisible unit. All requests are processed within this unit, and components share the same codebase and memory space. While this architecture simplifies deployment and testing, it may pose challenges as the application grows, particularly in terms of scalability and maintenance.</p>

<h3 id="4-microservices-architecture" id="4-microservices-architecture"><strong>4. Microservices Architecture:</strong></h3>

<p><strong>Overview:</strong> Microservices Architecture is a modern approach that decomposes an application into a set of small, independent services. Each service runs its own process and communicates with other services through APIs.</p>

<p><strong>Uses:</strong> Ideal for large, complex applications, Microservices Architecture promotes flexibility, scalability, and easier maintenance. It allows services to be developed, deployed, and scaled independently.</p>

<p><strong>How it Works:</strong> In a microservices architecture, each service is a self-contained unit with its own data storage, business logic, and user interface. Services communicate with each other through APIs, enabling them to operate independently. This approach enhances scalability, as specific services can be scaled based on demand, and it facilitates continuous delivery and deployment.</p>

<h3 id="5-event-driven" id="5-event-driven"><strong>5. Event-Driven:</strong></h3>

<p><strong>Overview:</strong> Event-Driven Architecture relies on events to trigger and communicate between different components. It operates on the principle of asynchronous communication, where events in one part of the system trigger actions or responses in another part.</p>

<p><strong>Uses:</strong> Event-Driven Architecture is particularly effective in scenarios with asynchronous communication needs, real-time responsiveness, and loose coupling between components.</p>

<p><strong>How it Works:</strong> Components or services in an event-driven architecture communicate through events. When an event occurs, it triggers an action or response in another part of the system. For example, in a messaging application, when a user sends a message, an event is triggered to update the chat interface for both the sender and the recipient.</p>

<h3 id="6-service-oriented-architecture-soa" id="6-service-oriented-architecture-soa"><strong>6. Service-Oriented Architecture (SOA):</strong></h3>

<p><strong>Overview:</strong> Service-Oriented Architecture (SOA) structures an application as a set of loosely coupled, independent services that communicate with each other. Each service exposes its functionality through standardized protocols.</p>

<p><strong>Uses:</strong> SOA is commonly used in enterprise-level applications where interoperability, reusability, and flexibility in integrating diverse systems are essential.</p>

<p><strong>How it Works:</strong> In SOA, services are designed to be independent and self-contained, with each service offering specific functionality. These services communicate with each other through standardized protocols, such as Simple Object Access Protocol (SOAP) or Representational State Transfer (REST). SOA fosters reusability, allowing services to be used in various contexts and promoting interoperability between different systems.</p>

<h3 id="7-layered-architecture" id="7-layered-architecture"><strong>7. Layered Architecture:</strong></h3>

<p><strong>Overview:</strong> Layered Architecture organizes components into horizontal layers, each responsible for specific functionality. This architectural pattern promotes the separation of concerns and modularity.</p>

<p><strong>Uses:</strong> Widely employed in applications where a clear separation of concerns is crucial for maintainability and scalability.</p>

<p><strong>How it Works:</strong> Each layer in a layered architecture has a specific responsibility, such as presentation, business logic, and data storage. Data flows vertically between layers, ensuring a clear and modular structure. For example, in a web application, the presentation layer handles user input and displays information, the business logic layer processes and manipulates data, and the data storage layer manages the persistence of data.</p>

<h3 id="conclusion" id="conclusion"><strong>Conclusion:</strong></h3>

<p>As we conclude our deep dive into various architectural patterns, it becomes evident that the choice of a suitable pattern is akin to selecting the right blueprint for constructing a building. Each architectural pattern brings its unique advantages and trade-offs, addressing specific use cases and project requirements.</p>

<p>In the ever-advancing world of technology, the diversity of architectural patterns empowers developers to choose frameworks aligned with their project goals. Whether it’s the modular independence of Microservices Architecture, the structured separation in Layered Architecture, or the responsiveness of Event-Driven architecture, each pattern contributes to the evolution and progress of software design.</p>

<p>Understanding architecture patterns is not just a matter of academic interest; it is a crucial aspect for architects and developers alike. This understanding empowers them to make informed decisions, guiding the creation of software systems that are not only functional but also scalable, maintainable, and adaptable to the ever-changing demands of the digital landscape. As we continue to innovate and push the boundaries of what’s possible in software development, architecture patterns stand as the cornerstone upon which future technological marvels will be built. Their significance lies not only in the past and present but in the continuous shaping of the digital future.</p>
]]></content:encoded>
      <guid>https://christova.writeas.com/system-architecture-patterns</guid>
      <pubDate>Thu, 26 Mar 2026 07:39:38 +0000</pubDate>
    </item>
    <item>
      <title>Master Template for Web App Architecture</title>
      <link>https://christova.writeas.com/master-template-for-web-app-architecture?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[&#xA;&#xA;#systemdesign #webapplication #template&#xA;&#xA;𝐌𝐚𝐬𝐭𝐞𝐫 𝐭𝐞𝐦𝐩𝐥𝐚𝐭𝐞 𝐟𝐨𝐫 𝐛𝐮𝐢𝐥𝐝𝐢𝐧𝐠 𝐚𝐧𝐲 𝐰𝐞𝐛 𝐚𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧 𝐚𝐫𝐜𝐡𝐢𝐭𝐞𝐜𝐭𝐮𝐫𝐞&#xA;&#xA;1. Customers: End users who interact with the web application.&#xA;&#xA;2. DNS (Domain Name System): Translates domain names into IP addresses.&#xA;&#xA;3. Load Balancer: Distributes traffic across multiple servers for improved performance and availability.&#xA;&#xA;4. Cache: Stores frequently accessed data for faster retrieval and reduced backend load.&#xA;&#xA;5. Front-end: The user interface responsible for rendering, user input handling, and backend communication.&#xA;&#xA;6. Message Queue: Manages asynchronous communication and tasks between front-end and back-end.&#xA;&#xA;7. Back-end (Web Services): Contains business logic and handles user requests and data interactions.&#xA;&#xA;8. Data Store: Stores and retrieves application data, including databases or other data storage systems.&#xA;&#xA;9. Search Engine: Performs complex searches on large data sets efficiently (e.g., Elasticsearch).&#xA;&#xA;10. CDN (Content Delivery Network): Distributes static assets for faster page loading and improved user experience.&#xA;&#xA;11. Queue Workers: Process tasks from message queues, offloading resource-intensive operations.&#xA;&#xA;These components work together to create a web application architecture that delivers a responsive and seamless user experience. The choice and configuration of these components depend on the specific requirements and goals of the application.]]&gt;</description>
      <content:encoded><![CDATA[<p><img src="https://i.snap.as/jrSNy0Dm.gif" alt=""/></p>

<p><a href="https://christova.writeas.com/tag:systemdesign" class="hashtag"><span>#</span><span class="p-category">systemdesign</span></a> <a href="https://christova.writeas.com/tag:webapplication" class="hashtag"><span>#</span><span class="p-category">webapplication</span></a> <a href="https://christova.writeas.com/tag:template" class="hashtag"><span>#</span><span class="p-category">template</span></a></p>

<p>𝐌𝐚𝐬𝐭𝐞𝐫 𝐭𝐞𝐦𝐩𝐥𝐚𝐭𝐞 𝐟𝐨𝐫 𝐛𝐮𝐢𝐥𝐝𝐢𝐧𝐠 𝐚𝐧𝐲 𝐰𝐞𝐛 𝐚𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧 𝐚𝐫𝐜𝐡𝐢𝐭𝐞𝐜𝐭𝐮𝐫𝐞</p>

<p><strong>1. Customers</strong>: End users who interact with the web application.</p>

<p><strong>2. DNS (Domain Name System)</strong>: Translates domain names into IP addresses.</p>

<p><strong>3. Load Balancer</strong>: Distributes traffic across multiple servers for improved performance and availability.</p>

<p><strong>4. Cache</strong>: Stores frequently accessed data for faster retrieval and reduced backend load.</p>

<p><strong>5. Front-end</strong>: The user interface responsible for rendering, user input handling, and backend communication.</p>

<p><strong>6. Message Queue</strong>: Manages asynchronous communication and tasks between front-end and back-end.</p>

<p><strong>7. Back-end (Web Services)</strong>: Contains business logic and handles user requests and data interactions.</p>

<p><strong>8. Data Store</strong>: Stores and retrieves application data, including databases or other data storage systems.</p>

<p><strong>9. Search Engine</strong>: Performs complex searches on large data sets efficiently (e.g., Elasticsearch).</p>

<p><strong>10. CDN (Content Delivery Network)</strong>: Distributes static assets for faster page loading and improved user experience.</p>

<p><strong>11. Queue Workers</strong>: Process tasks from message queues, offloading resource-intensive operations.</p>

<p>These components work together to create a web application architecture that delivers a responsive and seamless user experience. The choice and configuration of these components depend on the specific requirements and goals of the application.</p>
]]></content:encoded>
      <guid>https://christova.writeas.com/master-template-for-web-app-architecture</guid>
      <pubDate>Thu, 26 Mar 2026 07:18:45 +0000</pubDate>
    </item>
    <item>
      <title>WhatsApp System Design</title>
      <link>https://christova.writeas.com/whatsapp-system-design?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[It feels instant—but behind the scenes, there&#39;s a beautifully orchestrated system at work.&#xA;&#xA;Here’s a breakdown of the WhatsApp Message Flow:&#xA;&#xA;• Your message is encrypted instantly and sent to WhatsApp’s servers.&#xA;&#xA;• The server checks if the recipient is online or offline.&#xA;&#xA;• If online → message is delivered and synced across devices.&#xA;&#xA;• If offline → message is queued and delivered once they’re back online.&#xA;&#xA;• Read receipts are sent back when the user reads your message.&#xA;&#xA;• And yes — all this happens within seconds, securely and efficiently.&#xA;&#xA;Let&#39;s Explore the fascinating world of WhatsApp&#39;s architecture, breaking down the key components that make it all work seamlessly.&#xA;&#xA;𝐋𝐨𝐜𝐚𝐥 𝐒𝐐𝐋𝐢𝐭𝐞 𝐃𝐁: Where your messages find a temporary home on your device.&#xA;&#xA;𝐌𝐨𝐛𝐢𝐥𝐞 𝐔𝐬𝐞𝐫𝐬: Millions of users, each with their unique experience.&#xA;&#xA;𝐂𝐮𝐬𝐭𝐨𝐦 𝐄𝐣𝐣𝐚𝐛𝐞𝐫𝐝 𝐒𝐞𝐫𝐯𝐞𝐫 𝐂𝐥𝐮𝐬𝐭𝐞𝐫: The powerhouse handling real-time communication.&#xA;&#xA;𝐘𝐀𝐖𝐒 𝐒𝐞𝐫𝐯𝐞𝐫: Ensuring smooth interactions between users and servers.&#xA;&#xA;𝐌𝐧𝐞𝐬𝐢𝐚 𝐃𝐁 𝐂𝐥𝐮𝐬𝐭𝐞𝐫, 𝐌𝐲𝐒𝐐𝐋, or 𝐏𝐨𝐬𝐭𝐠𝐫𝐞𝐬: Managing vast amounts of user data securely.&#xA;&#xA;𝐑𝐢𝐚𝐤: The backbone for storage and quick retrieval of media and data.&#xA;&#xA;𝐗𝐌𝐏𝐏 &amp; 𝐇𝐓𝐓𝐏: Protocols enabling instant messaging and data transfer.&#xA;&#xA;𝐆𝐂𝐌 / 𝐀𝐏𝐍𝐒: Pushing notifications to keep you updated, no matter the platform.&#xA;&#xA;𝐖𝐫𝐢𝐭𝐞 𝐎𝐧𝐥𝐲, 𝐌𝐞𝐬𝐬𝐚𝐠𝐞 𝐀𝐫𝐜𝐡𝐢𝐯𝐞, 𝐎𝐟𝐟𝐥𝐢𝐧𝐞 𝐔𝐬𝐞𝐫𝐬: Features shaping your messaging experience.&#xA;&#xA;𝐌𝐞𝐝𝐢𝐚, 𝐃𝐚𝐭𝐚, 𝐏𝐫𝐨𝐟𝐢𝐥𝐞, 𝐂𝐨𝐧𝐭𝐚𝐜𝐭𝐬: How your media and crucial information are managed.&#xA;&#xA;𝐇𝐓𝐓𝐏: The bridge for web-based interactions with the WhatsApp platform.&#xA;&#xA;#whatsapp #systemdesign #architecture #&#xA;&#xA;#whatsapp &#39;#howwhatsappworks&#xA;&#xA;𝐖𝐡𝐚𝐭 𝐫𝐞𝐚𝐥𝐥𝐲 𝐡𝐚𝐩𝐩𝐞𝐧𝐬 𝐰𝐡𝐞𝐧 𝐲𝐨𝐮 𝐡𝐢𝐭 𝐒𝐞𝐧𝐝 𝐨𝐧 𝐖𝐡𝐚𝐭𝐬𝐀𝐩𝐩?&#xA;&#xA;• It feels instant—but behind the scenes, there&#39;s a beautifully orchestrated system at work.&#xA;&#xA;• Here’s a breakdown of the WhatsApp Message Flow:&#xA;&#xA;• Your message is encrypted instantly and sent to WhatsApp’s servers.&#xA;&#xA;• The server checks if the recipient is online or offline.&#xA;&#xA;• If online → message is delivered and synced across devices.&#xA;&#xA;• If offline → message is queued and delivered once they’re back online.&#xA;&#xA;• Read receipts are sent back when the user reads your message.&#xA;&#xA;• And yes — all this happens within seconds, securely and efficiently.&#xA;&#xA;• I visualized the entire architecture in this diagram to simplify how it works.&#xA;Whether you&#39;re into system design, distributed systems, or just curious about real-time messaging, this is a great example to learn from.&#xA;&#xA;• \*There is a typo in step 4 it should be online]]&gt;</description>
      <content:encoded><![CDATA[<p>It feels instant—but behind the scenes, there&#39;s a beautifully orchestrated system at work.</p>

<p>Here’s a breakdown of the WhatsApp Message Flow:</p>

<p>• Your message is encrypted instantly and sent to WhatsApp’s servers.</p>

<p>• The server checks if the recipient is online or offline.</p>

<p>• If online → message is delivered and synced across devices.</p>

<p>• If offline → message is queued and delivered once they’re back online.</p>

<p>• Read receipts are sent back when the user reads your message.</p>

<p>• And yes — all this happens within seconds, securely and efficiently.</p>

<p><img src="https://i.snap.as/Jsudh8aE.gif" alt=""/></p>

<p>Let&#39;s Explore the fascinating world of WhatsApp&#39;s architecture, breaking down the key components that make it all work seamlessly.</p>

<p>𝐋𝐨𝐜𝐚𝐥 𝐒𝐐𝐋𝐢𝐭𝐞 𝐃𝐁: Where your messages find a temporary home on your device.</p>

<p>𝐌𝐨𝐛𝐢𝐥𝐞 𝐔𝐬𝐞𝐫𝐬: Millions of users, each with their unique experience.</p>

<p>𝐂𝐮𝐬𝐭𝐨𝐦 𝐄𝐣𝐣𝐚𝐛𝐞𝐫𝐝 𝐒𝐞𝐫𝐯𝐞𝐫 𝐂𝐥𝐮𝐬𝐭𝐞𝐫: The powerhouse handling real-time communication.</p>

<p>𝐘𝐀𝐖𝐒 𝐒𝐞𝐫𝐯𝐞𝐫: Ensuring smooth interactions between users and servers.</p>

<p>𝐌𝐧𝐞𝐬𝐢𝐚 𝐃𝐁 𝐂𝐥𝐮𝐬𝐭𝐞𝐫, 𝐌𝐲𝐒𝐐𝐋, or 𝐏𝐨𝐬𝐭𝐠𝐫𝐞𝐬: Managing vast amounts of user data securely.</p>

<p>𝐑𝐢𝐚𝐤: The backbone for storage and quick retrieval of media and data.</p>

<p>𝐗𝐌𝐏𝐏 &amp; 𝐇𝐓𝐓𝐏: Protocols enabling instant messaging and data transfer.</p>

<p>𝐆𝐂𝐌 / 𝐀𝐏𝐍𝐒: Pushing notifications to keep you updated, no matter the platform.</p>

<p>𝐖𝐫𝐢𝐭𝐞 𝐎𝐧𝐥𝐲, 𝐌𝐞𝐬𝐬𝐚𝐠𝐞 𝐀𝐫𝐜𝐡𝐢𝐯𝐞, 𝐎𝐟𝐟𝐥𝐢𝐧𝐞 𝐔𝐬𝐞𝐫𝐬: Features shaping your messaging experience.</p>

<p>𝐌𝐞𝐝𝐢𝐚, 𝐃𝐚𝐭𝐚, 𝐏𝐫𝐨𝐟𝐢𝐥𝐞, 𝐂𝐨𝐧𝐭𝐚𝐜𝐭𝐬: How your media and crucial information are managed.</p>

<p>𝐇𝐓𝐓𝐏: The bridge for web-based interactions with the WhatsApp platform.</p>

<p><a href="https://christova.writeas.com/tag:whatsapp" class="hashtag"><span>#</span><span class="p-category">whatsapp</span></a> <a href="https://christova.writeas.com/tag:systemdesign" class="hashtag"><span>#</span><span class="p-category">systemdesign</span></a> <a href="https://christova.writeas.com/tag:architecture" class="hashtag"><span>#</span><span class="p-category">architecture</span></a> #</p>

<p><img src="https://i.snap.as/QGiS0XUP.gif" alt=""/></p>

<p><a href="https://christova.writeas.com/tag:whatsapp" class="hashtag"><span>#</span><span class="p-category">whatsapp</span></a> &#39;<a href="https://christova.writeas.com/tag:howwhatsappworks" class="hashtag"><span>#</span><span class="p-category">howwhatsappworks</span></a></p>

<p>𝐖𝐡𝐚𝐭 𝐫𝐞𝐚𝐥𝐥𝐲 𝐡𝐚𝐩𝐩𝐞𝐧𝐬 𝐰𝐡𝐞𝐧 𝐲𝐨𝐮 𝐡𝐢𝐭 𝐒𝐞𝐧𝐝 𝐨𝐧 𝐖𝐡𝐚𝐭𝐬𝐀𝐩𝐩?</p>

<p><strong>•</strong> It feels instant—but behind the scenes, there&#39;s a beautifully orchestrated system at work.</p>

<p><strong>•</strong> Here’s a breakdown of the WhatsApp Message Flow:</p>

<p><strong>•</strong> Your message is encrypted instantly and sent to WhatsApp’s servers.</p>

<p><strong>•</strong> The server checks if the recipient is online or offline.</p>

<p><strong>•</strong> If online → message is delivered and synced across devices.</p>

<p><strong>•</strong> If offline → message is queued and delivered once they’re back online.</p>

<p><strong>•</strong> Read receipts are sent back when the user reads your message.</p>

<p><strong>•</strong> And yes — all this happens within seconds, securely and efficiently.</p>

<p><strong>•</strong> I visualized the entire architecture in this diagram to simplify how it works.
Whether you&#39;re into system design, distributed systems, or just curious about real-time messaging, this is a great example to learn from.</p>

<p><strong>•</strong> *There is a typo in step 4 it should be online</p>
]]></content:encoded>
      <guid>https://christova.writeas.com/whatsapp-system-design</guid>
      <pubDate>Wed, 25 Mar 2026 20:20:32 +0000</pubDate>
    </item>
  </channel>
</rss>