<?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 sadkat on Medium]]></title>
        <description><![CDATA[Stories by sadkat on Medium]]></description>
        <link>https://medium.com/@sadkatwt?source=rss-b62186851f71------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*B-_fwoaDqgoe6LvcU03nUQ.jpeg</url>
            <title>Stories by sadkat on Medium</title>
            <link>https://medium.com/@sadkatwt?source=rss-b62186851f71------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 11:04:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sadkatwt/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[Ultimate Guide To VMs and Hypervisors]]></title>
            <link>https://medium.com/@sadkatwt/ultimate-guide-to-vms-and-hypervisors-af9241325e81?source=rss-b62186851f71------2</link>
            <guid isPermaLink="false">https://medium.com/p/af9241325e81</guid>
            <category><![CDATA[operating-systems]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[virtual-machine]]></category>
            <category><![CDATA[hypervisors]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[sadkat]]></dc:creator>
            <pubDate>Wed, 22 Jul 2026 12:10:52 GMT</pubDate>
            <atom:updated>2026-07-22T12:22:00.481Z</atom:updated>
            <content:encoded><![CDATA[<p>Lets start with another talk about great engineering.</p><p>This article will be all about Virtual Machines and who and what manages them when you really need them and as well as how your operating system handles VMs.</p><p>We will move from Zero to the Current Level.</p><blockquote><em>An Operating System is a program which runs on your machine which eventually let you use your machine specifically and do operations on it as we do in our daily lives.</em></blockquote><p>An Operating System is responsible for everything which happens on your computer like File Management, Ethernet Access, IO Devices etc.</p><h3>What are virtual machines?</h3><p>An virtual machine is an digital emulation of the physical system, runs on the hosted system and all of the resources of hosted system are shared onto this virtual machine.</p><blockquote>For example — Consider an house as the host machine and virtual machines as the room inside the house, they share the resources of the host system.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7sT5n0RHwkKnVmRa" /><figcaption>Virtual Machines</figcaption></figure><p>Hypervisors and Virtual Machines are the foundation of modern cloud computing. Every major cloud provider AWS, Azure, Google Cloud, Oracle Cloud depends on them. Technologies like Docker, Kubernetes, Firecracker, and many security sandboxes are built on ideas that originate from virtualization.</p><h3>What sort of problems does a Virtual Machine Solve?</h3><p>Code that ran perfectly on a developer’s laptop would crash when deployed to production because of minor differences in operating systems, libraries, or configuration files.</p><p><strong>The VM Solution </strong>— Teams can share an identical VM image. Every developer codes inside the exact same environment that matches the production server, eliminating hidden environment bugs.</p><p>So there must be a question that might arise in your mind is that if we have 10 VMs on a single machine how one can manage those virtual machines inside the operating system?</p><p><strong>What made Virtual Machines Possible?</strong></p><blockquote><strong><em>Hypervisors</em></strong></blockquote><h3>HyperVisors-</h3><p>A <strong>hypervisor</strong> (also called a <strong>Virtual Machine Monitor (VMM)</strong>) is software (or firmware) that allows multiple operating systems to run simultaneously on the same physical computer.</p><p>As the name suggests that it is a virtual machine monitor, it monitors and allocates the resources to the Virtual Machines on the System. It is responsible for the communication between VM and Host OS systems functions and return the data to the VM.</p><p><strong>Why were Hypervisors Invented?</strong></p><p>You have 3 servers suppose each server is responsible for these things -</p><ul><li>Server 1 — Database</li><li>Server 2 — Email</li><li>Server 3 — Website</li></ul><p>All of these 3 servers mostly stays idle most of the time, these servers costs electricity and maintainance etc and almost the resource usages are below 10%.</p><p>Hypervisor solved this problem by enabling virtual machines on a single system that can handle all of these tasks into an single machine.</p><p><strong>So the one machine becomes -</strong></p><p>Physical Server</p><ul><li>Database VM</li><li>Mail VM</li><li>Web VM</li><li>Dev VM</li><li>Backup VM</li></ul><h3>Types of Hypervisors -</h3><p><strong>Type 1 Bare Metal -</strong></p><p>These type of hypervisor sits on top of the hardware for example look at the figure below -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/0*dQfiTX7At3r-_N0H" /></figure><p><strong>Examples -</strong></p><ul><li>VMware ESXi</li><li>Microsoft Hyper-V</li><li>Citrix XenServer</li><li>KVM (inside the Linux kernel, commonly used as a Type 1 hypervisor)</li></ul><p>The benefit of bare metal hypervisor is the security and isolation it brings to the table its fastest, minimal and used in the data-centers world wide.</p><p><strong>Type 2 Hosted Hypervisors -</strong></p><p>These hypervisors run on the hosted operating system for example see the figure below -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/0*0K6wPfrlozi8LUtP" /></figure><p><strong>Examples -</strong></p><ul><li>Oracle VirtualBox</li><li>VMware Workstation</li><li>Parallels Desktop</li></ul><p>Executions are slower because the requests go through the host operating system.</p><h3>Virtual CPUs -</h3><p>A vCPU is a software representation of a physical processor. When you create a Virtual Machine , you assign it one or more vCPUs.</p><ul><li>To the Virtual Machine it will always look like a normal CPU, it boots up run its own OS Schedulers and tries to execute the instructions.</li><li>In reality vCPU is a complex data structure managed by the hypervisor.</li></ul><blockquote>We can discuss more further about vCPU Data Structure in posts in Regular Posts.</blockquote><h3>How does HyperVisor Manages vCPU -</h3><p>Scheduling just like your normal operating system uses schedulers for diffrent applications to share the CPU among them, Hypervisor also does the same thing it shares the CPU among VMs periodically.</p><p>The process goes like this -</p><ul><li>The hypervisor assigns some time slice of few milliseconds to the VM CPUS.</li><li>When that time is up, it paues the vm, saves its state and then allocate the CPU to other VM.</li></ul><p>Both of the above processes happens so rapidly that the user wont even notice the gap, thats what i love about this sort of great systems.</p><p><strong>VM Exit and VM Entry -</strong></p><p>These two are responsible for two diffrent things-</p><p>VM Entry is the specific action of the physical CPU transitioning from running the Hypervisor to running the Guest OS.</p><ul><li>During the VM entry, Hypervisor loads the saved state of the vCPU and serve it to the actual Physical CPU.</li><li>Then the Physical CPU is instructed to complete the task it was left previously.</li></ul><p>VM Exit is the exact opposite — the transition from the Guest OS back to the Hypervisor. A VM Exit is typically triggered by one of three things.</p><ul><li><strong>Time expires:</strong> The vCPU’s allocated time slice ends (a hardware timer fires).</li><li><strong>Privileged instructions:</strong> The Guest OS tries to do something it shouldn’t have direct access to (like modifying physical memory mapping or accessing a physical hard drive).</li><li><strong>Interrupts:</strong> An external event occurs, like a network packet arriving. When a VM Exit occurs, the physical CPU immediately traps back to the Hypervisor, saving the VM’s state so it can be safely resumed later.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tc9Wzpumco_OGWYFbs_qVw.png" /></figure><p>As you can clearly see in the above example that hypervisor keeps sharing the physical CPU between the 2 VMs.</p><h3>Memory Virtualization -</h3><p>We discussed about vCPUS above about how it is managed by the hypervisor, similarly the same way memory virtualization is being processed by hypervisor.</p><p>Suppose you have 64GB RAM and then HyperVisor divides the ram according to the number of VMs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/0*xEhlQsJ2__mCYhbp" /></figure><blockquote>This is a broad Topic and can be explored much further we will cover in depth in the future articles.</blockquote><h3>Storage &amp; Network Virtualization</h3><p>A compute is not useful without any storage and network devices its just like a empty box without it.</p><p>When a VM tried to write a file or read a file it think it has the physical disk but in reality things very much diffrent, but here is how it works and how its being fooled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/825/0*10DY2VQ-dLbgVHiq" /></figure><p>The virtual disk is usually just a file stored on the host machine. The hypervisor translates every read and write request between the VM and the physical storage device.</p><p>This makes it easy to copy, move, or back up an entire virtual machine.</p><h3>Network Virtualization</h3><p>The same things go for network virtualization, the VM thinks it owns the physical network card but in reality its not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*VV-M4lyn1JOiPh8T.png" /></figure><p>The hypervisor acts like a network administrator, ensuring that every VM can communicate with other machines while keeping their traffic separate.</p><p>From the guest operating system’s perspective, it looks exactly like a normal Ethernet connection.</p><h3>VM Lifecycle</h3><p>We will see about VIrtual Machine Lifecycle in this section we will learn about how virtual machines are allocated and then are destroyed with the help of a figure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H0DFre8ADpnoJ0N4" /></figure><p>During its lifetime hypervisor is responsible for everthing from allocating rams, cpus, networks,storages, I/O and System calls.</p><p>You can see that Hypervisor is so much interesting of a stuff to learn and implement. Hypervisor runs the modern cloud systems and instances.</p><h3>Where Are Virtual Machines Used?</h3><p>There are many fields where VMs are used like-</p><ul><li>Software Engineering and Development</li><li>Cyber Security</li><li>Cloud Computing</li><li>Education</li></ul><h3>Cloud Computing</h3><p>Many Providers like Google, Amazon, Azure, Oracle uses Hypervisor for machine allocation for their customers.</p><p>Whenever you launch an EC2 instance on AWS its not really allocating you a new physical machine for it, it allocates a VM by using hypervisor to every customer they have.</p><p>Every Virtual Machine is for a customer using them.</p><p>Hypervisor is the best thing you can learn and deep dive into it you will learn alot about systems and modern modern cloud computing like serverless instances and etc.</p><p>Thank you for investing your time in this article!</p><p>If you like my stories you can support me through this</p><p><a href="https://buymeacoffee.com/sadkat">https://buymeacoffee.com/sadkat</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af9241325e81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Mirror Of Intelligence]]></title>
            <link>https://medium.com/@sadkatwt/the-mirror-of-intelligence-3c66369fc6a1?source=rss-b62186851f71------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c66369fc6a1</guid>
            <category><![CDATA[human-behavior]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[sadkat]]></dc:creator>
            <pubDate>Tue, 21 Jul 2026 08:02:09 GMT</pubDate>
            <atom:updated>2026-07-21T08:02:09.509Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i6Bdy-MPujnatbEOZJ84MA.jpeg" /></figure><h3>Why We Mistake Language for Thought</h3><blockquote>“A mirror doesn’t think. It reflects. Yet sometimes the reflection is convincing enough that we mistake it for a mind.”</blockquote><p>A Few years ago before the age of aritifical intelligence, we often used to think about talking to machines that can do the commanded task for us and what not especially sci-fi movies where robotics sounds like humans and understands them or what not.</p><p>As of today this has become a new meta, people are spending enough time having conversations with AI powered bots. Spend enough time talking to an LLM, and something subtle begins to happen. It adapts to your tone. It remembers the context of your conversation. It anticipates what you’re likely to ask next. Before long, an uncomfortable thought appears-</p><blockquote><em>This process makes you think about it like </em><strong><em>“This Understands Me”.</em></strong></blockquote><p>But does it?</p><p>Or are we witnessing one of the most convincing psychological illusions humanity has ever created?</p><p>The answer says as much about the human mind as it does about artificial intelligence.</p><h3><strong>We are Wired To See Minds Everywhere</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_oy_ps9hhs6hxsyc" /></figure><p>Long before machines like computers existed our brains were wired to detect intentions.</p><blockquote><em>A rustle in the bushes could be the wind or it could be a predator. Assuming something was there, even when it wasn’t, often increased our chances of survival.</em></blockquote><p>We named our cars , we yell at computers for not being working properly even though it cannot understand our intent.</p><p>Childrens tend to talk to animals and try to understand them while it was cenrtainly not possible.</p><p>This proves that the tendency to find minds everywhere has been always deep rooted into us straight from the beginning.</p><blockquote><em>This phenomenon is known as </em><strong><em>anthropomorphism-</em></strong><em>our tendency to attribute human qualities to non-human objects.</em></blockquote><p>Language makes this difference much Stronger</p><p>The moment something communicates fluently, our brains stop evaluating <em>how</em> it produced the words and instead begin evaluating <em>who</em> is speaking.</p><p>That is the sole reason why chat bot feels more human and reasonable.</p><p>An Calculator gives answers but an LLM tells stories and we humans are story tellers since birth.</p><h3>The Most Convincing Illusion</h3><p>We humans have built many tools which has always made our lifes easier, we have made calculators , heavy machinery , electronics etc, but none of these machines ever let us question a single thing about them being conscious.</p><p>Because Language is always been our strongest form of intelligence or in a way that we can call that this thing is conscious because it can speak our language fluently with very much good conversational skills.</p><p>For thousands of years, every coherent sentence you’ve ever heard came from another conscious being.</p><p>Your brain has never needed to distinguish between fluent language and genuine understanding.</p><p><strong>Until now.</strong></p><h3><strong>What an Large Language Model Actually Does</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DbpM6SkCY5GWo9K8" /></figure><p>An LLM is not just search through a large set of data or databases for your queries what LLM is actually is good at is <strong>“Prediction”.</strong></p><p>They aren’t reasoning like humans, and they aren’t “thinking” in the way we typically use that word.</p><p>The core idea of an LLM model is to Predict.</p><p>So when you type -</p><blockquote><em>“The Earth Revolves”</em></blockquote><p>It just does not go look for the word “Earth”, It evaluates billions of numerical relationships learned during training and predicts that <em>Sun</em> is the most probable continuation.</p><p>This prediction loop keeps running and it predicts next and then the next token respectively.</p><p>Individually, These predictions are simple and easy to understand but together with many more things are involved it creates something astonishing.</p><h3>Why Prediction Feels Like Thoughts</h3><p>It is the part where human psychology emerges, We as humans always tend to believe that if someone can explain complex concepts in a easy and conversational way it understands the concept in depth or what not.</p><p>This creates a persona in our heads that it knows very much well thats why it can teach or explain with such fluency.</p><p>These assumption works well with humans because our words usually emerge from experience, memory, and conscious reasoning.</p><p>With LLMs, fluent language emerges from statistical relationships learned across enormous amounts of text.</p><p>The output can resemble reasoning so closely that the distinction becomes almost invisible.</p><p>This is the sole reason llms can exmplain things in a human tone, write poetries, debug softwares and what not.</p><p>The fluency of these tasks are great that is why it appears to us as an conscious being but in reality it is not.</p><h3><strong>The Mirror</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rzuVdNvbKSEMEf5R" /></figure><p>Here comes the interesting part and eye opener thing which should be everyone aware of -</p><p>An LLM is less like a brain than it is like a mirror, not a kind of mirror which reflects your face but it reflects humanity.</p><p>for an example every research paper and programming tutorial, poem,stories anything that is digital and can be used to train models.</p><p>Every one of them are produced by humans and we can all agree on that, the LLMs are trained on these data which are made by humans.</p><p>Every book, article, scientific discovery or what not has been compressed into numerical parameters and can be used to train models upon them.</p><p>When you ask an LLM a question, you’re not speaking to an artificial mind or something but in reality its just a bunch of stats data relation with humans all the way.</p><p>By this we can see that our work is reflected back to towards us in the form of a fluent response which we can determine as a great understanding.</p><h3>The Diffrence Between Knowing and Sounding Like You Know</h3><p>Someone can memorize every thing about physics book but never understand any underlying concept of it,</p><p>A child can solve a puzzle but cant explain how did they even solved it.</p><p>A musician can improvise their music without explaining the music theory behind it.</p><p>An LLM can generate explanations that sound remarkably intelligent without possessing beliefs, experiences, curiosity, or awareness.</p><p>This doesn’t diminish what LLMs can do,it simply clarifies what they are beneath.</p><h3><strong>A Look Inside The Mirror</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cKJRkzVw5tO8lKQH" /></figure><p>Large Language Models dont just challenge computer science they goes beyond that.</p><p>It challenges our the definition of intelligence.If prediction can imitate reasoning…If language can imitate understanding…If conversation can imitate companionship….</p><blockquote><strong><em>Then what really makes the intelligence real?</em></strong></blockquote><p>That is the same question which is a subject of debate worldwide.</p><p>For the first time in history, we have built machines that force us to question ideas we once considered obvious,not because the machines became human, but because they became convincing enough for humans to question themselves.</p><h3><strong>The end of this Article</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LiKjN3vVQngoW6SQ" /></figure><p>I believe the llms certainly targets the loophole in our cognitive system which is basically we mistake fluency for understanding,maybe in the upcoming years we can build such systems that can think and reason like humans and might not really, but as current level of Ai models which deliberately holds a mirror in front of us reflecting our own knowledge and achievements and discoveries.</p><p>Maybe this is the true mirror of intelligence, not the machine looking back at us but we are trying to find our own reflection and searching for ourselves.</p><p><strong>Thank you so much for reading this article!</strong></p><p>And at last if you love reading my articles consider supporting me its optional.</p><p><a href="https://buymeacoffee.com/sadkat">buymeacoffee.com/sadkat</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c66369fc6a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Engineering Behind AWS Lambda]]></title>
            <link>https://medium.com/@sadkatwt/the-engineering-behind-aws-lambda-55d0bf82a088?source=rss-b62186851f71------2</link>
            <guid isPermaLink="false">https://medium.com/p/55d0bf82a088</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <dc:creator><![CDATA[sadkat]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 13:37:16 GMT</pubDate>
            <atom:updated>2026-02-23T13:37:16.478Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YcTugQmd1XGEjqyjV4Glvg.png" /></figure><p><strong>What is serverless architecture?</strong> before moving onto functions we first need to understand what is actually serverless means -</p><p><strong>Serverless </strong>is basically an cloud execution model which handles your environment , scaling needs on its own.The user does not need to manage their servers or scale them indefinitely. All of the underlying infrastructure is managed by the providers.</p><p><strong>What are serverless functions?</strong> these services are called as FAAS (Function as a Service) which executes your block of code eventually and only charges you when its being executed thats why these functions are most popular and they scale automatically you dont need to worry about scaling at all.</p><p>As we have covered the overlay part of the serverless functions lets deep dive in its working and how does it executes your block of code while having an cold startup time of 125ms approximately.</p><p><strong>Lets learn about MicroVMs -</strong></p><p>A microVM is a lightweight virtual machine. Any function or container workload can run inside of one. It is ideal for running multiple high-performance and secure workloads concurrently on a single machine because it combines the security and isolation of traditional VMs with the resource efficiency of containers.</p><p><strong>How AWS implements it -</strong></p><p>AWS uses<strong> Firecracker</strong> their own developed VMM ( Vritual Machine Monitor).It is designed to run secure multi tenant workloads such as serverless functions and containers.</p><p>Firecracker uses KVM (Kernel Virtual Machine) which is a hardare virtualization engine which providers vCPU Memory and Network. <strong>Firecracker is built on KVM using Rust.</strong></p><p><strong>Why not normal containers ? </strong>Normal containers use shared host system kernel and weaker isolation boundary. <strong>KVM has separate kernel, stronger security boundary, hardware enforced isolation.</strong></p><p><strong>Firecracker Architecture -</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/0*1vqOBwG95tZlkVaC" /></figure><p><strong>Why cold starts are fast in Lambda 125ms?</strong></p><p>Because traditional virtual machines uses PCI Bust, Sata Controllers, USB, VGA, BIOS ( Firecracker also uses it but its a broad topic to explore just keep in mind for now that firecracker avoids these) it boots directly onto linux kernel with only essential virtio devices.</p><p><strong>Cold Start of Lambda What Happens Internally </strong>-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IH4bZhH0JgQ0i92h" /></figure><p>Cold starts latency depends on your Runtime if its Java it takes longer to start and also depends on package size and vpc configs, Memory config.</p><p><strong>Warm Start Lamda -</strong></p><p>If lambda was invoked recently it keeps the MICROVM alive and global values remains in memory, no runtime boot and only handler executes.</p><p><strong>Internal Scaling Model -</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/0*F6wQgnY3gc2ZneR9" /></figure><p>It all happens in milliseconds .. great engineering right there.</p><p><strong>How Networking Works Internally — </strong>if its not inside VPC it uses AWS managed Network which is seamingly fast and responsive. other than that its ENI (Elastic Network Interface) which was slow in earlier 2019 but its fine now.</p><p><strong>Security Architecture</strong> — As we saw each function has its own microVM has its own IAM role and no shared memory across customers and also Amazon Specific Nitro Hypervisor Protection which is totally backed by AWS Nitro System.</p><p><strong>Why Lambda Scales so Fast -</strong></p><p>MicroVms boots so fast — 100–124ms</p><p>Pre Warmed capacities</p><p>Horizontal Scaling is Automatic</p><p>No Container Orchasteration Delays</p><p>Hope you liked my article on AWS lambda and its internal working even though every topic in this article deserves a seprate article on it but it would be overkilll.</p><p>Thanks for reading this article and hope youve learned somethinh from it.</p><p>you can support me here — <a href="https://buymeacoffee.com/sadkat">https://buymeacoffee.com/sadkat</a></p><p>My Medium — <a href="https://medium.com/@sadkatwt">https://medium.com/@sadkatwt</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55d0bf82a088" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How stripe handles duplicate api requests.]]></title>
            <link>https://medium.com/@sadkatwt/how-stripe-handles-duplicate-api-requests-e0cc7a5cce7e?source=rss-b62186851f71------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0cc7a5cce7e</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[payment-gateway]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[scaling]]></category>
            <dc:creator><![CDATA[sadkat]]></dc:creator>
            <pubDate>Fri, 16 Jan 2026 06:56:43 GMT</pubDate>
            <atom:updated>2026-01-16T06:56:43.807Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Stripe Solves Duplicate Requests in Payment APIs</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cn7wTH6g0THUlg6nQCFM-w.png" /></figure><p><strong>Idempotency</strong> is one of the <strong>most important concepts in backend engineering-</strong>yet it’s often misunderstood or ignored.</p><p>Before diving deeper, let’s first understand <strong>what idempotency actually is</strong> and <em>why it matters so much</em> when building production-grade systems.</p><h3>What Is Idempotency?</h3><p>In simple terms, <strong>idempotency ensures that multiple identical requests produce the same result as a single request</strong>.</p><p>In backend systems, this means:</p><blockquote>Even if the same API request is sent multiple times — intentionally or accidentally — the backend processes it <strong>only once</strong>.</blockquote><p>This is critical for preventing <strong>duplicate operations</strong>, especially in high-risk flows like payments, orders, and transactions.</p><h3>The Real-World Problem-</h3><p>Imagine this scenario:</p><p>You’re on an e-commerce website and place an order.<br> Something goes wrong-maybe the page times out, the network drops, or the UI freezes.</p><p>You’re unsure whether the payment went through.</p><p>So you retry.</p><p>Later, you realize:</p><ul><li>You were charged <strong>twice</strong></li><li>The same item was ordered <strong>twice</strong></li></ul><p>Sounds painful, right?<br> This is not a frontend issue-<strong>this is a backend design failure</strong>.</p><h3>Where Idempotency Saves the Day -</h3><p>This is exactly where <strong>idempotency</strong> comes in.</p><p>Instead of blindly processing every incoming request, the backend:</p><ol><li>Generates an <strong>Idempotency Key</strong> for a request</li><li>Stores that key along with the request state (usually in <strong>Redis or a database</strong>)</li><li>Checks if the same key has already been processed</li><li>If yes → return the <strong>previous result</strong></li><li>If no → continue processing and store the result</li></ol><p>So even if the client retries:</p><ul><li>No duplicate charges</li><li>No duplicate orders</li><li>No corrupted system state</li></ul><h3>How It Works Internally-</h3><p>At a high level, idempotency systems:</p><ul><li>Track the <strong>current state</strong> of a request</li><li>Persist progress across retries</li><li>Resume safely from the <strong>last completed step</strong></li><li>Ensure <strong>exactly-once execution</strong> for critical operations</li></ul><p>This is usually implemented using:</p><ul><li>Idempotency keys (UUIDs)</li><li>Redis / Database storage</li><li>Request hashing or metadata validation</li><li>TTLs to clean up old keys</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uartllyTdzwXkBIE" /></figure><h3>Why Backend Engineers Must Care-</h3><p>Idempotency is not an “optional optimization.”<br>It is a <strong>core backend engineering responsibility</strong>.</p><p>Without it:</p><ul><li>Payment systems break</li><li>User trust erodes</li><li>Refunds increase</li><li>Support tickets explode</li><li>Systems become fragile under retries and failures</li></ul><p>With it:</p><ul><li>Systems become resilient</li><li>Failures are recoverable</li><li>APIs are safe to retry</li><li>Customers are protected</li></ul><p><strong>Idempotency</strong> is one of those concepts that silently <strong>protects both the backend and the user</strong>.</p><p>If you’re serious about building <strong>scalable, reliable, and production-ready backends</strong>, idempotency is not something you skip-it’s something you <strong>design early and carefully</strong>.</p><p>If you read till here, you’re either:</p><ul><li>genuinely interested in backend engineering</li><li>or dangerously unemployed</li></ul><p><strong>Either way-welcome to the club</strong> 🙂</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8J-tvqD9izjKztGCCOHfvA.png" /></figure><p>Thanks for reading this far Samurai!</p><p>Offer me a cup of cofee if you like — <a href="https://t.co/XIYLFTyoSG">https://buymeacoffee.com/sadkat</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0cc7a5cce7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Missing Piece in Your NoSQL Knowledge]]></title>
            <link>https://medium.com/@sadkatwt/the-missing-piece-in-your-nosql-knowledge-74bc22f9d4e1?source=rss-b62186851f71------2</link>
            <guid isPermaLink="false">https://medium.com/p/74bc22f9d4e1</guid>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[nosql]]></category>
            <dc:creator><![CDATA[sadkat]]></dc:creator>
            <pubDate>Sun, 11 Jan 2026 08:49:26 GMT</pubDate>
            <atom:updated>2026-01-11T08:49:26.268Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hFEr7VV9oQnMyIKEi9Qw4w.png" /></figure><p><strong><em>NoSql Databases</em> -</strong> NOSQL databases are mostly based on key-value store, document DB, GraphDB.. Data is denormalized by default in their application code.</p><p>Most NoSQL stores lack true ACID transactions and favor eventual consistency. NOSQL databases runs on the <strong>BASE principals </strong>which means — Basically Available, Soft State, Eventually Consistent. In Order to choose which Database is better for you is totally depends on your usecase tho you ve got to do some research and understand your usage pattern.</p><p><strong>Key-Value-Store:</strong></p><p><strong>A key-value store</strong> generally allows for <strong>O(1) reads and writes</strong> and is often backed by memory or SSD. Data stores can maintain keys in lexicographic order, allowing efficient retrieval of key ranges.</p><p>Key-value stores can allow for storing of metadata with a value. <strong>Key-value stores</strong> provide high performance and are often used for simple data models or for rapidly-changing data, such as an in-memory cache layer. Since they offer only a limited set of operations, complexity is shifted to the application layer if additional operations are needed.</p><p>A key-value store is the basis for more complex systems such as a document store, and in some cases, a graph database.</p><p><strong><em>DocumentDB:</em></strong> A document store is centered around documents (XML, JSON, binary, etc), where a document stores all information for a given object. Document stores provide APIs or a query language to query based on the internal structure of the document itself.</p><p><strong><em>Note</em></strong>-many key-value stores include features for working with a value’s metadata, blurring the lines between these two storage types. Documents are organized by collections, tags, metadata, or directories.</p><p>Although documents can be organized or grouped together, documents may have fields that are completely different from each other. Some document stores like <strong>MongoDB</strong> and<strong> CouchDB </strong>also provide a SQL-like language to perform complex queries. <strong>DynamoDB</strong> supports both key-values and documents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/0*t3ZQdTLfQ073J2Q9" /></figure><p><strong>GRAPH Database :</strong></p><p><strong>Graph Database </strong>are mostly useful when you have more relationships in your application just like a social media application like <strong>INSTAGRAM.</strong></p><p><strong>What is GraphDatabase?</strong> In a graph database, each node is a record and each arc is a relationship between two nodes. Graph databases are optimized to represent complex relationships with many foreign keys or many-to-many relationships.</p><p><strong>Graphs databases</strong> offer high performance for data models with complex relationships, such as a social network. They are relatively new and are not yet widely-used, it might be more difficult to find development tools and resources. Many graphs can only be accessed with REST APIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/0*JMAC7tNjwh-XCkOs" /></figure><p><strong>Some Sources you can read more about these :</strong></p><p><strong>Key-Value Store</strong> — <a href="https://t.co/gquQVB3eox">https://mongodb.com/resources/basics/databases/key-value-database</a></p><p><strong>Document DB — </strong><a href="https://t.co/tiSf1g1P8b">https://docs.aws.amazon.com/documentdb/latest/developerguide/what-is.html</a></p><p><strong>Graph DB</strong> — <a href="https://t.co/4W6FO6ukbT">http://neo4j.com/docs/getting-started/graph-database/</a></p><p><strong>Offer me a cup of cofee if you like</strong></p><p><a href="https://t.co/k2G6FFN5Pf">https://buymeacoffee.com/sadkat</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gwU0oFhTF7s0-B_b7taxQQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74bc22f9d4e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Every Distributed System Eventually Betrays You — CAP Theorem Explained]]></title>
            <link>https://medium.com/@sadkatwt/why-every-distributed-system-eventually-betrays-you-cap-theorem-explained-55cad927193f?source=rss-b62186851f71------2</link>
            <guid isPermaLink="false">https://medium.com/p/55cad927193f</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[backend-engineering]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[computer-science]]></category>
            <dc:creator><![CDATA[sadkat]]></dc:creator>
            <pubDate>Tue, 30 Dec 2025 06:57:28 GMT</pubDate>
            <atom:updated>2025-12-30T07:06:28.080Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why Every Distributed System Eventually Betrays You — CAP Theorem Explained</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yYPs1KDwDexTk2G6Ehurug.png" /></figure><p><strong><em>What is CAP theorem</em></strong> and how it is important in System Design Interviews and while also designing a good system. <strong>So what is CAP?</strong> it means Consistency Availability And Partition Tolerance, so why they exists and whats the point of this theorem? It exists because of distributed systems</p><p><strong>Lets see what is an distributed system</strong> first, an distributed system is large scaled application which depends on multiple network sources for example Amazon, Netflix etc These are the prime example of distributed systems.</p><p><strong>What is consistency?</strong> Consistency in cap theorem is that the system will provide you the latest information everytime any request you send, for example an api call youll always recieve the latest records.</p><p><strong>What is Availability?</strong> Availability is basically an system which is available for 24 hrs and every request get no error response even if something fails system keeps responding but the data might be old and deleted one.</p><p><strong>What is Partitioning?</strong> In Partition Tolerance the system continues to operate even if there is a network partition (nodes cannot communicate).</p><p><strong>In Distributed Systems</strong> network partitionings are unavoidable so when such situation occurs you always have to choose between Consistency and Availablity.</p><p><strong>For example banks</strong>, Banks use Consistency and partioning systems so when something fails bank server stops responding because they cant serve stale data which is older. Like UPI payments if server is down you cannnot do payments at all.</p><p><strong>Availability and Partioning</strong> Systems like social media apps they can be availabe any time but they cannot be consistent 24hrs they serve eventual cosistency.</p><p><strong>CA Systems,</strong> these exist only when there is NO network partition. In real world distributed systems, partitions can always happen. So true CA systems are basically single-node or not fully distributed.</p><p>Here is simple representation for better understanding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hfLfK87VunFeJvx7" /></figure><p><strong>Simple Example</strong></p><p>There are 2 servers and one of them breaks and now you got two choices</p><ol><li>You keep the system online and server old data but the system stays online</li><li>You dont let any requests happen and wait for the sever to sync So in the end when a network partition happens,</li></ol><p><strong>A distributed system must choose either Consistency or Availability it cannot guarantee both.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ZVtc_RFqhRh-R2fI_9edQ.png" /></figure><p>If you like what i do , you can offer me a cup of coffee ❤</p><p><a href="https://buymeacoffee.com/sadkat">https://buymeacoffee.com/sadkat</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55cad927193f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Design | Databases | Scaling]]></title>
            <link>https://medium.com/@sadkatwt/system-design-databases-scaling-23891006ffee?source=rss-b62186851f71------2</link>
            <guid isPermaLink="false">https://medium.com/p/23891006ffee</guid>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[scaling]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[schema]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[sadkat]]></dc:creator>
            <pubDate>Thu, 25 Dec 2025 17:06:02 GMT</pubDate>
            <atom:updated>2025-12-25T17:45:21.399Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l8Jom_kTYYFBD1hDgZQVFQ.png" /></figure><p><strong><em>SYSTEM DESIGN PHASE 1 — DAY 1 Databases -</em></strong></p><p>Today we are learning about SQL databases and some methods we can use to make our sql datbase more reliable and prone to crashes. Before Diving into All those methods first we need to understand the RDBMS.</p><p>It stands for <strong>Relational Database Management System </strong>and so why it is called Relational Even ? we know basically what is DBMS but why there is Relational?</p><p>So Relational defines that one table has a relation with another table for example : <strong>Student Table has course id → courses table</strong> , <strong>the course id is referenced to courses table which defines which course is the student is enrolled in this creates a relation between both of the tables.</strong></p><p>As you can see course id has reference to courses table which makes it relational to another table .Thats why we call it <strong>Relational Database Management System.</strong></p><p>So now we know What it is lets move ahead towards ACID properties.</p><p>ACID means <strong>Atomicity, Consistency, Integrity and Durability.</strong></p><p>Lets Define these in a single statement.</p><p><strong>Atomicity</strong> — Each transaction is all or nothing</p><p><strong>Consistency</strong> — Any transaction will bring the database from one valid state to another</p><p><strong>Isolation</strong> — Executing transactions concurrently has the same results as if the transactions were executed serially</p><p><strong>Durability</strong> — Once a transaction has been committed, it will remain so.</p><p>There are<strong> many techniques</strong> <strong>to scale</strong> a relational database: <strong>master-slave replication, master-master replication, federation, sharding, denormalization, and SQL tuning.</strong></p><h3><strong>Master-Slave Replication-</strong></h3><p>so as we know a single database which resolves read and write operation cannot handle a million requests right? so we create master slave replication technique. In this technique we create replicas of the primary database which sync with the primary database as writes operations are done on them.<strong> </strong>As you can see on the diagram this will give you a better clearity of what i meant above. Read operations are directly hopped into replicas which only supports read operations and write operations are forwared into primary which is the MASTER in this case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/0*VseR5K3qeE4BvTw9" /></figure><p><strong>Problem ? </strong>having more replicas means they all have to sync up with the master database if any write operation happnes which increases latency and perfomance issues. and also requires complex code logic to divide the operations.</p><h3><strong>Master-Master-Replication-</strong></h3><p>So instead of creating more replicas why dont we create two master dbs which stays in sync with each other and if one fails there is another master db which stays up as a backup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*Y2X8DjsH2XYuDCEBAZo6nw.png" /></figure><p><strong>Problems?</strong> -You’ll need a load balancer or you’ll need to make changes to your application logic to determine where to write. -Most master-master systems are either loosely consistent (violating ACID) or have increased write latency due to synchronization. -Conflict resolution comes more into play as more write nodes are added and as latency increases.</p><p><strong>Disadvantages of whole replication system-</strong> -There is a potential for loss of data if the master fails before any newly written data can be replicated to other nodes. -Writes are replayed to the read replicas. If there are a lot of writes, the read replicas can get bogged down with replaying writes and can’t do as many reads. -The more read slaves, the more you have to replicate, which leads to greater replication lag. -On some systems, writing to the master can spawn multiple threads to write in parallel, whereas read replicas only support writing sequentially with a single thread. -Replication adds more hardware and additional complexity.</p><h3><strong>Federation- </strong>Federation splits up databases by function.</h3><p>For example, instead of a single, monolithic database, <strong>you could have three databases</strong>: forums, users, and products, resulting in less read and write traffic to each database and therefore less replication lag. Smaller databases result in more data that can fit in memory, which in turn results in more cache hits due to improved cache locality. With no single central master serializing writes you can write in parallel, increasing throughput.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*cGMpjlvhXbY6OnaZaXVINA.png" /></figure><p><strong>Disadvantage of federation — </strong>-Federation is not effective if your schema requires huge functions or tables. -You’ll need to update your application logic to determine which database to read and write. -Joining data from two databases is more complex with a server link. -Federation adds more hardware and additional complexity.</p><h3><strong>Sharding</strong> -</h3><p>Sharding distributes data across different databases such that each database can only manage a subset of the data. Taking a users database as an example, as the number of users increases, more shards are added to the cluster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8z4SmCJTMDNrkaEPknAThw.png" /></figure><p><strong>Disadvantages of sharding — </strong>-You’ll need to update your application logic to work with shards, which could result in complex SQL queries. -Data distribution can become lopsided in a shard. For example, a set of power users on a shard could result in increased load to that shard compared to others. -Rebalancing adds additional complexity. A sharding function based on <strong>consistent hashing</strong> can reduce the amount of transferred data. -Joining data from multiple shards is more complex. Sharding adds more hardware and additional complexity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*f5ShZntzGzkFOL9L" /></figure><p><strong>Thank you for reading this far :)</strong></p><p><strong>This is my first blog on Medium.</strong></p><p>You can support me by this Link which is fully optional</p><p><a href="https://buymeacoffee.com/sadkat">sadkat</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23891006ffee" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>