<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Amit Singh on Medium]]></title>
        <description><![CDATA[Stories by Amit Singh on Medium]]></description>
        <link>https://medium.com/@amit151993?source=rss-18e9a2b5c299------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mEJZSMclplHNK1NnsQx8eg.jpeg</url>
            <title>Stories by Amit Singh on Medium</title>
            <link>https://medium.com/@amit151993?source=rss-18e9a2b5c299------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 10:28:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@amit151993/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[50 System Design Concepts]]></title>
            <link>https://medium.com/@amit151993/50-system-design-concepts-c7282eddda57?source=rss-18e9a2b5c299------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7282eddda57</guid>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Amit Singh]]></dc:creator>
            <pubDate>Thu, 22 Jan 2026 05:29:39 GMT</pubDate>
            <atom:updated>2026-01-22T09:49:04.615Z</atom:updated>
            <content:encoded><![CDATA[<p>When you begin learning system design, the biggest challenge isn’t the concepts themselves.<br> It’s finding clear, well-explained material all in one place.</p><p>That’s where a single, well-structured guide makes a real difference.</p><p>This guide is designed to cover <strong>50 essential system design concepts</strong>, bringing everything you need into one resource. Think of it as a go-to reference for understanding how real-world systems scale, remain reliable, communicate efficiently, and manage data.</p><p>The goal is to explain each idea with concise descriptions and simple examples, so the concepts are easy to grasp and connect quickly.</p><h3>I. Core Architecture Principles</h3><h4>Vertical vs Horizontal Scaling</h4><ul><li><strong>Vertical scaling</strong> focuses on making a single machine more powerful by adding more <strong>CPU</strong>, <strong>increasing RAM</strong>, or using faster <strong>storage</strong>.</li><li><strong>Horizontal scaling</strong> on the other hand, involves adding more machines and distributing the workload across them.</li></ul><p><strong>Vertical scaling</strong> is simpler to implement, but it quickly runs into hardware limits and becomes costly.<br><strong>Horizontal scaling</strong> is more complex because it requires load balancers, stateless services, and shared or distributed storage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JBjpmFmrkUMJ7kHyt9UBcA.png" /></figure><p>A simple way to remember this: vertical scaling is one superhero getting stronger, while horizontal scaling is assembling a whole team to share the fight.</p><h3>CAP Theorem</h3><p><strong>CAP Theorem</strong> states that when a network partition occurs, a distributed system has to make a trade-off between <strong>Consistency</strong> and <strong>Availability</strong>.</p><p><strong>Consistency </strong>means all users see the <strong>same data at the same time.</strong><br><strong>Availability</strong> means the system continues to respond to requests, even if the data returned may be slightly outdated.</p><p><strong>Partition Tolerance</strong> means a distributed system continues to operate even when network failures split the system into isolated parts (partitions).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SqP17vSZ4r9gb72mbBFTTQ.png" /></figure><p>When the network is unreliable, you can’t fully guarantee both at once. Instead, you choose which one to prioritize based on the needs of your application.</p><h3>PACELC Theorem</h3><p><strong>PACELC</strong> builds on the CAP theorem by highlighting an additional trade-off. When a <strong>network partition</strong> occurs, a system must choose between <strong>Availability</strong> and <strong>Consistency</strong>. But <strong>even when the network is healthy</strong>, a choice still exists: <strong>Latency</strong> versus <strong>Consistency</strong>.</p><p>In other words, systems must decide between <strong>fast responses with eventual consistency</strong> or <strong>slower responses that guarantee strong consistency</strong>. Databases that replicate data across regions often accept higher latency to maintain correctness.</p><p>PACELC helps explain why some databases feel extremely fast but may return slightly outdated data, while others are slower yet always provide accurate, up-to-date results.</p><h3>ACID vs BASE</h3><p>ACID focuses on <strong>strong, reliable transactions</strong> — <strong>Atomicity, Consistency, Isolation, and Durability</strong>. It’s ideal for systems like <strong><em>banking</em></strong>, <strong><em>payments</em></strong>, and inventory management, where accuracy is critical and even small errors are unacceptable.</p><p><strong>BASE</strong> on the other hand, stands for <strong>Basically Available, Soft state, and Eventual consistency</strong>. It’s designed for large-scale, distributed systems that prioritize high availability and fast responses. Temporary inconsistencies are acceptable in BASE systems, as they gradually converge to a consistent state over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I0dOkfxZSsCcLT5l55MvrQ.jpeg" /></figure><p>In real-world architectures, these models are often combined: <strong>ACID</strong> is used for core transactional workflows such as payments, while <strong>BASE</strong> powers components like activity feeds, recommendations, and analytics where speed and scalability matter more than immediate consistency.</p><h3>Throughput vs Latency</h3><ul><li><strong>Throughput </strong>refers to the number of requests a system can process in a given second.</li><li><strong>Latency </strong>measures the time it takes for one request to travel through the system from start to completion.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zuYJm1Txb6vTECwg6B6TKQ.jpeg" /></figure><p>Increasing throughput is often possible by handling tasks in parallel, but this can raise latency if requests start lining up in queues.<br> It’s like a restaurant that accepts many orders at the same time but keeps customers waiting longer for their food. Strong system design aims to strike a balance — supporting high throughput during busy periods while keeping latency low to ensure a fast and smooth user experience.</p><h3>Amdahl’s Law</h3><p><strong>Amdahl’s Law</strong> explains that the benefits of parallelism are constrained by the portion of work that must remain sequential.</p><p>If 20% of your system can’t be parallelized, adding more machines will never eliminate that limitation.</p><p>In practical terms, if every request must go through a single master database, that database becomes the ceiling for your performance. The key lesson of Amdahl’s Law is to identify and remove bottlenecks — rather than assuming more servers will automatically make the system faster.</p><h3>Strong vs Eventual Consistency</h3><ul><li><strong>Strong consistency </strong>guarantees that every user sees the latest data immediately after a write.</li></ul><blockquote><strong><em>Strong consistency </em></strong><em>is simpler to reason about, but it often comes with higher latency and reduced availability during failures.</em></blockquote><ul><li><strong>Eventual consistency</strong> allows updates to propagate gradually, so different nodes may temporarily show different values.</li></ul><blockquote><strong><em>Eventual consistency</em></strong><em> works well for large-scale use cases like feeds, timelines, or counters where instant accuracy isn’t essential.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jvPaObkZk8bk9tOkibtHmw.jpeg" /></figure><p>The key is to pick the consistency model that best aligns with the user experience your system needs.</p><h3>Stateful vs Stateless Architecture</h3><ul><li><strong>Stateful service</strong> keeps track of user context across requests, typically by storing session information within the service itself.</li><li><strong>Stateless service</strong> handles each request independently and relies on external systems — such as databases or caches — to manage any required state.</li></ul><p>Stateless services are much easier to scale horizontally because any instance can process any request.</p><p>Stateful services may feel more straightforward to implement, but they complicate load balancing and recovery during failures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QR56bhJm7Vcwga2XCJMqbg.jpeg" /></figure><p>That’s why modern cloud architectures favor pushing state into shared data stores and designing services to be as stateless as possible.</p><h3>Microservices vs Monoliths</h3><p><strong>Monolithic architecture</strong> packages all features into one tightly integrated application that’s deployed as a single unit.<br> In contrast, <strong>microservices</strong> break functionality into independent services that communicate over the network.</p><p><strong>Microservices </strong>enable teams to develop, deploy, and scale components independently, but they also add complexity — especially around service communication, debugging, and maintaining data consistency.</p><p><strong>Monoliths</strong> on the other hand, are easier to build and manage early on and can work perfectly well up to a certain scale.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0j3DrCQTvYKTeu2gOH4xSw.jpeg" /></figure><p>The key insight: many successful systems begin as monoliths and only transition to microservices once real scaling and organizational pain makes the trade-offs worthwhile.</p><h3>Serverless Architecture</h3><p><strong>Serverless</strong> computing allows you to <strong>execute small pieces of code in the cloud without worrying about provisioning or maintaining servers.</strong> You’re billed only for actual execution time, while the cloud provider automatically takes care of scaling, availability, and infrastructure management.</p><p><strong>It works best for event-driven </strong>use cases like <strong>webhooks, background processing, or lightweight APIs</strong> that experience unpredictable or bursty traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*E07kUO1Qyy-3cTv_.png" /></figure><p>The downside is reduced control over long-running workloads, potential cold-start delays, and, at very high usage levels, costs that can exceed traditional setups.</p><p>In simple terms, serverless is <strong>Functions as a Service (FaaS)</strong> — an excellent choice for orchestration logic, glue code, and small, focused services.</p><h3>II. Networking and Communication</h3><h3>Load Balancing</h3><p><strong>Load balancing</strong> distributes incoming requests across multiple servers to prevent any single machine from becoming a bottleneck. This enhances performance and fault tolerance, as the system continues to operate even if one server fails.</p><p>Load balancers can be implemented as hardware appliances or software-based services, and they typically perform health checks to ensure traffic is routed only to healthy instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xh5wqq2NJufOQBg8om_0eg.jpeg" /></figure><p>From a scaling perspective, load balancing is the foundational component for horizontal scaling and is usually the first step taken when growing a system.</p><h3>Load Balancing Algorithms</h3><p>Common load-balancing algorithms include Round Robin, Least Connections, and IP Hash.</p><ul><li><strong>Round Robin</strong> distributes requests sequentially across servers and is easy to implement.</li><li><strong>Least Connections</strong> routes traffic to the server with the fewest active connections, making it effective when request durations vary.</li><li><strong>IP Hash</strong> determines the target server based on the client’s IP address, ensuring that the same user is typically routed to the same backend, which enables basic session stickiness.</li></ul><p>Choosing the appropriate algorithm directly impacts load distribution fairness, efficient resource utilization, and overall user experience.</p><h3>Reverse Proxy vs Forward Proxy</h3><ul><li><strong>Reverse proxy</strong> operates <strong>in front of</strong> <strong>servers </strong>and acts on their behalf when responding to clients. It conceals the internal server layout and can handle tasks like <strong>TLS termination, caching, compression, and request routing</strong>.</li><li><strong>Forward proxy</strong> sits <strong>in front of clients</strong> and represents them to external services, commonly used for <strong>security controls, caching, or content filtering</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OzU986GGS9lIuyiuOAwx8Q.png" /></figure><p>An easy way to remember the difference: a reverse proxy is like a company’s reception desk that shields all internal rooms, while a forward proxy is like a checkpoint your laptop must pass through to access the internet.</p><p>Understanding this distinction is especially useful when discussing API gateways and corporate proxy setups.</p><h3>API Gateway</h3><p><strong>API gateway</strong> is a specialized reverse proxy that serves as the unified entry point for all API requests in a microservices architecture. <strong>It directs requests to the appropriate services, enforces rate limits, manages authentication, handles logging, and may also transform responses</strong>. By exposing a single endpoint, it simplifies client interactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dS8aCSW_s2mUpaUEqILoGw.jpeg" /></figure><p>However, overloading the gateway with business logic can turn it into a performance bottleneck or a mini monolith. Well-designed gateways remain lightweight and narrowly focused.</p><h3>CDN (Content Delivery Network)</h3><p><strong>CDN</strong> is a <strong>globally distributed network of servers</strong> that stores cached copies of static assets such as images, videos, and JavaScript files closer to end users.</p><p>When someone requests content, it’s served from the <strong>nearest CDN location,</strong> <strong>significantly reducing response time</strong>. This also eases the load on the main (origin) servers, helping the system scale better and stay reliable during high traffic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jfG0nz9FemNroMkk.png" /></figure><p>For applications with a worldwide audience, <strong>CDNs are critical to fast front-end performance</strong>.<br> You can think of them as lightweight, local replicas of your website’s heavy resources spread across the globe.</p><h3>DNS (Domain Name System)</h3><p><strong>DNS</strong> maps <strong>human-friendly domain names into IP addresses </strong>that computers use to locate servers.<br>When you enter a website name, your device asks a DNS service to resolve it to the server’s numeric address.<br>DNS relies on multiple layers of caching, which makes repeated lookups fast after the first request. It can also provide basic load balancing by returning different IP addresses for the same domain.<br>Understanding how DNS works helps explain why domain changes take time to propagate and why some outages are the result of DNS misconfigurations.</p><h3>TCP vs UDP</h3><ul><li><strong>TCP </strong>is a <strong>connection-oriented protocol designed for reliability</strong>. It ensures data is delivered in order and <strong>without errors by using acknowledgments and retransmissions</strong>.</li><li><strong>UDP</strong> is <strong>connectionless </strong>and <strong>offers no guarantees about delivery or ordering</strong>, which makes it <strong>faster </strong>and more <strong>lightweight</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XTpeR9f5oG1y3Hmy.png" /></figure><p>TCP is ideal for <strong>APIs, web pages, and file transfers </strong>where correctness and completeness are critical.<br>UDP is better suited for <strong>real-time applications such as video calls and online games</strong>, where speed is more important than perfect delivery and occasional packet loss is acceptable.<br>You can think of TCP as registered mail, while UDP is more like sending a quick postcard.</p><h3>HTTP/2 and HTTP/3 (QUIC)</h3><ul><li><strong>HTTP/2</strong> introduced multiplexing, allowing <strong>multiple requests and responses to be sent over a single TCP connection</strong>, which significantly reduces connection overhead. It also added improvements like header compression and server push to boost performance.</li><li><strong>HTTP/3</strong> is built on <strong>QUIC over UDP</strong>, enabling <strong>faster connection establishment and better performance</strong> on unreliable or high-latency networks.</li></ul><p>Overall, these protocol upgrades focus on lowering latency and making more efficient use of modern network conditions.</p><p><strong>From an engineering perspective:</strong> the core idea is minimizing connection setups while maximizing efficiency through a single, well-utilized connection.</p><h3>gRPC vs REST</h3><ul><li><strong>REST</strong> commonly relies on HTTP with JSON payloads and is centered around resource-based endpoints such as /users or /orders. It’s simple to understand, human-readable, and widely adopted for public-facing APIs.</li><li><strong>gRPC</strong> is built on HTTP/2 and uses <strong>binary-encoded Protocol(protobuf)</strong> Buffers, making messages more compact and efficient over the network. It also provides strong typing and supports <strong>bidirectional streaming for real-time communication</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0_aMfTDO8Oj8sfyRkCG6lg.jpeg" /></figure><p>In microservices, gRPC is often preferred for <strong>service-to-service calls</strong>, while REST is common for external clients.</p><p>Use REST when readability and compatibility matter, gRPC when performance and contracts matter.</p><h3>WebSocket and Server-Sent Events (SSE)</h3><p><strong>WebSockets</strong> establish a <strong>full-duplex connection</strong>, allowing <strong>both the client and the server to send messages to each other at any time</strong>.</p><p><strong>Server-Sent Events (SSE)</strong> provide a <strong>one-way communication channel where the server pushes updates to the client over standard HTTP</strong>.</p><p><strong>WebSockets</strong> are well-suited for use cases like <strong>chat applications, multiplayer gaming, and real-time collaboration</strong>.</p><p>SSE is a simpler alternative, ideal for scenarios such as <strong>live score updates or notifications</strong> where <strong>only server-to-client updates are required</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dw15jVLVZFgP6iB_l7KKYw.jpeg" /></figure><p>Both solve real-time communication problems that plain HTTP cannot handle well.</p><h3>Long Polling</h3><p><strong>Long polling</strong> is a communication pattern where the client sends a request and the server keeps it open until new data is available or a timeout occurs.</p><p>Once the server responds, the client immediately sends another request. This simulates real time updates over standard HTTP without needing special protocols.</p><p>While it’s less efficient than WebSockets, long polling is simpler to implement and works reliably through most proxies and firewalls.</p><p>You can think of it as repeatedly asking, <em>“Is there anything new?”</em> and patiently waiting until the server has something to say.</p><h3>Gossip Protocol</h3><p>A <strong>gossip protocol</strong> allows nodes in a distributed system to exchange information by periodically communicating with randomly selected peers.</p><p>Over time, data propagates through the system much like rumors in a social network, until most nodes converge on a similar view. It’s commonly used to distribute membership details, health information, or configuration data in a fault-tolerant manner.</p><p>Gossip-based systems are <strong>eventually consistent</strong> and avoid any central coordinator, which makes them especially suitable for large, dynamic clusters where nodes frequently join or leave.</p><h3>III. Database and Storage Internals</h3><h3>Sharding (Data Partitioning)</h3><p><strong>Sharding</strong> splits data across multiple machines, with each node responsible for a subset of the overall dataset. Common approaches include range-based, hash-based, and directory-based sharding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*qb8fd3aVkPQq7nGSAzUE9g.jpeg" /></figure><p>The primary objective is to scale storage capacity and throughput by eliminating a single oversized database instance.</p><p>The main challenge lies in selecting an effective shard key that prevents hot spots, where one shard receives most of traffic. Once sharding is in place, redistributing data across shards or moving data between shards — known as resharding — becomes a key operational challenge.</p><h3>Replication Patterns (Master Slave, Master Master)</h3><p><strong>Replication</strong> involves maintaining multiple copies of the same data across different nodes.</p><ul><li>In a <strong>primary–replica (master–slave)</strong> setup, a single node handles all writes and propagates changes to replicas, which typically serve read requests.</li><li>In a <strong>multi-primary (master–master)</strong> model, multiple nodes can accept writes, requiring mechanisms to detect and resolve conflicts.</li></ul><p>Replication boosts read scalability and system availability, but it complicates consistency — especially when writes are allowed on more than one node.</p><p>In interviews, you’re often expected to discuss topics like replication lag and its impact on read freshness, as well as failover behavior when a primary node goes down.</p><h3>Consistent Hashing</h3><p><strong>Consistent hashing</strong> is a strategy for distributing keys across nodes while minimizing data reshuffling when nodes are added or removed.</p><p>Both keys and nodes are mapped onto a logical ring, and each key is assigned to the next node encountered on the ring.</p><p>When in cluster node joins or leaves, only a small partition of keys need to be reassigned, which makes this approach especially useful for distributed caches and databases.</p><p>You can think of it as a stable mapping that adapts smoothly as the cluster size changes or grows or shrinks, rather than being completely rebalanced each time.</p><h3>Database Indexing (B Trees, LSM Trees)</h3><p><strong>Indexes</strong> speed up queries by organizing data in a way that allows fast lookup.</p><p><strong>B-Trees</strong> are balanced, ordered data structures that support efficient point lookups and range scans, which is why they’re commonly used in relational databases.</p><p><strong>LSM Trees</strong> optimize for write performance by buffering updates in memory and periodically flushing them to disk; this makes writes fast but adds complexity to read operations.</p><p>The choice between them often comes down to whether the workload is read-heavy or write-heavy.</p><p>The key insight is that indexes are maintained separately from the base data and must be updated on every write, which is why having too many indexes can significantly degrade insert performance.</p><h3>Write Ahead Logging (WAL)</h3><p><strong>Write-Ahead Logging (WAL)</strong> records all changes in a sequential log before they are applied to the main database storage.</p><p>If a crash occurs during a transaction, the system can replay the log during recovery to bring the database back to a consistent state. This guarantees <strong>durability</strong> and <strong>atomicity</strong> of transactions and also enables features like replication by streaming the log.</p><p>WAL is critical because, without it, a system failure could leave data partially written and the database in a corrupt or inconsistent state.</p><h3>Normalization vs Denormalization</h3><ul><li><strong>Normalization</strong> organizes data into well-defined tables to minimize redundancy and unwanted dependencies, following rules such as first normal form, second normal form, and beyond. This helps prevent anomalies during inserts, updates, and deletes.</li><li><strong>Denormalization</strong>, on the other hand, deliberately duplicates data to improve read performance and reduce expensive joins. In large-scale systems, it’s commonly used on read-heavy paths — for example, storing user details directly with posts instead of performing a join on every query.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*KbCdQwe8st8LRP5S_xipCg.jpeg" /></figure><p>The key skill is understanding where denormalization can be applied without compromising data consistency.</p><h3>Polyglot Persistence</h3><p><strong>Polyglot persistence</strong> refers to using multiple database technologies within a single system, selecting each one based on its strengths.</p><p>For example, a relational database might handle transactions, a document store could manage logs, a key-value store could be used for caching, and a graph database could model relationships.</p><p>Rather than forcing all data into a single database, this approach focuses on choosing the best tool for each workload.</p><p>The downside is increased operational complexity and a higher learning curve for the engineering team.</p><h3>Bloom Filters</h3><p>A <strong>Bloom filter</strong> is a space-efficient probabilistic data structure used to quickly check whether an item <em>might</em> be in a set. It can return false positives but never false negatives.</p><p>When an element is added, multiple hash functions map it to positions in a bit array and set those bits.</p><p>To test membership, the same bits are checked — if any one of them is unset, the item is guaranteed not to be present.</p><p>Bloom filters are commonly used in databases and caching systems to avoid unnecessary disk reads or cache lookups.</p><p>You can think of them as lightweight gatekeepers that answer either <em>“definitely not”</em> or <em>“possibly yes.”</em></p><h3>Vector Databases</h3><p><strong>Vector databases</strong> are designed to store and query vectors — numeric representations of data such as <strong>text, images, or audio, typically generated by embedding models</strong>. They enable similarity-based searches, like finding documents that are most similar to a given input.</p><p>Rather than relying on exact matches, these systems use distance metrics such as <strong>cosine similarity or Euclidean distance</strong> to measure <strong>closeness between vectors.</strong></p><p>This capability is foundational for modern search engines, recommendation systems, and AI assistants.</p><p>For interviews, it’s usually sufficient to understand that vector databases perform efficient nearest-neighbor searches over high-dimensional data.</p><h3>IV. Reliability and Fault Tolerance</h3><h3>Rate Limiting</h3><p><strong>Rate limiting</strong> restricts how many requests a user, IP address, or API key can make within a defined time window. It helps protect systems from abuse, accidental traffic surges, and misbehaving clients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cwO1b0dC0IAe9HUiMMdQDA.jpeg" /></figure><p>Common approaches include fixed-window counters, sliding windows, and token bucket algorithms.</p><p>Rate limits are typically enforced at the API gateway or load balancer layer.</p><p>You can think of rate limiting as a set of safety brakes that prevent shared resources from being overwhelmed.</p><h3>Circuit Breaker Pattern</h3><p><strong>Circuit breaker</strong> tracks calls to a remote dependency and trips to an <em>open</em> state when failures cross a defined threshold.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WzYGFIvsJJbJHW1_WbTvIA.jpeg" /></figure><p>While open, new requests are rejected immediately instead of repeatedly hitting an unhealthy service.</p><p>After a cooldown period, the breaker permits a small number of test requests to check whether the service has recovered, closing again if they succeed. This pattern helps prevent cascading failures, where one slow or failing service impacts the entire system.</p><p>The tricky part is tuning the breaker correctly — if it’s too sensitive, it opens unnecessarily; if it’s too lenient, it reacts too late to protect the system.</p><h3>Bulkhead Pattern</h3><p><strong>Bulkhead pattern</strong> isolates components of a system so that a failure in one area doesn’t bring down the entire application. This isolation can be implemented using separate thread pools, connection pools, or even dedicated service clusters for different features.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SLbVixrtfMQutqY4eXGkNw.jpeg" /></figure><p>If one bulkhead becomes overloaded or fails, the rest of the system continues to operate normally.</p><p>The term comes from ship design, where bulkheads prevent flooding in one compartment from sinking the whole vessel.</p><p>In system design discussions, applying bulkheads demonstrates an understanding of fault isolation and limiting the blast radius of failures.</p><h3>Retry Patterns and Exponential Backoff</h3><p><strong>Retries</strong> are used to recover from transient failures such as network issues, timeouts or temporary service overloads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1W9fqHn9K9CGhYQcE3MxIQ.png" /></figure><p>With <strong>exponential backoff</strong>, each retry is delayed longer than the previous one — for example, waiting 1 second, then 2 seconds, then 4 seconds. This reduces pressure on a service that’s already under strain.</p><p>Well-designed retry strategies also include <strong>jitter</strong>, adding a small amount of randomness delays to prevent many clients from retrying at the same time and causing a thundering herd.</p><p>The key point is that retries without backoff can actually amplify an outage rather than mitigate it.</p><h3>Idempotency</h3><p>An operation is <strong>idempotent</strong> if executing it multiple times produces the same outcome as executing it once.</p><p>For instance, a request to <em>set a user’s status to active</em> is idempotent, whereas <em>incrementing an account balance by 10</em> is not.</p><p>Idempotency becomes especially important in systems that use retries, since the same request may be processed more than once.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HOFPfJnVLe0ya-rJOO8dXg.jpeg" /></figure><p>To prevent issues like double charging, APIs — particularly for payments — often rely on idempotency keys.</p><p>In interviews, it’s a good practice to bring up idempotency whenever you discuss retry mechanisms or at-least-once delivery guarantees.</p><h3>Heartbeat</h3><p>A <strong>heartbeat</strong> is a periodic signal sent by a service or node to show that it is running and healthy.</p><p>Monitoring systems or coordination components listen for these signals to track node availability.</p><p>If heartbeats stop arriving, the node is considered unhealthy or down, which can trigger actions like failover or autoscaling.</p><p>Despite their simplicity, heartbeats are a powerful mechanism for liveness detection — essentially the system’s regular <em>pulse checks</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4lwFLmM_p4iWQEYpFNzqCQ.jpeg" /></figure><h3>Leader Election (Paxos, Raft)</h3><p><strong>Leader election</strong> is the mechanism by which a distributed system selects one node to serve as the coordinator among many peers.</p><p>Algorithms such as Paxos and Raft guarantee that exactly one leader is chosen and that all participating nodes eventually agree on that choice.</p><p>The elected leader is responsible for duties like task coordination, metadata management, or ordering writes, and if it fails, the system automatically elects a replacement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aQrIR8yMnkd56kboaPenXA.jpeg" /></figure><p>For interviews, you don’t need to dive into the mathematical details — what matters is understanding that consensus algorithms underpin many core systems, including distributed logs and metadata services.</p><h3>Distributed Transactions (SAGA Pattern)</h3><p>A <strong>distributed transaction</strong> involves multiple services or databases working together to complete a single business operation.</p><p>The <strong>SAGA pattern</strong> represents such a transaction as a series of local operations, each paired with a compensating action to undo its effects if a later step fails.</p><p>Rather than locking resources as in a traditional A<strong>CID transaction</strong>, each <strong>service executes independently and emits events.</strong> If a failure occurs, compensating actions are triggered to <strong>roll back prior work</strong>, making this approach well suited to microservices and eventual consistency.</p><p>The tradeoff is increased implementation complexity and the need to carefully handle partial failures.</p><h3>Two Phase Commit (2PC)</h3><p><strong>Two-Phase Commit (2PC)</strong> is a protocol designed to achieve atomic transactions across multiple nodes.</p><ul><li>In the first phase, a coordinator asks all participants whether they are prepared to commit.</li><li>In the second phase, if all participants agree, the coordinator instructs them to commit; otherwise, it directs them to roll back.</li></ul><p>While 2PC offers strong consistency guarantees, it can become blocking if the coordinator fails and is costly at scale due to resource locking.</p><p>As a result, many modern cloud systems avoid 2PC on high-throughput paths, opting instead for patterns like SAGA that better support scalability and resilience.</p><h3>V. Caching and Messaging</h3><h3>Caching</h3><p><strong>Caching</strong> keeps frequently accessed data in a fast storage layer — typically in memory — to lower latency and reduce load on backend systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iN-4GCjp987U9bWuCBV-hw.jpeg" /></figure><p>Common caching layers include in-process caches, external key-value stores, and content delivery networks (CDNs). It’s particularly effective for read-heavy workloads and expensive computations.</p><p>The tricky part is managing stale data and deciding when and how to invalidate cached entries, which makes caching more complex than it initially seems.</p><p>As the saying goes, cache invalidation is one of the hardest problems in computer science.</p><h3>Caching Strategies (Cache Aside, Write Through, etc.)</h3><ul><li><strong>Cache aside</strong> strategy, the application first checks the cache; on a miss, it fetches the data from the database and then stores it in the cache.</li><li><strong>Write through</strong> writes to the cache and database at the same time, ensuring cache and source are always in sync.</li><li><strong>Write-back</strong> (or write-behind) updates the cache first and persists changes to the database asynchronously, offering high write performance but introducing risk if the cache fails before the data is flushed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1vuC8FmULMrjIjphOJ0kNg.jpeg" /></figure><p>Every strategy involves tradeoffs between consistency, implementation complexity, and performance, and interviewers appreciate it when you explain which one you’d choose for a specific use case.</p><h3>Cache Eviction Policies (LRU, LFU)</h3><p><strong>Cache eviction policies</strong> determine which entries are removed when a cache reaches its capacity.</p><ul><li><strong>LRU (Least Recently Used)</strong> removes items that haven’t been accessed recently, based on the assumption that recently used data is more likely to be needed again</li><li><strong>LFU (Least Frequently Used)</strong> evicts items with low access counts, prioritizing data with sustained, long-term popularity.</li></ul><p>Some systems also use simpler strategies like random eviction or FIFO, as well as more advanced hybrid algorithms.</p><p>The core idea is that cache memory is limited, so the goal is to retain the most valuable data in memory for as long as possible.</p><h3>Message Queues (Point to Point)</h3><p>A <strong>message queue</strong> enables one component to send messages to another without requiring both to be active at the same time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZGUePwqxjXM8YG4Eo6Rfiw.jpeg" /></figure><p>In a <strong>point-to-point</strong> model, each message is consumed by a single receiver and then removed from the queue, allowing the producer and consumer to scale and fail independently.</p><p>Message queues are commonly used for background processing, email delivery, and handling heavy tasks asynchronously.</p><p>You can think of a queue as a shared to-do list that services use to hand off work to each other.</p><h3>Pub Sub (Publish Subscribe)</h3><p>In a <strong>publish–subscribe (pub/sub)</strong> model, producers publish messages to topics rather than sending them directly to specific consumers.</p><p>Consumers subscribe to the topics they’re interested in and receive copies of the relevant messages, enabling broadcast-style communication and loose coupling between producers and consumers.</p><p>This allows multiple services to react independently to the same event — for example, handling logging, analytics, or notifications.</p><p>In interviews, pub/sub commonly comes up in event-driven architectures, such as activity feeds or event sourcing systems.</p><h3>Dead Letter Queues</h3><p>A <strong>dead letter queue (DLQ)</strong> holds messages that repeatedly fail processing after a defined number of retries.</p><p>Instead of retrying indefinitely and blogging the main queue, these problematic messages are diverted to a separate queue.</p><p>Engineers can then examine the DLQ to diagnose issues, correct bad data, or replay messages once the problem is resolved. This approach improves system resilience and prevents so-called <em>poison messages</em> from stalling processing.</p><p>You can think of a dead letter queue as a quarantine area for jobs that couldn’t be handled successfully.</p><h3>VI. Observability and Security</h3><h3>Distributed Tracing</h3><p><strong>Distributed tracing</strong> tracks a single request as it travels through multiple services in a system. Each service records trace identifiers (trace ID) and span details, allowing the complete request path to be reconstructed end to end.</p><p>This is especially valuable for diagnosing latency issues or failures in microservice architectures. Without tracing, you only see isolated errors; with it, you gain a full picture across services, queues, and databases.</p><h3>SLA vs SLO vs SLI</h3><p>An <strong>SLA (Service Level Agreement)</strong> is a customer-facing commitment, for example guaranteeing <em>99.9% uptime per month</em>.</p><p>An <strong>SLO (Service Level Objective)</strong> is an internal reliability target that engineering teams aims to achieve, often set tighter than the SLA.</p><p>An <strong>SLI (Service Level Indicator)</strong> is the actual measured metric, such as observed real uptimes or request success rates.</p><p>You can think of the SLA as the contract, the SLO as the goal, and the SLI as the scoreboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQtrKm1xwc4egwv6pr_cSQ.jpeg" /></figure><p>In interviews, using these terms accurately signals a strong understanding of reliability and production engineering.</p><h3>OAuth 2.0 and OIDC</h3><p><strong>OAuth 2.0</strong> is a delegated authorization framework that allows users to grant applications limited access to their resources without sharing their passwords.</p><p><strong>OpenID Connect (OIDC)</strong> extends OAuth 2.0 by adding authentication, enabling clients to verify a user’s identity and retrieve basic profile information. This is what powers many <em>“Login with X”</em> experiences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*dP3-acPJUqCRK_UhbOg6wQ.png" /></figure><p>The core concept is that a trusted authorization server issues tokens that client applications and APIs can rely on for access control and identity verification.</p><h3>TLS/SSL Handshake</h3><p><strong>TLS/SSL</strong> secures communication between a client and a server by encrypting data while it’s in transit.</p><p>During the <strong>handshake </strong>process, both sides agree on encryption algorithms, securely exchange keys, and validate digital certificates.</p><p>Once the handshake is complete, all subsequent traffic/data is encrypted, preventing eavesdropping or tampering — this is what enables the familiar lock icon in your browser.</p><p>Without TLS, anyone with network access could intercept or modify sensitive information.</p><h3>Zero Trust Security</h3><p><strong>Zero Trust</strong> is a security model built around the principle <em>“never trust, always verify.”</em> It assumes that threats may exist both outside and inside the network perimeter.</p><p>Every request must be authenticated, authorized, and encrypted — regardless of whether it originates from within a data center or a VPC. Access is granted based on identity, device posture, and contextual signals, not just on being “<em>inside the firewall.</em>”</p><p>In modern system architectures, Zero Trust is becoming default strategy for securing applications and infrastructure or system design.</p><h3>Key Takeaways</h3><ul><li><strong>System design</strong> is largely about navigating trade-offs — such as consistency vs. availability, latency vs. throughput, simplicity vs. flexibility.</li><li>Scaling is not just adding more servers, it requires careful consideration of load balancing, sharding, replication, and identifying system bottlenecks.</li><li>Reliability patterns like rate limiting, circuit breakers, retries, and bulkheads exist because failures are an expected part of distributed systems.</li><li>Caching, queues, and publish–subscribe models are powerful tools for improving performance and decoupling components, but they introduce their own challenges around data consistency and ordering.</li><li>Finally, observability and security practices — such as distributed tracing, SLIs, OAuth, TLS, and Zero Trust — are critical for building systems that are not only fast, but also secure, reliable, and easy to debug.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7282eddda57" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Struggled With Git — Until I Understood These 19 Commands]]></title>
            <link>https://medium.com/@amit151993/i-struggled-with-git-until-i-understood-these-19-commands-52e7903c34c2?source=rss-18e9a2b5c299------2</link>
            <guid isPermaLink="false">https://medium.com/p/52e7903c34c2</guid>
            <category><![CDATA[git]]></category>
            <category><![CDATA[bitbucket]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Amit Singh]]></dc:creator>
            <pubDate>Wed, 14 Jan 2026 11:13:36 GMT</pubDate>
            <atom:updated>2026-01-14T11:13:36.492Z</atom:updated>
            <content:encoded><![CDATA[<h3>I Struggled With Git — Until I Understood These 19 Commands</h3><p>When I first started using Git, it felt overwhelming.<br> So many commands. So many terms.<br> One small mistake, and everything looked broken.</p><p>But over time, I realized something important:<br> <strong>Git isn’t hard — it’s just badly explained.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8GKfcDyiZ2S3_mDd1yJF_g.jpeg" /></figure><p>Once I understood a few core ideas and commands, everything clicked.<br> Here are the <strong>19 Git commands</strong> that made Git finally make sense to me.</p><ol><li><strong>git add</strong><br> → Add changes from the working directory into the staging area.</li></ol><pre># Adds changes to the staging area.<br>git add app.py</pre><p><strong>2. git commit</strong><br> → Saves those selected changes with a note.</p><pre># Saves staged changes with a message.<br>git commit -m &quot;Add login validation&quot;</pre><p><strong>3. git push</strong><br> → Upload commited changes from the local repository to a remote repository.</p><pre># Uploads commits to a remote repository.<br>git push origin main  # Upload commits</pre><p><strong>4. git fetch</strong><br> → Download changes from a remote repository, without applying them locally.</p><pre># Downloads changes without merging.<br>git fetch origin  # Download changes</pre><p><strong>5. git merge</strong><br> → Combines changes from one branch into another.</p><pre># Merges feature-auth into the current branch.<br>git merge &lt;branch&gt;  # Merge branch</pre><p><strong>6. git pull</strong><br> → Fetch and then merge changes from a remote repository into the local branch.</p><pre># Fetch changes from remote branch.<br>git pull origin main # Fetch + merge</pre><p><strong>7. git diff</strong><br> → Shows what you changed but haven’t saved yet.</p><pre># Shows unstaged changes.<br>git diff</pre><p><strong>8. git diff HEAD</strong><br> → Shows how your current changes from current working directory and the latest commit.</p><pre># Compares working directory with last commit.<br>git diff HEAD</pre><p><strong>9. git status</strong><br> → Tells you what’s changed and what’s saved.</p><pre># Shows modified, staged, and untracked files.<br>git status</pre><p><strong>10. git branch</strong><br> → Shows all local branches.</p><pre># Lists branches<br>git branch</pre><p><strong>11. git log</strong><br> → It shows you commits in the current branch with extra details.</p><pre># Displays commits in a compact format.<br>git log --oneline</pre><p><strong>12. git checkout</strong><br> → Create a branch or switch between branches.</p><pre># Creates and switches to a new branch.<br>git checkout -b &lt;branch&gt;  # Create &amp; switch<br>git checkout &lt;branch&gt;     # Switch branches</pre><p><strong>13. git stash</strong><br> → Temporarily save uncommitted changes and apply them later.</p><pre># Saves changes and reapplies them later.<br>git stash      # Save work temporarily<br>git stash pop  # Restore changes<br>git stash list # View stashes</pre><p><strong>14. git rebase</strong><br> → Apply commits from one branch to another.</p><pre># Applies commits on top of main branch<br>git rebase main</pre><p><strong>15. git reset</strong><br> → Undo changes in the working directory and move back to a specific commit.</p><pre># Removes the last commit completely or moves HEAD to a previous commit.<br>git reset --hard HEAD~1 # Delete commit<br>git reset --soft HEAD~1 # Undo commit (keep changes)<br>git revert &lt;id&gt;         # Safe undo<br>git checkout -- &lt;file&gt;  # Discard file changes</pre><p><strong>16. git revert</strong><br> → Undo changes by creating a new commit.</p><pre># Safely undoes a commit<br>git revert a1b2c3d</pre><p><strong>17. git bisect</strong><br> → Helps find which change broke the code. Narrow down bugs quickly.</p><pre># Finds buggy commits or binary-searches to locate the broken commit<br>git bisect start<br>git bisect bad<br>git bisect good v1.0</pre><p><strong>18. git cherry-pick</strong><br> → Apply commits from one branch to another.</p><pre># Applies a specific commit or brings one commit from another branch.<br>git cherry-pick a1b2c3d</pre><p><strong>19. git init</strong><br> → Starts Git tracking in a new project.</p><pre># Initialize a new Git repository<br>git init</pre><h3>Git in Simple Terms</h3><p><strong>Working directory</strong><br> → Where you actually edit files.<br> ➡ Example: editing app.py in VS Code.</p><p><strong>Staging area</strong><br> → A waiting area before saving changes.</p><pre># Where you prepare changes<br>git add app.py</pre><p><strong>Local repository</strong><br> → Saved versions on your computer.</p><pre># Saved commits on your machine.<br>git commit -m &quot;Initial commit&quot;</pre><p><strong>Remote repository</strong><br> → Saved versions on a server like GitHub.</p><pre># Shared version on a server (e.g., GitHub)<br>git push origin main</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52e7903c34c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing a Scalable Video Upload & Processing System (Step-by-Step)]]></title>
            <link>https://medium.com/@amit151993/designing-a-scalable-video-upload-processing-system-step-by-step-b5b176fd9334?source=rss-18e9a2b5c299------2</link>
            <guid isPermaLink="false">https://medium.com/p/b5b176fd9334</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[youtube]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Amit Singh]]></dc:creator>
            <pubDate>Tue, 13 Jan 2026 02:31:19 GMT</pubDate>
            <atom:updated>2026-01-13T02:50:47.199Z</atom:updated>
            <content:encoded><![CDATA[<p>Uploading and streaming videos at scale is one of the most challenging problems in system design. Large file sizes, long processing times, and millions of concurrent users can easily overwhelm a backend if not designed correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Zsu0i5RZJxNahdeNlAPGg.png" /></figure><p>In this article, walk through a <strong>production-grade video upload and processing architecture</strong> used by real-world platforms like YouTube, Netflix, and Instagram.</p><h4>High-Level Architecture Overview</h4><p>At a high level, the system is divided into three major parts:</p><ol><li><strong>Upload Path</strong> — Secure and scalable video uploads</li><li><strong>Processing Pipeline</strong> — Asynchronous video transformation</li><li><strong>Playback Path</strong> — Fast and reliable video delivery</li></ol><p>Each part is designed to scale independently.</p><h4>1: Client Requests a Presigned Upload URL</h4><p><strong>Pattern: API Gateway + Secure Direct Upload</strong></p><p>When a user wants to upload a video, the client does <strong>not</strong> upload the file directly to the backend.</p><p>Instead:</p><ol><li>The client sends a request to the API Gateway</li><li>The API Gateway authenticates the user and forwards the request</li><li>The Video Service generates a <strong>presigned object-storage URL</strong></li></ol><p>This URL allows the client to upload the video directly to object storage with limited permissions and an expiration time.</p><h4>Why this matters</h4><ul><li>Backend is protected from large file uploads</li><li>Uploads scale automatically with storage</li><li>Reduced latency and infrastructure cost</li></ul><h4>2: API Gateway &amp; Load Balancer</h4><p>The request first hits the <strong>API Gateway &amp; Load Balancer</strong>, which handles:</p><ul><li>✅ Routing</li><li>🔐 Authentication &amp; authorization</li><li>🚦 Rate limiting</li><li>🧭 Request validation</li></ul><p>This ensures only <strong>authenticated and valid users</strong> can upload videos.</p><h4>3: Video Service Generates a Pre-Signed URL</h4><p>The <strong>Video Service</strong> receives the request and:</p><ul><li>Calls getPresignedURL()</li><li>Generates a <strong>temporary, secure upload URL</strong> for object storage (S3)</li></ul><p>This URL:</p><ul><li>Has a time limit</li><li>Allows upload only to a specific location</li><li>Requires no server-side upload handling</li></ul><h4>4: Client Uploads Video Directly to Object Storage</h4><p><strong>Pattern: Event-Driven Architecture</strong></p><p>Using the <strong>pre-signed URL</strong>, the client uploads the raw video <strong>directly to S3</strong>.</p><p>Stored content includes:</p><ul><li>Raw video file</li><li>Future processed segments</li><li>Streaming manifest files</li></ul><p>This approach:</p><ul><li>Reduces backend load</li><li>Supports very large file uploads</li><li>Improves upload reliability</li></ul><h4>5: Metadata is Stored Separately</h4><p>Once the upload starts or completes, the <strong>Video Service</strong> stores metadata in the <strong>Video Metadata DB</strong>, such as:</p><ul><li>videoId</li><li>uploaderId</li><li>title &amp; description</li><li>processing status</li><li>S3 object URLs</li></ul><h4>6: Asynchronous Video Processing</h4><p><strong>Pattern: Worker / Background Job Pattern</strong></p><p>Video processing is <strong>never synchronous</strong>.</p><p>The processing service runs asynchronously and can scale horizontally. This ensures:</p><ul><li>Users are not blocked</li><li>Heavy CPU workloads are isolated</li><li>Failures can be retried safely</li></ul><h4>7: Fan-Out Media Processing</h4><p><strong>Pattern: Fan-Out / Parallel Processing</strong></p><p>The uploaded video is split into multiple independent processing pipelines:</p><ul><li>Transcoding into multiple resolutions</li><li>Audio extraction and optimization</li><li>Transcript generation</li><li>Additional media enhancements</li></ul><p>Each task runs in parallel.</p><p>The <strong>Video Processing Service</strong> runs a pipeline that includes:</p><h4>🎬 Video Splitter</h4><ul><li>Breaks the video into chunks for parallel processing</li></ul><h4>🎞️ Transcoding</h4><ul><li>Converts video into multiple:</li><li>Resolutions (360p, 720p, 1080p)</li><li>Formats (H.264, H.265, etc.)</li></ul><h4>🔊 Audio Processing</h4><ul><li>Extracts audio tracks</li><li>Normalizes or compresses audio if required</li></ul><h4>Why fan-out?</h4><ul><li>Faster processing</li><li>Independent scaling</li><li>One failure doesn’t block others</li></ul><h4>8: Build Streaming Manifests</h4><p><strong>Pattern: Aggregation Pattern</strong></p><p>After all processing tasks finish:</p><ul><li>Outputs are collected</li><li>Streaming manifest files (HLS/DASH) are generated</li><li>Manifests are stored in object storage</li></ul><p>Manifests allow adaptive bitrate streaming based on user bandwidth.</p><h4>9: Mark Video as Ready</h4><p><strong>Pattern: State Transition Pattern</strong></p><p>Once processing completes:</p><ul><li>Video status is updated to DONE</li><li>Final storage URLs are saved in metadata DB</li></ul><p>This enables the frontend to know exactly when the video becomes playable.</p><h4>10: Video Playback</h4><p><strong>Pattern: CDN-Friendly Read Path</strong></p><p>For playback:</p><ol><li>Client requests video metadata</li><li>Backend returns manifest URLs</li><li>Client streams video segments directly from storage or CDN</li></ol><p>The backend is <strong>not</strong> in the streaming path.</p><h4>Why this works well</h4><ul><li>Minimal backend load</li><li>High throughput</li><li>Global low-latency delivery</li></ul><p><strong>Design Patterns Used (Quick Summary)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*q2zRz_y-gEw3z1XOtQ4Uvg.png" /></figure><h4>Why This Architecture Scales</h4><ul><li>Uploads bypass backend servers</li><li>Processing is fully asynchronous</li><li>Services are loosely coupled</li><li>Reads are CDN-optimized</li><li>Each component scales independently</li></ul><p>This is the same architectural philosophy used by large-scale video platforms.</p><h4>Final Thoughts</h4><p>A scalable video system isn’t about one powerful service — it’s about <strong>separation of concerns, asynchronous workflows, and event-driven design</strong>.</p><p>If you design the upload path, processing pipeline, and playback flow independently, you get:</p><ul><li>Better performance</li><li>Higher reliability</li><li>Lower cost</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b5b176fd9334" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitOps with ArgoCD on Amazon EKS Using Terraform: A Complete Production-Grade Implementation Guide]]></title>
            <link>https://medium.com/@amit151993/gitops-with-argocd-on-amazon-eks-using-terraform-a-complete-production-grade-implementation-guide-e29e77cf8a39?source=rss-18e9a2b5c299------2</link>
            <guid isPermaLink="false">https://medium.com/p/e29e77cf8a39</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[argo-cd]]></category>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[gitops]]></category>
            <dc:creator><![CDATA[Amit Singh]]></dc:creator>
            <pubDate>Sat, 10 Jan 2026 06:43:11 GMT</pubDate>
            <atom:updated>2026-01-10T06:43:11.792Z</atom:updated>
            <content:encoded><![CDATA[<p>GitOps has become the preferred operational model for Kubernetes because it brings <strong>declarative, version-controlled, automated deployments</strong> powered by tools like <strong>ArgoCD</strong>. When combined with <strong>Amazon EKS</strong> and <strong>Terraform</strong>, you get a fully repeatable, production-ready, infrastructure-as-code workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FnGf_lo4o-qulpyoS0OWyw.png" /></figure><h3>GitOps Workflow</h3><ol><li>Developer pushes code → Git repository (manifests/Helm charts).</li><li>ArgoCD monitors the repo using <strong>pull-based automation</strong>.</li><li>ArgoCD syncs changes to <strong>EKS cluster</strong>.</li><li>Kubernetes deploys updated workloads.</li></ol><h4>Components:</h4><p>Recommended layout:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/907/1*eto9TJCyrQk9I3kYm--4oQ.png" /></figure><h4>✅ Complete Terraform Repository (Production-Level)</h4><p>This includes:</p><p>✔ Production VPC<br> ✔ EKS Cluster (private endpoint, IRSA, logging, multi-AZ)<br> ✔ Managed Node Groups<br> ✔ ArgoCD installed via Helm<br> ✔ ArgoCD Applications<br> ✔ AWS Load Balancer Controller<br> ✔ ExternalDNS<br> ✔ Cert-Manager<br> ✔ Metrics Server<br> ✔ Cluster Autoscaler</p><h4>📁 Repository Structure</h4><pre>terraform-gitops-eks/<br>│── README.md<br>│── versions.tf<br>│── providers.tf<br>│── main.tf<br>│── variables.tf<br>│── outputs.tf<br>│<br>├── modules/<br>│   ├── vpc/<br>│   │    ├── main.tf<br>│   │    ├── variables.tf<br>│   │    └── outputs.tf<br>│   │<br>│   ├── eks/<br>│   │    ├── main.tf<br>│   │    ├── variables.tf<br>│   │    └── outputs.tf<br>│   │<br>│   ├── argocd/<br>│   │    ├── main.tf<br>│   │    └── values.yaml<br>│   │<br>│   └── addons/<br>│        ├── alb-controller.tf<br>│        ├── external-dns.tf<br>│        ├── cert-manager.tf<br>│        ├── metrics-server.tf<br>│        └── cluster-autoscaler.tf<br>│<br>└── apps/<br>     ├── sample-app.yaml<br>     └── project-prod.yaml</pre><h4>🔹 Root Files (Top Level Terraform)</h4><h4>versions.tf</h4><pre>terraform {<br>  required_version = &quot;&gt;= 1.6.0&quot;<br>  required_providers {<br>    aws = {<br>      source  = &quot;hashicorp/aws&quot;<br>      version = &quot;~&gt; 5.0&quot;<br>    }<br>    helm = {<br>      source  = &quot;hashicorp/helm&quot;<br>      version = &quot;~&gt; 2.9&quot;<br>    }<br>    kubernetes = {<br>      source  = &quot;hashicorp/kubernetes&quot;<br>      version = &quot;~&gt; 2.24&quot;<br>    }<br>    kubectl = {<br>      source  = &quot;alekc/kubectl&quot;<br>      version = &quot;&gt;= 2.0.0&quot;<br>    }<br>  }<br>}</pre><h4>providers.tf</h4><pre>provider &quot;aws&quot; {<br>  region = var.region<br>}<br>provider &quot;kubernetes&quot; {<br>  config_path = &quot;~/.kube/config&quot;<br>}<br>provider &quot;helm&quot; {<br>  kubernetes {<br>    config_path = &quot;~/.kube/config&quot;<br>  }<br>}</pre><h4>main.tf</h4><pre>module &quot;vpc&quot; {<br>  source = &quot;./modules/vpc&quot;<br><br>  name   = &quot;gitops-vpc&quot;<br>  cidr   = &quot;10.0.0.0/16&quot;<br>  azs    = var.azs<br>}<br><br>module &quot;eks&quot; {<br>  source = &quot;./modules/eks&quot;<br><br>  cluster_name    = var.cluster_name<br>  cluster_version = var.cluster_version<br><br>  vpc_id     = module.vpc.vpc_id<br>  subnet_ids = module.vpc.private_subnets<br>}<br><br>module &quot;argocd&quot; {<br>  source = &quot;./modules/argocd&quot;<br>}<br><br>module &quot;addons&quot; {<br>  source = &quot;./modules/addons&quot;<br><br>  cluster_name = module.eks.cluster_name<br>  cluster_oidc = module.eks.oidc_provider_arn<br>}</pre><h4>variables.tf</h4><pre>variable &quot;region&quot; {<br>  default = &quot;ap-south-1&quot;<br>}<br><br>variable &quot;cluster_name&quot; {<br>  default = &quot;prod-gitops-eks&quot;<br>}<br><br>variable &quot;cluster_version&quot; {<br>  default = &quot;1.30&quot;<br>}<br><br>variable &quot;azs&quot; {<br>  default = [&quot;ap-south-1a&quot;, &quot;ap-south-1b&quot;, &quot;ap-south-1c&quot;]<br>}</pre><h4><strong>outputs.tf</strong></h4><pre>output &quot;eks_cluster_endpoint&quot; {<br>  value = module.eks.cluster_endpoint<br>}<br>output &quot;eks_cluster_name&quot; {<br>  value = module.eks.cluster_name<br>}<br>output &quot;vpc_id&quot; {<br>  value = module.vpc.vpc_id<br>}</pre><h4>🔹 Module: VPC</h4><h4>modules/vpc/main.tf</h4><pre>module &quot;vpc&quot; {<br>  source = &quot;terraform-aws-modules/vpc/aws&quot;<br><br>  name = var.name<br>  cidr = var.cidr<br><br>  azs = var.azs<br><br>  private_subnets = [<br>    &quot;10.0.1.0/24&quot;,<br>    &quot;10.0.2.0/24&quot;,<br>    &quot;10.0.3.0/24&quot;<br>  ]<br><br>  public_subnets = [<br>    &quot;10.0.11.0/24&quot;,<br>    &quot;10.0.12.0/24&quot;,<br>    &quot;10.0.13.0/24&quot;<br>  ]<br><br>  enable_nat_gateway = true<br>  enable_dns_hostnames = true<br>  enable_dns_support = true<br>}</pre><h4>modules/vpc/variables.tf</h4><pre>variable &quot;name&quot; {}<br>variable &quot;cidr&quot; {}<br>variable &quot;azs&quot; {}</pre><h4>🔹 Module: EKS</h4><h4>modules/eks/main.tf</h4><pre>module &quot;eks&quot; {<br>  source  = &quot;terraform-aws-modules/eks/aws&quot;<br><br>  cluster_name    = var.cluster_name<br>  cluster_version = var.cluster_version<br><br>  vpc_id     = var.vpc_id<br>  subnet_ids = var.subnet_ids<br><br>  enable_irsa = true<br><br>  cluster_endpoint_private_access = true<br>  cluster_endpoint_public_access  = false<br><br>  eks_managed_node_groups = {<br>    system = {<br>      instance_types = [&quot;t3.large&quot;]<br>      desired_size   = 3<br>    }<br><br>    workloads = {<br>      instance_types = [&quot;m5.large&quot;]<br>      desired_size   = 4<br>      capacity_type  = &quot;SPOT&quot;<br>    }<br>  }<br>}</pre><h4><strong>modules/eks/outputs.tf</strong></h4><pre>output &quot;cluster_name&quot;      { value = module.eks.cluster_name }<br>output &quot;cluster_endpoint&quot;  { value = module.eks.cluster_endpoint }<br>output &quot;oidc_provider_arn&quot; { value = module.eks.oidc_provider_arn }</pre><h4>🔹 Module: ArgoCD</h4><h4>modules/argocd/main.tf</h4><pre>resource &quot;helm_release&quot; &quot;argocd&quot; {<br>  name             = &quot;argocd&quot;<br>  namespace        = &quot;argocd&quot;<br>  create_namespace = true<br><br>  repository = &quot;https://argoproj.github.io/argo-helm&quot;<br>  chart      = &quot;argo-cd&quot;<br>  version    = &quot;7.3.7&quot;<br><br>  values = [<br>    file(&quot;${path.module}/values.yaml&quot;)<br>  ]<br>}</pre><h4>modules/argocd/values.yaml</h4><pre>server:<br>  service:<br>    type: LoadBalancer<br><br>controller:<br>  replicas: 2<br><br>redis:<br>  enabled: true<br><br>configs:<br>  cm:<br>    timeout.reconciliation: 30s<br>    accounts.admin.enabled: &quot;true&quot;<br><br>dex:<br>  enabled: true</pre><h4>🔹 Module: Addons</h4><p>Includes:</p><p>1️⃣ AWS Load Balancer Controller</p><p>2️⃣ ExternalDNS</p><p>3️⃣ Cert-Manager</p><p>4️⃣ Metrics Server</p><p>5️⃣ Cluster Autoscaler</p><h4>modules/addons/alb-controller.tf</h4><pre>resource &quot;helm_release&quot; &quot;aws_load_balancer_controller&quot; {<br>  name       = &quot;aws-load-balancer-controller&quot;<br>  namespace  = &quot;kube-system&quot;<br><br>  repository = &quot;https://aws.github.io/eks-charts&quot;<br>  chart      = &quot;aws-load-balancer-controller&quot;<br><br>  values = [<br>    &lt;&lt;EOF<br>clusterName: ${var.cluster_name}<br>serviceAccount:<br>  create: false<br>  name: aws-load-balancer-controller<br>EOF<br>  ]<br>}</pre><h4>modules/addons/external-dns.tf</h4><pre>resource &quot;helm_release&quot; &quot;external_dns&quot; {<br>  name       = &quot;external-dns&quot;<br>  namespace  = &quot;kube-system&quot;<br><br>  repository = &quot;https://kubernetes-sigs.github.io/external-dns/&quot;<br>  chart      = &quot;external-dns&quot;<br><br>  values = [&lt;&lt;EOF<br>provider: aws<br>policy: sync<br>registry: txt<br>txtOwnerId: external-dns<br>EOF<br>  ]<br>}</pre><h4>modules/addons/cert-manager.tf</h4><pre>resource &quot;helm_release&quot; &quot;cert_manager&quot; {<br>  name       = &quot;cert-manager&quot;<br>  namespace  = &quot;cert-manager&quot;<br>  create_namespace = true<br><br>  repository = &quot;https://charts.jetstack.io&quot;<br>  chart      = &quot;cert-manager&quot;<br><br>  set {<br>    name  = &quot;installCRDs&quot;<br>    value = &quot;true&quot;<br>  }<br>}</pre><h4>modules/addons/metrics-server.tf</h4><pre>resource &quot;helm_release&quot; &quot;metrics_server&quot; {<br>  name       = &quot;metrics-server&quot;<br>  namespace  = &quot;kube-system&quot;<br><br>  repository = &quot;https://kubernetes-sigs.github.io/metrics-server/&quot;<br>  chart      = &quot;metrics-server&quot;<br>}</pre><h4>modules/addons/cluster-autoscaler.tf</h4><pre>resource &quot;helm_release&quot; &quot;cluster_autoscaler&quot; {<br>  name      = &quot;cluster-autoscaler&quot;<br>  namespace = &quot;kube-system&quot;<br><br>  repository = &quot;https://kubernetes.github.io/autoscaler&quot;<br>  chart      = &quot;cluster-autoscaler&quot;<br><br>  values = [&lt;&lt;EOF<br>autoDiscovery:<br>  clusterName: ${var.cluster_name}<br>awsRegion: ${var.region}<br>EOF<br>  ]<br>}</pre><h4>🔹 Apps (ArgoCD Applications)</h4><h4>apps/sample-app.yaml</h4><pre>apiVersion: argoproj.io/v1alpha1<br>kind: Application<br>metadata:<br>  name: sample-app<br>  namespace: argocd<br>spec:<br>  project: prod<br>  source:<br>    repoURL: https://github.com/example/gitops-apps.git<br>    path: sample-app<br>    targetRevision: main<br>  destination:<br>    server: https://kubernetes.default.svc<br>    namespace: production<br>  syncPolicy:<br>    automated:<br>      prune: true<br>      selfHeal: true</pre><h4>apps/project-prod.yaml</h4><pre>apiVersion: argoproj.io/v1alpha1<br>kind: AppProject<br>metadata:<br>  name: prod<br>  namespace: argocd<br>spec:<br>  destinations:<br>  - namespace: production<br>    server: https://kubernetes.default.svc<br>  sourceRepos:<br>  - &#39;*&#39;</pre><h4>🎉 Your Production Repository Is Ready</h4><p>You now have a <strong>complete, modular, scalable, enterprise-grade Terraform repository</strong> for:</p><p>✔ AWS VPC<br> ✔ Amazon EKS<br> ✔ GitOps with ArgoCD<br> ✔ Observability addons<br> ✔ Autoscaling<br> ✔ Secure private endpoints<br> ✔ Multi-AZ node groups</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e29e77cf8a39" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How 3-Tier Architecture Works in AWS: Web, App, and DB Layers Explained]]></title>
            <link>https://medium.com/@amit151993/how-3-tier-architecture-works-in-aws-web-app-and-db-layers-explained-bf1be56cde7a?source=rss-18e9a2b5c299------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf1be56cde7a</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[Amit Singh]]></dc:creator>
            <pubDate>Tue, 06 Jan 2026 01:50:21 GMT</pubDate>
            <atom:updated>2026-01-06T01:50:21.106Z</atom:updated>
            <content:encoded><![CDATA[<p>A 3-tier architecture in AWS is a cloud design model that separates the application into <strong>Web</strong>, <strong>Application</strong>, and <strong>Database </strong>tiers, typically deployed across multiple subnets inside a VPC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c0xFgJLnhg4d0n7RYELIIg.png" /></figure><p>This improves <strong>scalability</strong>, <strong>security</strong>, and <strong>fault isolation</strong>.</p><h4>🔹 Tier 1: Presentation Layer (Web Tier)</h4><p>This is the <strong>front-end</strong> layer where users interact with the application.</p><p>Common AWS components:</p><ul><li><strong>Amazon CloudFront</strong> (CDN)</li><li><strong>Application Load Balancer (ALB)</strong></li><li><strong>EC2 instances in public subnet</strong> / <strong>AWS Amplify</strong> / <strong>S3 static website</strong></li></ul><p>Purpose:</p><ul><li>Handle HTTP/HTTPS requests</li><li>Forward traffic to the application tier</li></ul><h4>🔹 Tier 2: Application Layer (App Tier)</h4><p>This is the <strong>business logic</strong> layer.</p><p>Common AWS components:</p><ul><li><strong>EC2 Auto Scaling Group (ASG)</strong> in private subnets</li><li><strong>ECS / EKS application containers</strong></li><li><strong>Lambda (serverless app tier)</strong></li></ul><p>Purpose:</p><ul><li>Process requests</li><li>Execute application logic</li><li>Talk to the database tier</li></ul><h4>🔹 Tier 3: Database Layer (DB Tier)</h4><p>This is the <strong>storage layer</strong>.</p><p>Common AWS components:</p><ul><li><strong>Amazon RDS (MySQL, PostgreSQL, MariaDB, SQL Server)</strong></li><li><strong>Amazon Aurora</strong></li><li><strong>DynamoDB</strong></li><li><strong>ElastiCache (Redis / Memcached)</strong></li></ul><p>Purpose:</p><ul><li>Store and retrieve structured/unstructured data</li></ul><h4>🚀 How AWS Implements a Secure 3-Tier Architecture</h4><h4>✔ Public subnet → Web Tier</h4><p>Accessible from the internet.</p><h4>✔ Private subnet → App Tier</h4><p>Accessible only from Web Tier.</p><h4>✔ Private isolated subnet → DB Tier</h4><p>Accessible only from App Tier.</p><p>This ensures:</p><ul><li>DB is never exposed to the internet</li><li>App tier is only accessible through the load balancer</li><li>Security groups strictly control traffic</li></ul><p>🔐 <strong>Security Flow Example</strong></p><pre>-------------------------------------<br>| Source   | Destination | Allowed? |<br>| -------- | ----------- | -------- |<br>| Internet | Web Tier    | ✔        |<br>| Web Tier | App Tier    | ✔        |<br>| App Tier | DB Tier     | ✔        |<br>| Internet | App Tier    | ❌       |<br>| Internet | DB Tier     | ❌       |<br>-------------------------------------</pre><h4>📊 Why 3-Tier Architecture Is Used in AWS</h4><h4>1. High Scalability</h4><p>Each tier can scale independently.</p><h4>2. High Security</h4><p>Tiers are isolated using VPC, SG, and NACLs.</p><h4>3. High Availability</h4><p>Deploy tiers in multiple AZs.</p><h4>4. Easy Maintainability</h4><p>Updates to one layer do not affect other layers.</p><h4>5. Reusable Architecture Pattern</h4><p>Used for most enterprise-grade applications.</p><h4>🧩 Example Real-World Implementation</h4><ul><li>CloudFront → ALB → App servers → RDS</li><li>S3 static hosting → Lambda API → DynamoDB</li><li>ALB → ECS/EKS → Aurora</li></ul><p>All fit the 3-tier model.</p><h3>📝 Summary</h3><p>AWS 3-tier architecture separates your application into Web, App, and Database layers to achieve secure, scalable, and modular cloud deployments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf1be56cde7a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Design Made Easy: Core Concepts Explained with Simple Analogies]]></title>
            <link>https://medium.com/@amit151993/system-design-made-easy-core-concepts-explained-with-simple-analogies-9d6a585b2423?source=rss-18e9a2b5c299------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d6a585b2423</guid>
            <category><![CDATA[caching]]></category>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[asynchronous]]></category>
            <dc:creator><![CDATA[Amit Singh]]></dc:creator>
            <pubDate>Mon, 05 Jan 2026 01:19:58 GMT</pubDate>
            <atom:updated>2026-01-05T01:19:58.338Z</atom:updated>
            <content:encoded><![CDATA[<p>Understanding system design becomes much simpler when you relate it to everyday life. Let’s break down five core system-design concepts using common, real-world examples anyone can understand.</p><h3>1. Load Balancing</h3><p>Imagine you own a grocery store.</p><p>On normal days, one cashier is enough. Customers check out quickly and everyone’s happy. But during the festive season, hundreds of shoppers arrive at once. A single checkout counter creates long lines, customers get impatient, and many leave without buying anything.</p><p>So you hire ten more cashiers.</p><p>Now a new problem appears.</p><p>Customers don’t know which counter is free. Everyone rushes to the first one they see while others remain idle. What you actually need is someone at the entrance to guide customers to the least busy counter.</p><p>In system design, that role is played by a <strong>load balancer</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*GvcX7dOWfLOmDm0AydaO7Q.jpeg" /></figure><p><strong>What it does:</strong><br>A load balancer sits between users and backend servers and spreads incoming traffic across multiple servers so that no single server becomes overloaded.</p><p><strong>How it works:</strong><br>When a user opens your website, their request first reaches the load balancer — not your application server. The load balancer checks which servers are healthy and available, then forwards the request to the best one.</p><p>Common routing strategies include:</p><ul><li><strong>Round Robin:</strong> Requests are distributed sequentially — Server A, then B, then C, and back to A.</li><li><strong>Least Connections:</strong> The request is sent to the server currently handling the fewest active users.</li></ul><p>Without a load balancer, your system has a <strong>single point of failure</strong>. If one server crashes, your entire application goes down.</p><p>With a load balancer, failures are invisible. If one server becomes unhealthy, traffic is automatically redirected to others using health checks.</p><h3>2. Caching: Working Smarter, Not Harder</h3><p>Imagine you’re writing a difficult exam.</p><p>Every time you need a formula, you open a huge textbook and search for it. This slows you down. A smarter approach is to write the most-used formulas on a small note beside you.</p><p>Now you check the note first. Only if the formula isn’t there do you open the book.</p><p>In this analogy:</p><ul><li>The textbook is the <strong>database</strong></li><li>The note is the <strong>cache</strong></li></ul><p><strong>What caching is:</strong><br>Caching stores frequently accessed data in a fast storage layer — usually RAM — so it can be retrieved almost instantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*abVMshLrVUZ5K61ifRQDuA.jpeg" /></figure><p><strong>How it works:</strong><br>Databases store data on disk, which is reliable but slow. RAM is much faster.</p><p>Typical cache flow:</p><ol><li>User requests data</li><li>Application checks the cache</li><li><strong>Cache hit:</strong> Data is returned immediately</li><li><strong>Cache miss:</strong> Database is queried</li><li>Data is returned and stored in cache for future use</li></ol><p>Most real-world systems are <strong>read-heavy</strong>.</p><p>Think about social media. You post once, but scroll hundreds of times. Without caching, every scroll would hit the database, overwhelming it.</p><p>Caching absorbs repetitive reads and dramatically improves performance.</p><h3>3. Database Replication</h3><p>Imagine you’re a famous author with only one copy of your book.</p><p>Thousands of people want to read it, but only one person can hold it at a time. Worse, if that book is damaged, the story is gone forever.</p><p>To solve this, you print multiple copies.</p><p>You keep the original for writing new chapters and give copies to assistants. Readers go to the assistants, while updates flow from you to them.</p><p>That’s <strong>database replication</strong>.</p><p><strong>What it is:</strong><br>Replication means maintaining multiple copies of the same data across different servers.</p><p><strong>How it works:</strong><br>Most systems use a <strong>Leader–Follower (Master–Replica)</strong> setup.</p><ul><li><strong>Leader (Master):</strong> Handles all write operations</li><li><strong>Followers (Read Replicas):</strong> Copy data from the leader and handle read requests</li></ul><p>Reads are distributed across replicas, allowing millions of users to access data simultaneously.</p><p>Replication improves:</p><ul><li><strong>Performance:</strong> Writes and reads are separated</li><li><strong>Reliability:</strong> If the leader fails, a replica can take over</li></ul><h3>4. Database Sharding: Scaling Beyond Limits</h3><p>Imagine a library that grows so large it can no longer fit all its books in one building.</p><p>Hiring more librarians won’t help. The only solution is to build another library and split the collection.</p><p>For example:</p><ul><li>Library A stores authors A–M</li><li>Library B stores authors N–Z</li></ul><p>If someone wants a book by Orwell, they know exactly where to go.</p><p>This is <strong>database sharding</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2of593g7FgktlBRcIzmtFg.png" /></figure><p><strong>What it is:</strong><br>Sharding splits a large dataset into smaller pieces (shards), each stored on a different server.</p><p><strong>How it works:</strong><br>Sharding is a form of <strong>horizontal scaling</strong> — adding more machines instead of upgrading a single one.</p><p>Data is split using a <strong>partition key</strong>, such as user ID:</p><ul><li>User IDs 1–10M → Shard 1</li><li>User IDs 10M–20M → Shard 2</li></ul><p>Sharding enables systems to store massive datasets that would be impossible to manage on a single server.</p><p><strong>Trade-off:</strong><br>Cross-shard queries are complex, which is why sharding is usually introduced only when other scaling methods are no longer sufficient.</p><h3>5. Asynchronous Processing with Message Queues</h3><p>Imagine ordering a pizza.</p><p><strong>Synchronous approach:</strong><br>You place the order and stay on the phone while the pizza is being baked. You’re stuck waiting.</p><p><strong>Asynchronous approach:</strong><br>You place the order, hang up, and get notified when the pizza is ready. You’re free to do other things.</p><p>Modern systems prefer the second approach.</p><p><strong>What it is:</strong><br>Asynchronous processing allows a system to accept a request immediately and handle the heavy work later in the background.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57WXI8XqH2V2jdlRII5zRA.jpeg" /></figure><p><strong>How it works:</strong><br>A message queue (like RabbitMQ or Kafka) stores tasks until worker servers process them.</p><p>Example: image processing</p><ol><li>User uploads an image</li><li>Web server puts a job into the queue</li><li>User immediately sees “Upload successful”</li><li>Worker servers process jobs independently</li><li>User is notified once processing completes</li></ol><p>Queues protect your system during traffic spikes. Even if thousands of requests arrive at once, jobs are processed smoothly without crashing the application.</p><h3>Conclusion</h3><p>System design is about thinking beyond code.</p><p>It’s about building systems that can scale, survive failures, and handle real-world traffic.</p><p>You don’t need all these patterns on day one. Start simple. Introduce complexity only when necessary.</p><p><strong>Key takeaways:</strong></p><ul><li>Load balancing distributes traffic evenly</li><li>Caching speeds up responses and reduces database load</li><li>Replication improves read performance and reliability</li><li>Sharding enables massive data storage</li><li>Asynchronous processing keeps applications responsive</li></ul><p>Mastering these fundamentals is the first real step toward becoming a strong software architect.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d6a585b2423" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DevSecOps Security Explained: Nessus vs Black Duck vs Trivy]]></title>
            <link>https://medium.com/@amit151993/devsecops-security-explained-nessus-vs-black-duck-vs-trivy-311021563dcb?source=rss-18e9a2b5c299------2</link>
            <guid isPermaLink="false">https://medium.com/p/311021563dcb</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Amit Singh]]></dc:creator>
            <pubDate>Sun, 04 Jan 2026 15:03:55 GMT</pubDate>
            <atom:updated>2026-01-04T15:05:38.286Z</atom:updated>
            <content:encoded><![CDATA[<p>In modern software delivery, <strong>security cannot be an afterthought</strong>. With cloud-native apps, containers, and open-source dependencies everywhere, vulnerabilities can enter your system at multiple layers.</p><p>This is where <strong>DevSecOps vulnerability scanning</strong> comes in.</p><p>In this article, we’ll clearly explain <strong>what vulnerability scanning is</strong>, <strong>why it matters</strong>, and how three industry-standard tools — <strong>Nessus</strong>, <strong>Black Duck</strong>, and <strong>Trivy</strong> — fit together in a <strong>real production CI/CD pipeline</strong>.</p><h4>🚨 Why Vulnerability Scanning Is Mandatory Today</h4><p>Modern applications are exposed to risks at every stage:</p><ul><li>🧩 Open-source libraries with known CVEs</li><li>🐳 Container images with outdated OS packages</li><li>☁️ Cloud VMs with insecure services or ports</li><li>⚖️ License violations that can cause legal issues</li></ul><blockquote><strong><em>Fact:</em></strong><em> Over 90% of applications contain open-source components, and attackers actively scan for known vulnerabilities.</em></blockquote><p>That’s why <strong>one security tool is never enough</strong>.</p><h4>🔍 1. Nessus — Infrastructure &amp; Network Vulnerability Scanning</h4><p><strong>Nessus</strong> is a <strong>network and infrastructure vulnerability scanner</strong> widely used in enterprises and compliance audits.</p><h4>🔍 What Nessus Scans</h4><ul><li>Linux &amp; Windows servers</li><li>Cloud VMs (EC2, Azure VM)</li><li>Open ports &amp; exposed services</li><li>OS-level CVEs (OpenSSL, SSH, Kernel)</li><li>Security misconfigurations</li></ul><h4>⚙️ How Nessus Works</h4><ul><li>Uses a constantly updated CVE plugin database</li><li>Agent-based or agentless scanning</li><li>Detects vulnerabilities <strong>after deployment</strong></li></ul><h3>📌 Real-World Use Case</h3><ul><li>Scan EC2 instances after production deployment</li><li>Identify weak SSH configs or outdated packages</li><li>Meet compliance (CIS, ISO, PCI-DSS)</li></ul><h4>📦 2. Black Duck — Open Source &amp; License Security</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qafTccIqvBsh1EoxM17Nkw.jpeg" /></figure><h4>🔍 What Black Duck Scans</h4><ul><li>Open-source dependencies</li><li>Vulnerable libraries (Log4j, Spring, lodash)</li><li>License compliance (GPL, MIT, Apache)</li><li>Dependency risk &amp; policy violations</li></ul><h4>🧠 How It Works</h4><ul><li>Matches dependencies with Synopsys knowledge base</li><li>Detects direct &amp; transitive dependencies</li><li>Enforces license and security policies in CI</li></ul><h4>📌Example Use Case</h4><ul><li>Block builds using GPL licenses</li><li>Detect vulnerable libraries before release</li><li>Maintain legal and security compliance</li><li>Block builds with critical CVEs</li><li>Audit third-party dependencies</li></ul><h4>🐳 3. Trivy — Container, Image &amp; Kubernetes Security</h4><p><strong>Trivy</strong> is a lightweight, DevOps-friendly scanner designed for <strong>shift-left security</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*78L6jQUCJrbeoe5919wLeQ.jpeg" /></figure><h4>🔍 What Trivy Scans</h4><ul><li>Docker container images</li><li>OS packages inside images</li><li>Application dependencies</li><li>Kubernetes YAML misconfigurations</li><li>Hardcoded secrets &amp; tokens</li></ul><h4>⚙️ How Trivy Works</h4><ul><li>Simple CLI tool</li><li>Fast scans during CI</li><li>Fails builds on critical vulnerabilities</li></ul><h4>📌 Example Use Case</h4><ul><li>Scan Docker images before pushing to registry</li><li>Block vulnerable base images</li><li>Secure Kubernetes deployments early</li></ul><h4>🛠️ Sample CI Integration (Trivy Example)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ILSuLiuHMnZ_eoWM.png" /></figure><pre># Scan a Docker Image<br>trivy image myapp:latest --severity HIGH,CRITICAL --exit-code 1<br><br># Scan Running Kubernetes Cluster<br>trivy k8s --report summary cluster<br><br># Generate JSON Report<br>trivy image --format json -o trivy-report.json myapp:latest</pre><p>✔️ Fails pipeline on critical vulnerabilities<br> ✔️ Easy shift-left security</p><h4>🔐 Best-Practice Flow</h4><ol><li><strong>Trivy</strong> → scan Docker images &amp; K8s YAML (CI)</li><li><strong>Black Duck</strong> → scan dependencies &amp; licenses (CI)</li><li><strong>Nessus</strong> → scan deployed servers &amp; networks (post-deploy)</li></ol><h3>✍️ Final Thoughts</h3><p><strong><em>Nessus Scan:</em></strong></p><blockquote><strong>Nessus </strong><em>performs deep infrastructure vulnerability scans by </em><strong><em>analyzing servers, operating systems</em></strong><em>, and </em><strong><em>exposed network services </em></strong><em>using an extensive </em><strong><em>CVE</em></strong><em> plugin database.</em></blockquote><p><strong><em>Black Duck Scan:</em></strong></p><blockquote><strong>Black Duck</strong><em> enforces secure and compliant software delivery by identifying vulnerable </em><strong><em>open-source dependencies </em></strong><em>and </em><strong><em>license risks early in the CI/CD pipeline</em></strong><em>, preventing security and legal issues before release.</em></blockquote><p><strong><em>Trivy Scan:</em></strong></p><blockquote><strong>Trivy </strong><em>enables true shift-left security by quickly </em><strong><em>scanning container images, dependencies, and Kubernetes configurations in CI/CD pipelines </em></strong><em>and blocking releases with critical vulnerabilities before they reach production.</em></blockquote><p>Security is no longer a separate team or phase. With the right tools and pipeline design, <strong>DevSecOps becomes part of everyday development</strong>.</p><p>If you’re building modern applications, understanding <strong>Nessus, Black Duck, and Trivy</strong> is no longer optional — it’s essential.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=311021563dcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding REST, GraphQL, gRPC, and API Gateways: A Practical Guide for Modern APIs]]></title>
            <link>https://medium.com/@amit151993/understanding-rest-graphql-grpc-and-api-gateways-a-practical-guide-for-modern-apis-7784d99bcd45?source=rss-18e9a2b5c299------2</link>
            <guid isPermaLink="false">https://medium.com/p/7784d99bcd45</guid>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[api-gateway]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[graphql]]></category>
            <dc:creator><![CDATA[Amit Singh]]></dc:creator>
            <pubDate>Sat, 03 Jan 2026 14:17:42 GMT</pubDate>
            <atom:updated>2026-01-04T05:35:50.641Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s distributed and cloud-native world, applications rarely live in isolation. They communicate constantly — between browsers and servers, mobile apps and backends, and microservices talking to each other.<br> To make this communication efficient and reliable, different API styles and patterns are used.</p><p>This article explains <strong>REST, GraphQL, gRPC, and API Gateways</strong> in a simple, practical way, with real-world examples to help you understand when and why each one is used.</p><h3>1. REST: The Foundation of Web APIs</h3><p>REST (Representational State Transfer) is the most widely used API style on the web. It allows clients to communicate with servers using standard HTTP methods such as <strong>GET, POST, PUT, and DELETE</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*xwluWaYTj91BtNVra77bTg.jpeg" /></figure><p>In REST, each URL represents a <strong>resource</strong> — for example, a user, order, or product. Data is usually exchanged in <strong>JSON</strong> format, which is easy for both humans and machines to read.</p><p>What makes REST so popular is its predictability. Each HTTP method has a clear and well-defined purpose:</p><ul><li><strong>GET</strong> retrieves data</li><li><strong>POST</strong> creates new data</li><li><strong>PUT</strong> updates existing data</li><li><strong>DELETE</strong> removes data</li></ul><p>Because of this simplicity, REST is easy to learn and works well across browsers, mobile apps, and backend systems. It has become the default choice for many public and internal APIs.</p><h4>Example</h4><p>Imagine an online bookstore:</p><ul><li>GET /books returns a list of all books</li><li>POST /books adds a new book</li><li>DELETE /books/10 removes the book with ID 10</li></ul><p>REST feels natural because URLs represent <em>things</em> and HTTP verbs represent <em>actions</em>.</p><h3>2. GraphQL: Flexible Data Fetching</h3><p>GraphQL takes a different approach by allowing the <strong>client to decide exactly what data it needs</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*VGKfg_aUuNIck_JUXTlYAA.jpeg" /></figure><p>Instead of receiving a fixed response from the server, the client sends a query describing the fields it wants. The server then returns <strong>only those fields</strong>, nothing more and nothing less.</p><p>This flexibility eliminates the need for multiple REST calls and reduces unnecessary data transfer. GraphQL uses a <strong>single endpoint</strong> and supports:</p><ul><li><strong>Queries</strong> (read data)</li><li><strong>Mutations</strong> (change data)</li><li><strong>Subscriptions</strong> (real-time updates)</li></ul><p>Developers prefer GraphQL for applications with complex or evolving data requirements, especially when different screens need different data shapes.</p><h4>Example</h4><p>A mobile app needs to display only a user’s <strong>name</strong> and <strong>profile picture</strong>, not the entire profile.</p><p>With GraphQL, the app requests just those two fields in one request.<br> This results in smaller responses, fewer network calls, and faster page loads — perfect for mobile and frontend-heavy applications.</p><h3>3. gRPC: High-Performance Service Communication</h3><p>gRPC is designed for <strong>fast and efficient communication between backend services</strong>.</p><p>Instead of JSON, gRPC uses <strong>Protocol Buffers (protobufs)</strong> —<strong> </strong>compact <strong>binary messages that are much smaller and faster to process.</strong> This makes gRPC ideal for <strong>high-traffic</strong> systems.</p><p>Key strengths of gRPC include:</p><ul><li>Very fast data transfer</li><li>Strong type safety</li><li>Built-in support for streaming</li><li>Efficient communication over HTTP/2</li></ul><p>Because of browser limitations, gRPC is not commonly used for frontend apps. However, it excels in <strong>microservice architectures</strong> where services need to communicate frequently and reliably.</p><h4>Example</h4><p>In a large system, a recommendation service may call a ranking service thousands of times per second.</p><p>Using REST with JSON would add unnecessary overhead. With gRPC, the services exchange small <strong>binary messages</strong> with <strong>very low latency</strong>, enabling <strong>high throughput </strong>and <strong>better performance</strong>.</p><h3>4. API Gateway: The Front Door to Microservices</h3><p>An API Gateway acts as a <strong>single entry point</strong> for all client requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMRhHn3JjhR-0rgCKytbgw.jpeg" /></figure><p>Instead of clients calling multiple backend services directly, they <strong>communicate only with the gateway</strong>. The gateway then <strong>forwards requests to the appropriate service</strong>.</p><p>An API Gateway typically handles:</p><ul><li><strong>Request routing</strong></li><li><strong>Authentication and authorization</strong></li><li><strong>Rate limiting</strong></li><li><strong>Logging and monitoring</strong></li><li><strong>Request and response transformation</strong></li></ul><p>This setup keeps microservices lightweight and focused on business logic while centralizing cross-cutting concerns like security and traffic management.</p><p>API gateways are especially <strong>useful in large systems</strong>, where consistent security rules and traffic controls are required across many services.</p><h3>Final Thoughts</h3><p>Each API approach serves a different purpose:</p><ul><li><strong>REST</strong> is simple, predictable, and widely supported</li><li><strong>GraphQL</strong> offers flexibility and efficient data fetching</li><li><strong>gRPC</strong> delivers high performance for service-to-service communication</li><li><strong>API Gateways</strong> simplify and secure access to complex systems</li></ul><p>Understanding these tools — and knowing when to use each — helps you design scalable, maintainable, and high-performing systems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7784d99bcd45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Efficient Databases with SQL: Optimization, Normalization & Integrity]]></title>
            <link>https://medium.com/@amit151993/building-efficient-databases-with-sql-optimization-normalization-integrity-41a4b4bff5b4?source=rss-18e9a2b5c299------2</link>
            <guid isPermaLink="false">https://medium.com/p/41a4b4bff5b4</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[normalization]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Amit Singh]]></dc:creator>
            <pubDate>Sat, 03 Jan 2026 11:33:02 GMT</pubDate>
            <atom:updated>2026-01-04T05:40:00.309Z</atom:updated>
            <content:encoded><![CDATA[<h3>Query Optimization:</h3><p><strong>Query Optimization in SQL</strong> is the process of <strong>improving SQL query performance, </strong>making database queries <strong>cost-effective</strong>, meaning they consume <strong>minimum execution time and system resources</strong> (CPU, memory, and disk I/O) while returning the same result set.</p><p>Optimization techniques include:</p><ul><li>Using <strong>indexes</strong> effectively</li><li><strong>Rewriting queries</strong> to remove unnecessary joins or subqueries</li><li><strong>Partitioning large tables</strong> to limit data scans</li><li><strong>Eliminating full table scans</strong> wherever possible</li><li>Uses <strong>less CPU &amp; memory</strong></li><li>Reads <strong>fewer rows</strong></li><li>Executes <strong>faster</strong>, especially on large datasets</li></ul><p>👉 The goal is to <strong>get the same result in the most efficient way possible</strong>.</p><h4>🧠 Role of the Query Optimizer</h4><p>Most SQL databases use a <strong>query optimizer</strong> that automatically analyzes the structure of a SQL statement and generates multiple <strong>execution plans</strong>.<br> It then selects the <strong>most efficient plan</strong> based on factors such as:</p><ul><li>Available indexes</li><li>Data distribution and statistics</li><li>Join methods and order</li><li>Estimated query cost</li></ul><p>This cost-based approach ensures <strong>higher performance without changing the query result</strong>.</p><h4>📊 What is an Execution Plan?</h4><p>An <strong>Execution Plan</strong> shows <strong>how the database will execute your query</strong>.</p><pre>EXPLAIN SELECT * FROM orders WHERE customer_id = 101;<br><br>EXPLAIN ANALYZE SELECT * FROM orders WHERE customer_id = 101;</pre><h4>Execution Plan tells you:</h4><ul><li>Index Scan vs Table Scan</li><li>Estimated vs actual rows</li><li>Cost of each step</li><li>Join method used</li></ul><p>👉 <strong>Always check execution plans for slow queries</strong></p><h3>Normalization in SQL:</h3><p><strong>Normalization</strong> is the process of <strong>organizing data in a relational database</strong> to:</p><ul><li>Reduce <strong>data redundancy </strong>and <strong>dependency</strong></li><li>Improve <strong>data integrity</strong></li><li>Make the database <strong>efficient, consistent, and scalable</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*RatSSGqxinBn8aGicUkIbQ.jpeg" /></figure><p>It is done by dividing large tables into <strong>smaller, related tables</strong> using <strong>primary keys</strong> and <strong>foreign keys</strong>, following <strong>normal forms</strong> (1NF, 2NF, 3NF, 4NF, etc.).</p><ul><li><strong>1NF</strong>: Removes duplicate columns.</li><li><strong>2NF</strong>: Ensures all non-key attributes are fully functional dependent on the primary key.</li><li><strong>3NF</strong>: Removes transitive dependency.</li><li><strong>4NF</strong>: Removes multi-valued dependencies.</li></ul><h4>🌟 Advantages of Normalization</h4><h4>1️⃣ Reduces Data Redundancy</h4><p>✔️ Eliminates duplicate data across tables<br> ✔️ Saves storage space<br> ✔️ Prevents inconsistent values</p><p><strong>Example</strong><br> Instead of storing customer details in every order row:</p><ul><li>Store customer data once in customers</li><li>Reference it using customer_id</li></ul><h4>2️⃣ Improves Data Integrity &amp; Consistency</h4><p>✔️ Ensures data remains accurate and reliable<br> ✔️ Updates happen in <strong>one place only</strong></p><p>Without normalization:</p><ul><li>Same email stored in 5 places</li><li>One update → 4 places still outdated ❌</li></ul><p>With normalization:</p><ul><li>Single update → everywhere reflected ✅</li></ul><h4>3️⃣ Prevents Update, Insert &amp; Delete Anomalies</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fSPJlZ2o0kAhGnoSzUbhYQ.png" /></figure><h4>4️⃣ Better Database Maintenance</h4><p>✔️ Cleaner schema<br> ✔️ Easier to modify structure<br> ✔️ Less risk when altering tables</p><p>Example:</p><ul><li>Changing phone number format affects only one table</li></ul><h4>5️⃣ Enhances Data Accuracy</h4><p>✔️ Reduces conflicting values<br> ✔️ Enforces <strong>referential integrity</strong> using foreign keys</p><pre>FOREIGN KEY (customer_id) REFERENCES customers(id)</pre><h4>6️⃣ Efficient Use of Storage</h4><p>✔️ Less duplicated data<br> ✔️ Smaller tables → better cache utilization</p><p>Especially important in:</p><ul><li>Large enterprise databases</li><li>Cloud environments where storage costs matter</li></ul><h4>7️⃣ Better Scalability</h4><p>✔️ Normalized databases scale better<br> ✔️ Easier to add new features or relationships</p><p>Example:</p><ul><li>Adding multiple addresses per user becomes simple</li></ul><h4>8️⃣ Clear Logical Data Structure</h4><p>✔️ Tables represent <strong>real-world entities</strong></p><ul><li>Users</li><li>Orders</li><li>Products</li><li>Payments</li></ul><p>This improves:</p><ul><li>Developer understanding</li><li>Query readability</li><li>Long-term system design</li></ul><h4>9️⃣ Supports ACID Properties</h4><p>Normalization helps maintain:</p><ul><li><strong>Atomicity: </strong>Ensures transactions are fully completed or not at all.</li><li><strong>Consistency: </strong>Maintains database integrity.</li><li><strong>Isolation: </strong>Ensures concurrent transactions do not interfere.</li><li><strong>Durability: </strong>Ensures committed transactions persist even after failures.</li></ul><p>Especially <strong>Consistency</strong>, by removing duplication.</p><h3>📘 SQL Data Integrity:</h3><p><strong>Data Integrity</strong> refers to the <strong>accuracy, consistency, and reliability of data</strong> throughout its lifecycle in a database.<br> It ensures that data remains <strong>correct, valid, and trustworthy</strong>, even after multiple insert, update, or delete operations.</p><p>In SQL, data integrity guarantees that:</p><ul><li>Data is not duplicated incorrectly</li><li>Relationships between tables remain valid</li><li>Invalid or inconsistent data is prevented from entering the database</li></ul><h4>1️⃣ Entity Integrity</h4><p>Ensures that each table row is <strong>uniquely identifiable</strong>.</p><p>✔️ Implemented using: PRIMARY KEY, UNIQUE, NOT NULL</p><pre>CREATE TABLE users (<br>  user_id INT PRIMARY KEY,<br>  email VARCHAR(100) UNIQUE NOT NULL<br>);</pre><h4>2️⃣ Referential Integrity</h4><p>Ensures <strong>relationships between tables remain consistent</strong>.</p><p>✔️ Implemented using: FOREIGN KEY constraints</p><pre>CREATE TABLE orders (<br>  order_id INT PRIMARY KEY,<br>  user_id INT,<br>  FOREIGN KEY (user_id) REFERENCES users(user_id)<br>);</pre><p>❌ Prevents inserting an order for a non-existing user<br> ❌ Prevents accidental deletion of referenced records</p><h3>🔑 Primary Key and Foreign Key</h3><h4>📘 Primary Key</h4><p>A <strong>Primary Key</strong> is a column (or set of columns) that <strong>uniquely identifies each record</strong> in a table.<br> It ensures that <strong>no duplicate or NULL values</strong> exist in the key column.</p><h4>🔗 Foreign Key</h4><p>A <strong>Foreign Key</strong> is a column (or set of columns) in one table that <strong>refers to the primary key of another table</strong>.<br> It is used to <strong>establish and maintain relationships</strong> between tables.</p><pre>CREATE TABLE customers (<br>  customer_id INT PRIMARY KEY,<br>  name VARCHAR(50),<br>  email VARCHAR(100)<br>);<br><br>CREATE TABLE orders (<br>  order_id INT PRIMARY KEY,<br>  order_date DATE,<br>  customer_id INT,<br>  FOREIGN KEY (customer_id) REFERENCES customers(customer_id)<br>);</pre><blockquote>A primary key <strong>uniquely identifies records</strong> in a table, while a <strong>foreign key creates a relationship by referencing the primary key of another table.</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41a4b4bff5b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS ALB vs NLB: Key Differences, Use Cases, and When to Use Each]]></title>
            <link>https://medium.com/@amit151993/aws-alb-vs-nlb-key-differences-use-cases-and-when-to-use-each-c69ad072d641?source=rss-18e9a2b5c299------2</link>
            <guid isPermaLink="false">https://medium.com/p/c69ad072d641</guid>
            <category><![CDATA[load-balancing]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Amit Singh]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 04:35:29 GMT</pubDate>
            <atom:updated>2026-01-04T05:46:08.983Z</atom:updated>
            <content:encoded><![CDATA[<p>Load balancing is one of the <strong>most fundamental concepts in cloud architecture</strong>. Whether you are building a simple web application or a large-scale distributed system, <strong>handling traffic efficiently and reliably</strong> is critical.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/964/1*DynWjG11nDPRuswLQ-XGiQ.jpeg" /></figure><p>AWS provides multiple load balancing options under <strong>Elastic Load Balancing (ELB)</strong>, but two of the most commonly used ones are <strong>Application Load Balancer (ALB)</strong> and <strong>Network Load Balancer (NLB)</strong>. While both distribute traffic across backend servers, they are <strong>designed for very different use cases</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wqh33JyKS8_js5pQ-h7jGg.jpeg" /></figure><h3>🌐 Why Load Balancing Matters?</h3><p>In real-world applications, traffic is unpredictable. A single server can easily become overwhelmed, leading to:</p><ul><li>Slow response times</li><li>Application downtime</li><li>Poor user experience</li></ul><p>Load balancers solve this problem by:</p><ul><li>Distributing traffic across multiple backend servers</li><li>Automatically routing traffic away from unhealthy instances</li><li>Improving availability, scalability, and fault tolerance</li></ul><p>AWS load balancers are <strong>fully managed</strong>, highly available, and deeply integrated with other AWS services.</p><h4>🚦 Two Load Balancers, Two Different Purposes</h4><p>At a high level:</p><ul><li><strong>Application Load Balancer</strong> is designed for <strong>HTTP and HTTPS traffic</strong> and understands application-level details like URL paths and headers.</li></ul><blockquote><strong>ALB is a smart traffic router</strong><br> It reads HTTP requests and makes decisions based on paths, hostnames, and headers.</blockquote><ul><li><strong>Network Load Balancer</strong> is built for <strong>high-performance TCP/UDP traffic</strong>, focusing on speed, scale, and low latency.</li></ul><blockquote><strong>NLB is a fast network pipe</strong><br> It forwards packets as quickly as possible without inspecting application content.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WLc1JLEUa25KUG9xfSllkw.jpeg" /></figure><p>They may sound similar, but internally they operate at <strong>different layers of the OSI model</strong>, which directly impacts how and when they should be used.</p><h3>🌐 What is an Application Load Balancer (ALB)?</h3><p><strong>AWS Application Load Balancer</strong> is a <strong>Layer 7 (Application Layer)</strong> load balancer provided by AWS.<br> It routes traffic based on <strong>HTTP/HTTPS request content</strong>, such as:</p><ul><li>URL paths (/api, /login)</li><li>Hostnames (api.example.com)</li><li>HTTP headers and methods</li></ul><p>This makes ALB ideal for <strong>modern</strong> <strong>web applications and microservices architectures</strong>.</p><h4>Key Features</h4><ul><li>Layer <strong>7 (Application layer)</strong></li><li>Supports <strong>HTTP / HTTPS / WebSocket</strong></li><li><strong>Path-based routing</strong> (/api, /auth)</li><li><strong>Host-based routing</strong> (app.example.com)</li><li>Native support for: <strong>AWS</strong> <strong>ECS, EKS, Lambda</strong></li><li>SSL termination</li><li>Authentication with <strong>Cognito / OIDC</strong></li><li>Sticky sessions (cookies)</li></ul><h4>Common Use Cases</h4><ul><li>Microservices architecture</li><li>REST APIs</li><li>Kubernetes Ingress</li><li>Web applications (React, Angular, Django, Spring Boot)</li></ul><h4>Example</h4><pre>/app → EC2 Target Group<br>/api → Lambda<br>/admin → ECS Service</pre><h4>🌐 What is Network Load Balancer (NLB)?</h4><p><strong>AWS Network Load Balancer</strong> is a <strong>Layer 4 (Transport Layer)</strong> load balancer in AWS that routes traffic based on <strong>IP address and port</strong>, not on HTTP content and is built for <strong>extreme performance and low latency</strong>.</p><p>Unlike Application Load Balancer, NLB <strong>does not inspect requests</strong>. It simply forwards packets at <strong>very high speed</strong>, making it ideal for performance-critical systems.</p><h4>🔍 Key features of NLB</h4><ul><li>Operates at <strong>Layer 4 (TCP / UDP / TLS)</strong></li><li>Handles <strong>millions of requests per second</strong></li><li><strong>Ultra-low latency</strong></li><li>Preserves <strong>original client IP</strong></li><li>Supports <strong>static IP addresses</strong></li><li>Highly available across <strong>multiple Availability Zones</strong></li><li>Designed for <strong>scale and performance</strong></li></ul><h4>Common Use Cases</h4><ul><li>Databases (MySQL, PostgreSQL)</li><li>Messaging systems (Kafka, RabbitMQ)</li><li>Game servers</li><li>VoIP, streaming</li><li>Legacy applications</li></ul><h4>Example</h4><pre>Client → NLB → TCP:3306 → RDS / EC2 DB</pre><h4>🎯 When to Use What?</h4><h4>Use ALB when:</h4><ul><li>You are building <strong>web apps or APIs</strong></li><li>You need <strong>path/host routing</strong></li><li>You use <strong>EKS, ECS, Lambda</strong></li><li>You want authentication at LB level</li></ul><h4>Use NLB when:</h4><ul><li>You need <strong>high throughput</strong></li><li>You use <strong>TCP/UDP protocols</strong></li><li>You need <strong>static IP</strong></li><li>You want <strong>lowest latency</strong></li></ul><h4>🏗️ Architecture Example</h4><pre>Internet<br>   |<br> ALB (HTTPS, Routing)<br>   |<br>EKS / ECS / Lambda<br>   |<br> Internal NLB<br>   |<br>Databases / Kafka</pre><p>🚦 AWS Load Balancer Comparison: <strong>ALB vs NLB</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EhaTN027bzjWBRGEEgImoQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PeMHAVxt6eaPTPomdEMkTw.jpeg" /></figure><h3>🏁 Conclusion</h3><p><strong>Application Load Balancer</strong></p><blockquote>Application Load Balancer with path-based routing is a <strong>powerful and cost-effective</strong> way to host multiple services behind a single endpoint. It is widely used in <strong>real-world production environments</strong>, especially with microservices and Kubernetes.</blockquote><p><strong>Network Load Balancer</strong></p><blockquote>AWS Network Load Balancer is designed for <strong>speed, scale, and simplicity</strong>. If your application demands <strong>high throughput, ultra-low latency, or static IPs</strong>, NLB is the right choice.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c69ad072d641" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>