<?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 Shivam Kumar on Medium]]></title>
        <description><![CDATA[Stories by Shivam Kumar on Medium]]></description>
        <link>https://medium.com/@shivam.edu4348?source=rss-e8ea164f1f2b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_fExZuFXJ5UPicMbaac3IQ.jpeg</url>
            <title>Stories by Shivam Kumar on Medium</title>
            <link>https://medium.com/@shivam.edu4348?source=rss-e8ea164f1f2b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 08:01:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shivam.edu4348/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[Amazon SDE-1 Interview Experience]]></title>
            <link>https://medium.com/@shivam.edu4348/amazon-sde-1-interview-experience-182cf3f46460?source=rss-e8ea164f1f2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/182cf3f46460</guid>
            <dc:creator><![CDATA[Shivam Kumar]]></dc:creator>
            <pubDate>Fri, 16 Oct 2026 20:35:24 GMT</pubDate>
            <atom:updated>2026-10-16T20:43:57.581Z</atom:updated>
            <content:encoded><![CDATA[<p>A lot of you were asking about my <strong>Amazon SDE-1 interview experience</strong>, especially the interview process, types of questions asked, and what was expected in each round.</p><p>So I thought of sharing my experience in detail, hoping it helps others preparing for similar interviews.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*3C44zDooJNFsvs7q_tnJeQ.gif" /></figure><p>It was an on-campus opportunity. The process consisted of an Online Assessment (OA), followed by four interview rounds covering DSA, Low-Level Design, Generative AI, past projects, and Amazon’s Leadership Principles.</p><h3>Online Assessment (OA)</h3><p>The OA consisted of three sections:</p><p><strong>1. Data Structures and Algorithms</strong></p><p>There were two DSA questions, both around medium difficulty. The questions primarily tested problem-solving skills, algorithmic thinking, and the ability to write efficient solutions within the given time.</p><p><strong>2. Backend Code Debugging</strong></p><p>This was something relatively new for me compared to the standard coding assessments.</p><p>I was given an existing backend codebase along with a set of test cases. The task was to understand the code, identify the issues, and make the necessary changes so that the tests would pass.</p><p>Unlike traditional DSA problems, this required reading and understanding an existing implementation rather than writing a solution from scratch.</p><p><strong>3. Workstyle Assessment</strong></p><p>The final section consisted of behavioral and situational questions, primarily focused on decision-making and workplace scenarios.</p><h3>Round 1: DSA + Past Experience</h3><p>This was primarily a coding-focused round.</p><p>I was asked <strong>two DSA questions</strong>, both falling in the medium-to-hard difficulty range.</p><ul><li>Question 1: Question involved performing path operations on a n-ary tree</li><li>Question 2: String manipulation based on KMP algorithm</li></ul><p>Few follow ups were asked in first problem</p><p>Apart from coding, there were a few questions about my previous internships and projects.</p><p>The discussion was mostly around what I had worked on, my contributions, and the technologies I had used.</p><h3>Round 2: Low-Level Design (LLD)</h3><p>This round was a bit surprising for me because, from what I had heard from multiple candidates, the second round typically involved DSA questions. However, in my case, it turned out to be a Low-Level Design round.</p><p><strong>Problem Statement: Design a File Management System</strong></p><p>The interesting part was that no explicit requirements were provided upfront. I had to initiate the discussion, ask relevant questions, and gather the requirements before proceeding with the design.</p><p>The round involved:</p><ul><li>Understanding the expected functionality and defining the scope.</li><li>Identifying the necessary entities, classes, and their relationships.</li><li>Discussing design decisions and possible implementations.</li><li>Handling multiple follow-up questions as the discussion progressed.</li></ul><p>The interviewer introduced several follow-ups, requiring me to think about how the design could accommodate additional requirements.</p><p>Towards the end, we also discussed a few questions related to my previous internships and projects.</p><h3>Round 3: Hiring Manager + GenAI</h3><p>This round was a combination of DSA, Generative AI fluency, and a detailed discussion of my previous technical experience.</p><p><strong>1. DSA</strong></p><p>The round started with one DSA question.</p><p><strong>2. Deep Dive into Internships and Projects</strong></p><p>A significant portion of the discussion revolved around my previous internships and projects mentioned on my resume.</p><p>The interviewer went into considerable depth, focusing on:</p><ul><li>Why I chose a particular approach or technology.</li><li>Technical challenges encountered during development.</li><li>Trade-offs involved in the design.</li><li>My individual contributions and decision-making.</li></ul><p>I was expected to explain the technical details and reasoning behind my implementation choices.</p><p><strong>3. Generative AI Fluency</strong></p><p>Since this was also a GenAI-focused round, there were questions assessing my understanding of Generative AI and its practical applications.</p><p>The discussion included how I had used GenAI in my projects and development workflows, along with my understanding of where these tools could be useful.</p><p>This round particularly reinforced the importance of being thoroughly familiar with everything mentioned on your resume.</p><h3>Round 4: Bar Raiser</h3><p>The final round was the Bar Raiser interview.</p><p>Unlike the earlier coding rounds, this one had a mix of puzzles, conceptual data structure questions, and behavioral discussions.</p><p><strong>1. Puzzles and Data Structures</strong></p><p>I was asked a few puzzles and questions related to data structures.</p><p>The discussion included different types of trees, such as:</p><ul><li>Binary Trees and Binary Search Trees</li><li>AVL Trees</li><li>Red-Black Trees</li></ul><p>The questions were more conceptual in nature, focusing on understanding the underlying data structures rather than solving standard LeetCode-style problems.</p><p><strong>2. Leadership Principles</strong></p><p>The remaining part of the interview focused on Amazon’s Leadership Principles.</p><p>I was asked around 3 to 4 behavioral questions based on my previous experiences.</p><p>The discussion covered situations such as:</p><ul><li>Handling setbacks or unexpected challenges.</li><li>Making decisions in difficult situations.</li><li>Taking ownership of responsibilities.</li><li>Learning from previous experiences.</li></ul><p>There were follow-up questions to understand the context, my specific actions, and the outcomes.</p><p>I found that having genuine examples from internships and projects made it easier to structure my responses.</p><h3>Key Takeaways from My Experience</h3><p><strong>1. DSA is important, but it is not everything.</strong></p><p>Being comfortable with medium-to-hard DSA problems is definitely helpful. However, the process also evaluates your design skills, technical understanding, and ability to communicate your approach.</p><p><strong>2. Know your resume inside out.</strong></p><p>If you mention a project or technology, be prepared to explain how it works, why you used it, what alternatives you considered, and what challenges you faced.</p><p><strong>3. LLD is as much about communication as design.</strong></p><p>Don’t jump straight into implementation. Clarifying requirements and discussing your assumptions are equally important.</p><p><strong>4. Understand the practical applications of GenAI.</strong></p><p>Along with conceptual understanding, being able to discuss how you have used Generative AI in real projects or workflows can be valuable.</p><p><strong>5. Prepare real examples for Leadership Principles.</strong></p><p>Rather than memorizing generic responses, reflect on your actual experiences. Be clear about the situation, your contribution, the decisions you made, and what you learned.</p><h3>Final Thoughts</h3><p>Overall, the interview process was a good mix of problem-solving, system design, technical discussions, and behavioral evaluation.</p><p>One thing I noticed throughout the process was that interviewers were interested in understanding <strong>how I approached problems and why I made certain decisions</strong>, rather than just whether I knew the correct answer.</p><p>For anyone preparing for Amazon SDE-1 interviews, I would recommend focusing on DSA fundamentals, LLD, conceptual understanding of data structures, and most importantly, being able to explain your past work confidently and in depth.</p><p>Of course, interview experiences can vary depending on the team and interviewer, but I hope this gives you a fair idea of what to expect.</p><p><strong>All the best to everyone preparing!</strong></p><p><em>Feel free to reach out if you have any questions. Happy to help wherever I can.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=182cf3f46460" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sixsense.ai SDE-1 Interview Experience]]></title>
            <link>https://medium.com/@shivam.edu4348/sixsense-ai-sde-1-interview-experience-2227b76184bb?source=rss-e8ea164f1f2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2227b76184bb</guid>
            <dc:creator><![CDATA[Shivam Kumar]]></dc:creator>
            <pubDate>Thu, 17 Sep 2026 18:51:02 GMT</pubDate>
            <atom:updated>2026-09-17T18:51:02.240Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, I went through a <strong>3-round SDE-1 interview process at Sixsense AI</strong>, and the overall experience was quite interesting.</p><p>The process consisted of:</p><ul><li>DSA &amp; Problem Solving</li><li>Low Level Design</li><li>Engineering Manager Round</li></ul><p>What stood out throughout the process was the number of follow-up questions. The interviewers didn’t just stop once I reached a working solution — they kept adding constraints and asking how the design would behave in real-world scenarios.</p><p>Here’s how the interviews went.</p><h3>Round 1 — DSA</h3><p>The first round was a relatively focused DSA round.</p><p>The questions revolved mainly around:</p><ul><li>String manipulation</li><li>Binary search</li></ul><p>There were a few follow-ups around optimization, edge cases, and complexity.</p><p>Overall, the round was more about <strong>how I approached the problem and optimized the solution</strong> rather than just getting the final answer.</p><h3>Round 2 — Low Level Design</h3><p>The second round was a <strong>Low Level Design round</strong>, where I was asked to:</p><blockquote><strong><em>Design Tic Tac Toe.</em></strong></blockquote><p>Initially, the discussion was around the basic object-oriented design-players, board, game, moves, winning conditions, etc.</p><p>But, as expected, the interviewer didn’t stop there.</p><h3>Multiple Players</h3><p>The first major follow-up was:</p><blockquote><em>“What if we want to support more than two players?”</em></blockquote><p>This meant the design shouldn’t be tightly coupled to the assumption of exactly two players.</p><p>We discussed how the existing abstractions could be extended to support a configurable number of players.</p><h3>Grouping Players</h3><p>The interviewer then added another requirement:</p><blockquote><em>“What if players can be grouped together?”</em></blockquote><p>This pushed the discussion towards how players and groups should be represented and how the game logic would work when the concept of a player isn’t necessarily just an individual entity.</p><h3>Concurrency</h3><p>The most interesting follow-up was around concurrency.</p><p>The interviewer asked:</p><blockquote><em>“What happens if two players try to make a move on the board at the same time?”</em></blockquote><p>This led to a discussion around:</p><ul><li>Race conditions</li><li>Critical sections</li><li>Thread safety</li><li>Locking</li><li>Board-level synchronization</li><li>Ensuring that two concurrent requests cannot make conflicting moves</li></ul><p>A simple Tic Tac Toe problem gradually turned into a discussion around <strong>concurrent state modification</strong>.</p><h3>Round 3 — Engineering Manager Round</h3><p>The final round was with an <strong>Engineering Manager</strong> and was much more discussion-heavy.</p><p>The interviewer asked me to pick one of my internship projects and explain it in detail.</p><p>And by detail, I mean <strong>really deep into the implementation</strong>.</p><p>We started with the overall architecture and then gradually went into individual engineering decisions.</p><h3>Database Schema</h3><p>We discussed:</p><ul><li>How I designed the database schema</li><li>Why I chose that particular structure</li><li>Relationships between entities</li><li>Indexing considerations</li><li>How the schema would behave as the system scales</li></ul><p>The interviewer kept asking:</p><blockquote><em>“Why did you choose this?”</em></blockquote><p>rather than simply asking what I had implemented.</p><h3>API Design</h3><p>Then we moved to APIs.</p><p>We discussed:</p><ul><li>API design</li><li>Request/response structure</li><li>Validation</li><li>Error handling</li><li>Different flows in the system</li></ul><p>From there, the conversation naturally moved towards reliability.</p><h3>Idempotency</h3><p>One of the follow-ups was around <strong>idempotency</strong>.</p><p>For example, if the same request is received multiple times because of a retry, how do we make sure that the operation isn’t performed twice?</p><p>This led to discussions around retries, duplicate requests, and maintaining consistency.</p><h3>Scalability</h3><p>The interviewer then asked how the system would behave as traffic increases.</p><p>We discussed potential bottlenecks and how the architecture could be modified to support larger workloads.</p><p>And then came the inevitable question:</p><blockquote><strong><em>“Why Kafka?”</em></strong></blockquote><p>This wasn’t a “What is Kafka?” type of question.</p><p>The discussion was more about:</p><blockquote><em>“Why did you actually need Kafka in this system?”</em></blockquote><p>We discussed the problem Kafka was solving, asynchronous processing, decoupling, scalability, and the trade-offs involved in introducing a messaging system.</p><p>The entire discussion was less about textbook definitions and more about <strong>engineering reasoning</strong>.</p><h3>The Blog Discussion</h3><p>One unexpected part of the EM round came when the interviewer asked:</p><blockquote><strong><em>“How do you keep yourself updated with the latest technologies?”</em></strong></blockquote><p>I mentioned that apart from working on projects, I also like reading about distributed systems and writing technical blogs.</p><p>That immediately became a follow-up.</p><p>The interviewer went through some of the topics I had written about and started asking questions around them.</p><h3>Multi-Tenant Architecture</h3><p>One of my blogs was about <strong>Multi-Tenant Architecture</strong>, so we discussed the basic architectural approaches and the challenges around tenant isolation and scaling.</p><p>The discussion was about understanding the design decisions involved in building such systems.</p><h3>Vector Clocks &amp; Causality</h3><p>Another blog I had written was about <strong>Vector Clocks and causality in distributed systems</strong>, particularly in the context of collaborative editors.</p><p>That led to questions like:</p><ul><li>How do you track causality between events?</li><li>Why aren’t normal timestamps sufficient?</li><li>How do vector clocks work?</li><li>How do you determine whether two events are causally related?</li><li>What happens when two events are concurrent?</li></ul><p>This was probably my favourite part of the interview because it was something I had explored out of personal interest, and the conversation went considerably deeper than the original blog.</p><p>It also reinforced something I’ve started believing:</p><blockquote><strong><em>Anything you mention on your resume, GitHub, LinkedIn, or blog can become an interview topic.</em></strong></blockquote><p>So don’t just know the headline. Know the fundamentals behind it.</p><h3>The Result</h3><p><strong>The next day, I received the offer for the SDE-1 role at Sixsense AI.</strong> 🎉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*XqrI629eqoIJOkk7c4YsSw.jpeg" /></figure><p>Overall, it was a really interesting interview experience, especially because the conversations went beyond standard DSA and LLD questions and focused heavily on <strong>engineering decisions, scalability, concurrency, and understanding the systems I had actually worked on.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2227b76184bb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Eternal(District) SDE-1 Interview Experience]]></title>
            <link>https://medium.com/@shivam.edu4348/eternal-district-sde-1-interview-experience-34d9f6a6cca6?source=rss-e8ea164f1f2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/34d9f6a6cca6</guid>
            <category><![CDATA[sde-interview]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[interview-experience]]></category>
            <category><![CDATA[data-structure-algorithm]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <dc:creator><![CDATA[Shivam Kumar]]></dc:creator>
            <pubDate>Sat, 09 May 2026 18:42:28 GMT</pubDate>
            <atom:updated>2026-05-09T18:43:45.666Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, I went through a 3-round SDE interview process at Eternal and wanted to document the experience while it’s still fresh in my mind.</p><p>The entire process was a mix of:</p><ul><li>Core CS fundamentals</li><li>Backend engineering concepts</li><li>Distributed systems</li><li>DSA and optimization</li><li>System design</li><li>Managerial discussions around ownership and culture</li></ul><p>What I genuinely liked was that none of the rounds felt like a “memory test.”</p><p>The interviewers continuously pushed discussions deeper with follow-up questions, tradeoff analysis, and real-world engineering scenarios. Most of the conversations felt closer to technical brainstorming sessions than traditional interviews.</p><p>Thankfully, the process ended on a great note — I received a full-time offer from Eternal, and HR shared the compensation details and official offer letter the very next day.</p><h3>Round 1</h3><p>The first round started with a brief introduction and discussion around my internship experience.</p><p>Very quickly, the interviewer shifted into computer science fundamentals and backend concepts.</p><p>We started with the 4 pillars of OOPs.</p><p>Instead of textbook definitions, the interviewer wanted practical examples from real systems. We discussed:</p><ul><li>Abstraction in payment systems</li><li>Inheritance in notification services</li><li>Polymorphism in APIs</li><li>Encapsulation in banking applications</li></ul><p>From there, the discussion moved toward networking concepts:</p><ul><li>HTTP vs HTTPS</li><li>TLS vs mTLS</li><li>Why HTTPS alone may not be enough in enterprise systems</li><li>Mutual authentication in mTLS</li></ul><p>One thing I noticed throughout the interview was that every answer was followed by another “why?”</p><p>The round felt less about definitions and more about depth of understanding.</p><h3>DBMS Discussion</h3><p>The conversation then shifted heavily toward DBMS concepts.</p><p>We discussed:</p><ul><li>ACID properties</li><li>Isolation levels</li><li>Database concurrency</li><li>Phantom Reads</li><li>Connection pooling</li></ul><h3>DSA &amp; Problem Solving</h3><h3>Question 1</h3><p>Select any subarray and increment all its elements by 1. Find the minimum operations required to make all elements equal.</p><p>The interviewer was more interested in the observation and reasoning process than brute force implementation.</p><p>We discussed:</p><ul><li>Greedy intuition</li><li>Transition-based thinking</li><li>Edge cases</li></ul><h3>Question 2</h3><p>Design a system to track Dependency Injection across a project and detect cyclic dependencies.</p><p>This question felt very practical.</p><p>I modeled the dependencies as a directed graph and used DFS-based cycle detection and quickly finished up the code.</p><h3>Puzzle Round</h3><p>Then came the classic water jug puzzle:</p><ul><li>3L and 5L jugs to measure exactly 4L.</li></ul><p>After solving it, the interviewer generalized the problem:</p><blockquote><strong>Given jugs of capacities x and y, measure z liters and write code for it.</strong></blockquote><p>Initially, I approached it recursively.</p><p>Then I optimized it using BFS by modeling every state (a, b) as a graph node.</p><p>The interviewer seemed particularly interested in:</p><ul><li>State-space exploration</li><li>BFS guaranteeing minimum operations</li><li>Avoiding revisiting states</li></ul><p>By the end of Round 1, the interview had already covered:</p><ul><li>Object Oriented Programming Concepts</li><li>Networking</li><li>DBMS internals</li><li>Graph theory</li><li>Puzzles</li></ul><p>It genuinely felt like a compressed CS oral exam.</p><h3>Round 2</h3><p>The second round was significantly more discussion-heavy and backend-focused.</p><p>The interviewer started directly from my internship projects and began asking architecture related questions around the systems I had worked on.</p><p>Very quickly, the conversation shifted toward <strong>Kafka</strong>.</p><p>And honestly, this became one of the most interesting discussions of the entire process.</p><p>We discussed:</p><ul><li>Kafka partitions</li><li>Consumer groups</li><li>Ordering guarantees</li><li>Throughput tradeoffs</li><li>Rebalancing overhead</li><li>Scalability bottlenecks</li></ul><p>One question that led to a very deep discussion was:</p><blockquote><em>“</em><strong>If I keep increasing partitions, will throughput always increase?</strong><em>”</em></blockquote><p>From there, we explored:</p><ul><li>Partition vs consumer balancing</li><li>Idle consumers</li><li>Hot partitions</li><li>Producer side bottlenecks</li><li>Ordering vs scalability tradeoffs</li></ul><p>The interviewer kept introducing production level scenarios instead of theoretical questions, which made the round extremely engaging.</p><h3>High Level Design</h3><p>Next, I was asked to design a <strong>Scheduler system</strong>.</p><p>We discussed:</p><ul><li>Functional requirements</li><li>Delayed task execution</li><li>Retry mechanisms</li><li>Failure handling</li><li>Distributed scheduling</li><li>Worker coordination</li></ul><p>The interviewer continuously added scaling scenarios:</p><ul><li>How do you prevent duplicate execution?</li><li>How would retries work?</li><li>What happens if millions of jobs are scheduled for the same timestamp?</li></ul><p>The conversation naturally evolved toward:</p><ul><li>Queues</li><li>Distributed locking</li><li>Idempotency</li><li>Fault tolerance</li></ul><h3>Problem Solving Round</h3><p>The coding problem involved path matching inside a matrix.</p><p>I first solved it using backtracking.</p><p>Then I optimized time complexity using sets and pruning to avoid repeated computations.</p><p>But the interviewer pushed further:</p><blockquote><em>“Can we optimize space as well?”</em></blockquote><p>Instead of going toward the expected Trie solution, I started discussing compact representations inspired by:</p><ul><li>Run Length Encoding (RLE)</li><li>Huffman Encoding</li></ul><p>The interviewer paused for a moment and said:</p><blockquote><em>“</em><strong><em>I was actually expecting another optimization, but this is a very interesting direction.</em></strong><em>”</em></blockquote><p>That was probably my <strong>favorite</strong> moment of the interview because it transformed into an actual engineering discussion instead of simply chasing the “expected answer.”</p><h3>Final Discussion Indexing Internals Again</h3><p>Toward the end, the interviewer again shifted toward database internals and asked:</p><blockquote>“How does indexing really work underneath?”</blockquote><p>Fortunately, I had written a blog on indexing literally<strong> one day before the interview</strong>, so the topic was extremely fresh in my mind.</p><p>Honestly, that became one of the <strong>strongest</strong> parts of my interview.</p><p>We comfortably discussed:</p><ul><li>B+ Trees</li><li>Disk-optimized structures</li><li>LSM Trees+SSTables</li><li>Read vs write tradeoffs</li></ul><h3>Round 3 — Managerial Round</h3><p>The final round was conducted by a Senior Engineering Manager and was comparatively more conversational.</p><p>Unlike the earlier rounds, this one focused more on:</p><ul><li>Work culture</li><li>Ownership</li><li>Team expectations</li><li>Collaboration</li><li>Growth opportunities</li><li>Compensation discussions</li></ul><p>The manager asked about:</p><ul><li>The kind of engineering problems I enjoy solving</li><li>Whether I prefer ownership heavy environments</li><li>How I approach unfamiliar technologies</li><li>My learning process during internships</li></ul><p>We also discussed:</p><ul><li>Team collaboration</li><li>Communication</li><li>Handling deadlines</li><li>Working in fast-paced environments</li></ul><p>The compensation discussion was transparent and comfortable.</p><p>The manager also explained:</p><ul><li>Team structure</li><li>Engineering culture</li><li>Expectations from new hires</li><li>Long-term growth opportunities</li></ul><p>Compared to the earlier technical rounds, this felt more like a mutual fit discussion rather than an evaluation.</p><p>Toward the end of the conversation, I was informed that the feedback from the previous rounds had been positive and that they would be moving ahead with a <strong>full time offer🥳</strong>.</p><p>Honestly, after such intense technical rounds, hearing that was a huge relief.</p><p>The next day, HR reached out with the compensation details and the official offer letter.</p><h3>Final Thoughts</h3><p>Overall, this was one of the most intellectually engaging interview processes I’ve experienced.</p><p>A few things that stood out:</p><ul><li>Heavy focus on tradeoffs instead of memorized answers</li><li>Deep follow-up questions on almost every topic</li><li>Strong emphasis on reasoning and optimization</li><li>Real engineering discussions instead of purely academic questioning</li></ul><p>One important realization from this experience:</p><p>In strong interviews, interviewers are often less interested in whether you know the “expected solution” and more interested in how you think when pushed beyond standard approaches.</p><p>That’s where the real discussion begins.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34d9f6a6cca6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling Concurrency in Distributed Systems: The Role of Vector Clocks]]></title>
            <link>https://medium.com/@shivam.edu4348/handling-concurrency-in-distributed-systems-the-role-of-vector-clocks-5dc956ad0f37?source=rss-e8ea164f1f2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dc956ad0f37</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[high-level-design]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[distributed-transaction]]></category>
            <dc:creator><![CDATA[Shivam Kumar]]></dc:creator>
            <pubDate>Mon, 04 May 2026 21:30:04 GMT</pubDate>
            <atom:updated>2026-05-04T21:30:04.855Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X3wlMGOZR0JelQUBUeU3-w.png" /></figure><p><strong>Two people. One document. Edits happening at the same time. How does the system decide what actually gets saved?</strong></p><p>While working on tools like Google Docs, Canva, or Trello, you might have noticed that changes from different users appear almost instantly and rarely conflict. But under the hood, this is a non-trivial problem.</p><p>Imagine you and your friend are editing the same Google Doc simultaneously.</p><ul><li>You delete a sentence.</li><li>Your friend edits that same sentence at the exact same time.</li></ul><p>Now the system must decide:</p><ul><li>Which change should be applied first?</li><li>Should both changes be merged?</li><li>What if they conflict?</li></ul><p>This is where handling <strong>concurrency in distributed systems</strong> becomes crucial. But solving this isn’t as simple as picking the latest update.</p><p>In distributed systems, there is no reliable global clock. Two edits can be made at nearly the same time on different machines, and due to network delays, they may arrive in completely different orders.</p><p>So instead of asking:</p><blockquote><strong><em>“Which change came first?”</em></strong></blockquote><p>Systems ask a more fundamental question:</p><blockquote><strong><em>“Did one change happen because of the other, or did they happen independently?”</em></strong></blockquote><p>This distinction is crucial.</p><ul><li>If one change happened <em>after</em> another → it should respect that order</li><li>If both changes happened <em>independently</em> → they are <strong>concurrent</strong>, and a conflict must be resolved</li></ul><blockquote>This idea is called <strong>causality</strong>, and it forms the backbone of how distributed systems reason about concurrent updates.</blockquote><blockquote>To track this causality without relying on time, systems use mechanisms like <strong>vector clocks and version vectors</strong>.</blockquote><blockquote>NOTE: At first glance, these two might seem very similar they both use vectors of counters and follow similar update rules. However, they serve slightly different purposes, and the distinction becomes important as systems grow more complex. We’ll explore this difference in detail toward the end of the blog.</blockquote><h3>What are Version Vectors?</h3><p>Think of a version vector as a <strong>summary of who has updated the data and how many times</strong>. Suppose there are 3 nodes(<strong>replicas</strong>) then each node stores array of counters where each index specify each node changes.</p><p>For example, in a system with 3 nodes:</p><p>Node 0 → [2, 1, 0]. This means:</p><ul><li>Node 0 has updated the data <strong>2 times</strong></li><li>Node 1 has updated it <strong>1 time</strong></li><li>Node 2 has made <strong>no updates yet</strong></li></ul><h3>Working Steps:</h3><ul><li><strong>Initialization</strong><br> All version vectors start with zeros:<br> Node 0 → [0, 0, 0]<br> Node 1 → [0, 0, 0]<br> Node 2 → [0, 0, 0]</li><li><strong>On Update (Write Operation)</strong><br> Whenever a node updates the data, it increments <strong>its own counter</strong>.<br> For example, if a write happens at Node 0:<br> Node 0 → [1, 0, 0]</li><li><strong>Synchronization (Merging Versions)</strong><br>When two nodes communicate, they merge their version vectors by taking the maximum at each index.</li><li>Example:<br> Node 0 → [1, 0, 0]<br> Node 1 → [0, 2, 0]</li><li>After synchronization:<br> Node 0 → [1, 2, 0]<br> Node 1 → [1, 2, 0]</li></ul><blockquote><em>Each node gradually learns about updates made by others, without needing a central coordinator.</em></blockquote><h3>Advantages of Version Vector</h3><ol><li>Version vectors help determine whether two updates are <strong>related (ordered)</strong> or <strong>independent (concurrent)</strong>.</li></ol><h4>Case 1: No Conflict (One Update Happened After Another)</h4><p>Version A → [1, 0, 0]<br>Version B → [1, 1, 0]</p><p>What this means:</p><ul><li>Both versions include Node 0’s update</li><li>Version B has an additional update from Node 1</li></ul><p>Version B has already seen everything in Version A and more. So this is <strong>not a conflict</strong> — B happened <em>after</em> A</p><h4>Case 2: Conflict (Concurrent Updates)</h4><p>Version A → [1, 0, 0]<br>Version B → [0, 1, 0]</p><p>What this means:</p><ul><li>Version A has an update from Node 0</li><li>Version B has an update from Node 1</li><li>Neither knows about the other</li></ul><p>These updates happened <strong>independently. </strong>So this is a <strong>conflict (concurrent updates)</strong></p><h4>Thumb Rule</h4><ul><li>If one version already includes all updates of another → <strong>no conflict</strong></li><li>If both have unique updates → <strong>conflict</strong></li></ul><p>2. Simple to Implement</p><ul><li>Maintain an array like [x, y, z]</li><li>Increment your own index on update</li><li>Take max during sync</li></ul><h3>Challenges of Version Vectors</h3><ul><li><strong>Scalability Issue</strong><br> As the number of nodes increases, the size of the version vector also grows. For example, in a system with 100 nodes, each version vector will have 100 counters, making it <strong>memory heavy and harder to manage</strong>.</li><li><strong>Limited Granularity (Coarse Tracking)</strong><br>Version vectors track <strong>how many updates each node has made</strong>, but not the exact sequence or content of those updates.</li><li>For example:<br> Version → [3, 2, 1]</li><li>This tells us:</li><li>Node 0 made 3 updates</li><li>Node 1 made 2 updates</li><li>Node 2 made 1 update</li></ul><p>But it doesn’t tell:</p><ul><li>The exact order of individual operations</li></ul><blockquote>While version vectors help track data versions, they don’t capture the precise ordering of events. To solve this, distributed systems use <strong>vector clocks</strong>, which we’ll explore next.</blockquote><h3>What are Vector Clocks?</h3><p><strong>Vector clocks</strong> are a data structure used to track the <strong>causal relationships between events</strong> in a distributed system.</p><p>Instead of tracking data updates, vector clocks maintain a set of counters one for each node representing the <strong>number of events observed at each node</strong>. This allows the system to determine how events are related (whether one happened before another or independently).</p><h4>What is Causal Consistency?</h4><p><strong>Causal consistency</strong> ensures that:</p><blockquote><strong>If one event influences another, all nodes will observe them in the same order.</strong></blockquote><p>For example:</p><ul><li>If Event A leads to Event B, every node must see <strong>A before B</strong></li><li>If two events are independent, different nodes may see them in different orders</li></ul><h3>Working Steps</h3><p>Vector clocks follow similar steps to version vectors, with a key focus on tracking <strong>events and their relationships</strong>.</p><ul><li><strong>Initialization</strong><br> Each node starts with a vector clock initialized to zero:<br> Node 0 → [0, 0, 0]<br> Node 1 → [0, 0, 0]<br> Node 2 → [0, 0, 0]</li><li><strong>Processing Events (Local Updates)</strong><br> Whenever an event occurs at a node, it increments <strong>its own counter</strong>.<br> For example, if an event happens at Node 0:<br> Node 0 → [1, 0, 0]</li><li><strong>Exchange of Events (Message Passing / Synchronization)</strong><br> When nodes communicate, they exchange their vector clocks and update them by taking the <strong>maximum</strong> at each index.</li><li>Example:<br> Node 0 → [1, 0, 0]<br> Node 1 → [0, 1, 2]</li><li>After communication:<br> Node 0 → [1, 1, 2]<br> Node 1 → [1, 1, 2]</li></ul><h3>Example:</h3><p>Lets’ take example of <strong>Version Vector</strong> first :</p><p>Let’s consider three replicas: <strong>A, B, and C</strong></p><p>Initial state:</p><ul><li>A → [1, 0, 0]</li><li>B → [0, 1, 0]</li><li>C → [0, 0, 1]</li></ul><p>Each replica has made one independent update.</p><p><strong>Step 1: A and B synchronize</strong></p><p>They merge their version vectors (taking max at each index):</p><ul><li>A → [1, 1, 0]</li><li>B → [1, 1, 0]</li><li>C → [0, 0, 1] (unchanged)</li></ul><p><strong>Step 2: B and C synchronize</strong></p><ul><li>B → [1, 1, 1]</li><li>C → [1, 1, 1]</li><li>A → [1, 1, 0] (unchanged)</li></ul><p><strong>Step 3: A and B synchronize</strong></p><ul><li>A → [1, 1, 1]</li><li>B → [1, 1, 1]</li><li>C → [1, 1, 1]</li></ul><p>Now let’s move onto <strong>Vector Clocks</strong>:</p><h4>Thumb Rule:</h4><p>Suppose there are multiple processes. Each process maintains a vector clock. Whenever an event occurs at process <em>i</em> (either a local event or sending a message, or receiving a message), it updates its clock as:<br> V[i] = V[i] + 1</p><p>When a message is <strong>sent</strong>, the process first increments its own counter and then sends the updated vector clock along with the message.</p><p>When a message is <strong>received</strong>, the process merges the received vector clock with its own by taking the maximum at each index, and then increments its own counter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZQXHxeN9f_vR5XpvWff-GA.png" /><figcaption>Image depicting Vector Clocks (Credits — geeksforgeeks)</figcaption></figure><h3>Tracing the Timeline:</h3><p>Let’s walk through the events step by step using the diagram:</p><ul><li><strong>At event </strong><strong>a (P1)</strong><br> An event occurs at P1, so it increments its own counter:<br> P1 → [1, 0, 0]</li><li><strong>At event </strong><strong>b (P1)</strong><br> Now P1 tries to synchronize so it is a local event, so:<br> P1 → [2, 0, 0]. Now P1 sends this vector clock to P2.</li><li><strong>At event </strong><strong>f (P2)</strong><br> Before receiving the message, P2 has its own local event:<br> P2 → [0, 1, 0]</li><li><strong>At event </strong><strong>g (P2 receives from P1)</strong><br>P2 receives the message [2, 0, 0] from P1. It updates its clock in two steps:</li></ul><ol><li>Take element-wise max:<br> max([0,1,0], [2,0,0]) = [2,1,0]</li><li>Increment its own counter:<br> P2 → [2, 2, 0]</li></ol><blockquote>At this point, P2 is now aware of both its own events and the events that occurred at P1.</blockquote><ul><li><strong>At event </strong><strong>h (P2)</strong><br>Another event occurs at P2 (after receiving from P1), so it increments its own counter:<br> P2 → [2, 3, 0]</li><li><strong>At event </strong><strong>k (P3)</strong><br>Now P3 tries to synchronize with P2 so send event occurs:<br> P3 → [0, 0, 1]. P3 then sends this vector clock to P2.</li><li><strong>At event </strong><strong>h (P2 receives from P3)</strong><br> P2 receives [0, 0, 1] from P3.It updates its clock again in these two steps:</li></ul><ol><li>Take max:<br> max([2,2,0], [0,0,1]) = [2,2,1]</li><li>Increment its own counter:<br> P2 → [2, 3, 1]</li></ol><ul><li><strong>At event </strong><strong>i (P2 sends to P1)</strong><br> P2 now wants to synchronize with P1 so it updates its version vector to [2, 4, 1] and then send the version vector to P1</li><li><strong>At event </strong><strong>d (P1 receives from P2)</strong><br> P1 receives [2, 4, 1]. It updates its clock in following two steps:</li></ul><ol><li>Take max:<br> max([3,0,0], [2,4,1]) = [3,4,1]</li><li>Increment its own counter:<br> P1 → [4, 4, 1]</li></ol><ul><li><strong>At event </strong><strong>e (P1)</strong><br> Another local event occurs at P1:<br> P1 → [5, 4, 1]</li><li><strong>At event </strong><strong>j (P2)</strong><br> A final local event at P2:<br> P2 → [2, 5, 1]</li></ul><h3>Identifying Concurrent and Ordered Events</h3><p>To compare two vector clocks, we use the following rules:</p><p><strong>1. Equality</strong><br> Two vectors are equal if all their corresponding elements are equal:<br> V1 = V2 if for every i, V1[i] = V2[i]</p><p><strong>2. Happened-Before Relation (Ordering)</strong><br> We say V1 &lt; V2 if:</p><ul><li>For every i, V1[i] ≤ V2[i], <strong>and</strong></li><li>There exists at least one j such that V1[j] &lt; V2[j]</li></ul><p><strong>3. Invalid Case (Not Comparable)</strong><br> If there exists:</p><ul><li>Some i where V1[i] &gt; V2[i], and</li><li>Some j where V1[j] &lt; V2[j]</li><li>Then neither V1 &lt; V2 nor V2 &lt; V1. These events are <strong>concurrent.</strong></li></ul><h4>Let’s use the vector clocks from our diagram:</h4><h4>Example 1: Concurrent Events</h4><p>Compare <strong>event </strong><strong>d and event </strong><strong>j</strong></p><p>V(d) → [4, 4, 1]<br>V(j) → [2, 5, 1]</p><ul><li>Index 0 → 4 &gt; 2</li><li>Index 1 → 4 &lt; 5</li></ul><p>One vector is greater in one position and smaller in another.So neither vector dominates the other</p><blockquote>Events <em>d</em> and <em>j</em> are concurrent</blockquote><h4>Example 2: Causally Ordered Events (Non-Concurrent)</h4><p>Compare <strong>event </strong><strong>k and event </strong><strong>i</strong></p><p>V(k) → [0, 0, 1]<br>V(i) → [2, 4, 1]</p><p>For all indices:<br> 0 ≤ 4, 2 ≤ 4, 1 ≤ 1</p><p>So V(k) &lt; V()</p><blockquote>Event <em>k</em> happened before event <em>i</em> (causally related)</blockquote><h3>Advantages of Vector Clocks</h3><ul><li><strong>Descriptive Causality Tracking</strong><br>Vector clocks precisely capture the relationship between events whether one event happened before another or if they occurred independently. This makes them very effective for reasoning about concurrency.</li><li><strong>Versatility</strong><br> They are widely used in <strong>message passing systems</strong>, <strong>event ordering</strong>, and distributed algorithms where understanding the flow of events is critical.</li></ul><h3>Challenges of Vector Clocks</h3><ul><li><strong>Higher Implementation Complexity</strong><br>Compared to simpler approaches like timestamps, vector clocks require maintaining and merging multiple counters, which adds complexity to the system.</li><li><strong>Scalability Issues</strong><br>As the number of nodes increases, the size of the vector clock grows linearly, making it more expensive in terms of memory and communication overhead.</li></ul><h3>Conclusion</h3><p>In distributed systems, the challenge isn’t just handling multiple updates it’s understanding how those updates are related.</p><p>Since there is no global clock, systems rely on <strong>causality</strong> to determine whether events are ordered or concurrent. This distinction is crucial for correctly handling conflicts and maintaining consistency.</p><p>We saw how <strong>version vectors</strong> help track data versions across replicas, making it easier to detect conflicts. However, they fall short when it comes to understanding the exact relationship between events.</p><p>This is where <strong>vector clocks</strong> come in. They provide a more detailed view by tracking event causality, allowing systems to determine whether one event happened before another or if they occurred independently.</p><blockquote><strong><em>In simple terms, version vectors answer </em>“who updated the data?”<em>, while vector clocks answer </em>“how are these events related?”</strong></blockquote><p>These concepts are used in real-world systems like <strong>Amazon DynamoDB, Apache Cassandra, and Riak</strong> to handle concurrent updates and ensure data consistency across distributed environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5dc956ad0f37" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why do we need Indexing in Databases]]></title>
            <link>https://medium.com/@shivam.edu4348/why-do-we-need-indexing-in-databases-e42b05799fd3?source=rss-e8ea164f1f2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e42b05799fd3</guid>
            <category><![CDATA[relational-databases]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[indexing]]></category>
            <dc:creator><![CDATA[Shivam Kumar]]></dc:creator>
            <pubDate>Mon, 04 May 2026 13:32:49 GMT</pubDate>
            <atom:updated>2026-05-04T13:32:49.413Z</atom:updated>
            <content:encoded><![CDATA[<p>At some point, we’ve all memorized this: <em>“</em><strong><em>Indexes make database queries faster</em></strong><em>.”</em><br>And in interviews, that answer usually works.</p><p>But if someone asks, <em>“How exactly?”</em> things suddenly get unclear.</p><p>I faced the same gap while working with databases, and that pushed me to dig deeper. In this blog, I’ll explain indexing in the simplest way possible-no heavy jargon, just clear intuition.</p><h4>How Reading From Disk works?</h4><p>Before understanding indexing, we need to understand a more fundamental concept how databases actually read data from disk.</p><p>When you run a query, your data is not magically fetched from memory. In most cases, it resides on disk, and accessing disk is <strong>slow</strong> compared to RAM. This is the first key idea: <em>the cost of a query is largely dominated by disk reads.</em></p><p>To understand why indexing matters, we need a basic idea of how data is physically stored on disk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*pXazOPzEwmAsMjcFijaBVw.jpeg" /><figcaption>Architecture of a Disk (Credit-<a href="https://x.com/BenjDicken">Ben Dicken</a>)</figcaption></figure><p>A disk is made up of rotating <strong>platters</strong>, and each platter is divided into concentric circles called <strong>tracks</strong>. These tracks are further divided into smaller units called <strong>sectors</strong>, which store the actual data.</p><p>To read any piece of data:</p><ul><li>The disk <strong>rotates</strong> to bring the correct sector under the read head</li><li>The <strong>read head moves</strong> to the correct track</li><li>Only then can the data be accessed</li></ul><p>This process involves <strong>mechanical movement</strong>, which is <strong>much slower than accessing data from memory</strong>.</p><p>Now that we understand disk reads are expensive, let’s quantify this with a real example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*eWfhLtKQcvdhILm6VJ4zMg.png" /><figcaption>Schema for User Table</figcaption></figure><p>Suppose we have above schema for a User table.Approximate size per row = 4 (id) + 4 (age) + 50 (name) + 100 (email) + 8 (timestamp) = <strong>166 bytes </strong>(ignoring small overhead for simplicity)</p><h4>Disk Page Assumption</h4><ul><li>Page size = <strong>4 KB = 4096 bytes</strong></li></ul><p>Number of rows per page ≈ 4096 / 166 ≈ <strong>24 rows per page</strong></p><h4>Now Suppose</h4><ul><li>Total rows = <strong>1,00,000 users</strong></li></ul><p>Total pages needed ≈ 100000 / 24 ≈ <strong>4167 pages</strong></p><h4><strong>What Happens Without Index?</strong></h4><p>Now say we have a simple SQL query-<br>SELECT * FROM USERS WHERE age=25;</p><p>So it will:</p><ul><li>Read <strong>page 1 → check all 24 rows</strong></li><li>Read <strong>page 2 → check all 24 rows</strong></li><li>Continue until <strong>all ~4167 pages are scanned</strong></li></ul><p>Even if only 100 rows match, the database still reads <strong>every single page</strong></p><h4>Why This Is Expensive</h4><p>Each page read:</p><ul><li>May require disk seek (moving read head)</li><li>Waiting for rotation</li><li>Transferring 4KB into memory</li></ul><p>So instead of reading <em>just relevant data</em>, we read <strong>~4167 × 4KB ≈ 16 MB</strong> of data</p><h4>How Indexing Reduces Disk Reads?</h4><p>Let’s now build an intuition for what an index actually stores.</p><p>Suppose we create an index on the age column:</p><p>CREATE INDEX users_age_idx ON users(age);</p><p><strong>Instead of storing full rows, the index stores only:</strong></p><ul><li>The <strong>indexed column value</strong> (age)</li><li>A <strong>pointer (or reference)</strong> to the actual row (usually primary key)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/151/1*-KT-J01kmvUauUaZ4IiF8w.png" /><figcaption>Indexing Table</figcaption></figure><p>Notice : The index is <strong>sorted by age</strong>, not by insertion order.</p><p><strong>Size of Index Entry</strong></p><ul><li>age → 4 bytes</li><li>id → 4 bytes</li></ul><p>Total per entry = <strong>8 bytes</strong></p><p>If we have 1,00,000 rows:<br>Index size ≈ <strong>8 × 100000 = 800 KB</strong></p><ul><li>Table scan → reads <strong>16 MB</strong></li><li>Index scan → reads <strong>~800 KB</strong> (voila!)</li></ul><p>Now consider the query:</p><p>SELECT * FROM users WHERE age = 23;</p><p>Let’s walk through what really happens step by step.</p><h4>Step 1: Search in the Index</h4><p>From earlier:</p><ul><li>Each index entry = <strong>8 bytes</strong></li><li>Page size = <strong>4 KB (4096 bytes)</strong></li><li>Entries per index page = 4096 / 8 = <strong>512 entries per page</strong></li><li>Total rows = <strong>100,000</strong></li><li>Total index pages ≈ 100000 / 512 ≈ <strong>195 pages</strong></li></ul><p>The index is <strong>sorted by age. </strong>So instead of scanning all 195 pages:</p><ul><li>We can quickly <strong>jump to the region where age = 23 starts</strong></li><li>Then read only the nearby entries</li></ul><p>In practice:</p><ul><li>Finding the starting point ≈ <strong>a few page reads (~3–5)</strong></li><li>Reading all matching entries ≈ <strong>1–2 more pages</strong></li></ul><h4>Step 2: Collect Matching IDs</h4><p>Suppose that Age = 23 appears in <strong>100 rows.</strong></p><p>Since index is sorted, all these entries are <strong>stored together.</strong></p><p>So we can fetch all 100 IDs by reading: <strong>~2 pages (since 512 entries fit per page)</strong></p><h4>Step 3: Fetch Actual Rows</h4><p>Now we have 100 IDs → we fetch actual rows from the table.</p><p>From earlier we know each page holds ~24 rows</p><p>Worst case: Rows are scattered → <strong>~100 page reads</strong></p><p>Average case → ~50–60 reads</p><p><strong>Total Cost With Index</strong></p><ul><li>Find correct region in index → <strong>~4 reads</strong></li><li>Read matching index entries → <strong>~2 reads</strong></li><li>Fetch actual rows → <strong>~50 reads (average case)</strong></li><li>Total ≈ <strong>~56 disk reads</strong></li></ul><h3>Final Comparison</h3><p>Full Table Scan → ~4167 reads</p><p>Using Index → ~ 56 reads</p><p><strong>Massive 80% reduction in disk reads.</strong></p><h3>Conclusions:</h3><p>So far, we’ve focused on the intuition behind indexing i.e, keep a smaller, structured view of the data so we can avoid scanning everything.</p><p>In practice, databases implement this idea in different ways depending on the use case:</p><ul><li><strong>Hash-Based Indexes</strong><br>Optimized for exact matches like age = 23. Very fast lookups, but not useful for range queries.</li><li><strong>B+ Tree Indexes</strong><br>The most common type. Maintains data in sorted order and works efficiently for range queries like age &gt; 20.</li><li><strong>LSM Tree + SS Tables</strong><br>Used in systems optimized for heavy writes (like logs or time-series data). Data is written sequentially and later organized for efficient reads.</li></ul><h3>Final Thought</h3><p>Different databases choose different indexing strategies based on their workload read-heavy systems favor structures optimized for fast lookups, while write-heavy systems prefer designs that minimize write cost.No matter the implementation, the goal remains the same:</p><p><strong><em>Reduce the number of disk reads by avoiding unnecessary data</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e42b05799fd3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multi Tenant Architecture]]></title>
            <link>https://medium.com/@shivam.edu4348/multi-tenant-architecture-c62e529bed0b?source=rss-e8ea164f1f2b------2</link>
            <guid isPermaLink="false">https://medium.com/p/c62e529bed0b</guid>
            <dc:creator><![CDATA[Shivam Kumar]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 16:46:59 GMT</pubDate>
            <atom:updated>2026-04-28T16:46:59.320Z</atom:updated>
            <content:encoded><![CDATA[<p>What arises in your mind when you think of word tenant? For most of us it will be something related to rent. Techincally, a <strong>tenant</strong> is a general term that means <strong>someone who occupies or uses something that belongs to someone else</strong>, usually by paying for it.</p><h3>What is a Multi-Tenant Architecture?</h3><p>In multi-tenant architecture, a <strong>tenant</strong> is simply:</p><p><strong><em>one customer (organization/user group) using the shared application</em></strong></p><p>This customer is usually:</p><ul><li>a company</li><li>an organization</li><li>or a group of users</li></ul><p>Think of a SaaS product like a CRM system:</p><ul><li>There is <strong>one application</strong></li><li>Many companies use it</li><li>Each company operates independently</li></ul><p>Each company = <strong>one tenant</strong></p><h3>Example</h3><p>Suppose we build a CRM SaaS platform:</p><ul><li>Company A logs in → sees its own customers, employees, and reports</li><li>Company B logs in → sees completely different data</li></ul><p>Both are using the same application, but they <strong>don’t see each other’s data</strong></p><h3>Why This Matters</h3><p>The most critical aspect of multi-tenant architecture is:</p><blockquote><strong><em>Tenant isolation - ensuring that each tenant’s data remains secure and completely separated from others.</em></strong></blockquote><p>This isolation can be implemented at different levels, we will look at few of them below.</p><h3>Tenant Architectures</h3><h3>Single Tenant Approach (Highest Isolation):</h3><p>In this model, <strong>each tenant is provided with a completely separate instance of the application along with its own dedicated database</strong>.</p><p>This ensures the highest level of isolation and security, making it especially suitable for applications that require strict data segregation and compliance with regulatory standards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*mm4wmGe6NStf2wv3sGT7uA.png" /><figcaption>Single Tenant Architecture</figcaption></figure><h4>Advantages</h4><ul><li>Strong data isolation i.e, no shared resources between tenants</li><li>Enhanced security and privacy</li><li>Easier compliance with strict regulations (e.g., financial or healthcare systems)</li><li>Minimal risk of data leakage across tenants</li></ul><h4>Disadvantages</h4><ul><li>Higher operational costs due to duplicated infrastructure</li><li>Inefficient resource utilization (each tenant uses separate resources)</li><li>More complex maintenance and deployment management</li><li>Scalability can become challenging as the number of tenants grows</li></ul><h3>Shared Application and Separate Databases:</h3><p>In this model, <strong>multiple tenants share a single application instance</strong>, but each tenant has its <strong>own dedicated database</strong>.</p><p>This approach provides a strong balance between <strong>efficient resource utilization</strong> and <strong>data isolation</strong>, since the application layer is shared while data remains physically separated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*YV-aLCoBPyXh0KXt5U_sfQ.png" /><figcaption>Shared Application with Separate Databases</figcaption></figure><h4>Advantages</h4><ul><li>Better resource utilization than single-tenant architecture</li><li>Strong data isolation (data is separated at the database level)</li><li>Easier to manage and update a single application instance</li><li>Reduced infrastructure costs compared to fully isolated setups</li></ul><h4>Disadvantages</h4><ul><li>Increased complexity in managing multiple databases</li><li>Database provisioning and maintenance overhead</li><li>Scaling the database layer independently can be challenging</li><li>Backup, migration, and monitoring become more complex with many tenants</li></ul><h3><strong>Shared Database with Schema Based Isolation</strong></h3><p>In this model, <strong>all tenants share a single application and a single database</strong>, but each tenant’s data is stored in its <strong>own schema within that database</strong>.</p><p>This approach improves database resource efficiency while still maintaining a logical boundary between tenants through schema-level separation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/1*MJC8rYYbMPeQwDSVKhsrJw.png" /><figcaption>Shared Database with Schema Based Isolation</figcaption></figure><h4>Advantages</h4><ul><li>Efficient use of database resources</li><li>Simpler application deployment (single app instance)</li><li>Reasonable level of data isolation via schemas</li><li>Easier to manage compared to multiple databases</li></ul><h4>Disadvantages</h4><ul><li>Lower isolation compared to separate databases</li><li>Risk of schema conflicts or naming issues</li><li>Schema migrations can become complex across many tenants</li><li>Requires careful access control to prevent cross-tenant access</li></ul><h3>Row Level Isolation (Shared Everything)</h3><p>In this model, <strong>all tenants share the same application instance and the same database tables</strong>. Tenant data is separated using a <strong>tenant identifier (e.g., </strong><strong>tenant_id) at the row level</strong>.</p><p>This approach maximizes resource efficiency and is the most commonly used model in large-scale SaaS systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/361/1*L-ZXB65wP_wwZMxYZMRqsA.png" /><figcaption>Row Level Isolation</figcaption></figure><h4>Advantages</h4><ul><li>Maximum resource utilization</li><li>Lowest infrastructure and operational cost</li><li>Simplified deployment and scaling</li><li>Easy to onboard new tenants (no new DB/schema needed)</li></ul><h4>Disadvantages</h4><ul><li>Complex data access logic (must always filter by tenant_id)</li><li>Higher risk of data leakage if isolation is not enforced correctly</li><li>Security concerns require strict validation and safeguards</li><li>Potential performance bottlenecks with high tenant load</li></ul><h3>Hybrid Multi-Tenancy</h3><p>Hybrid multi-tenancy combines elements from multiple tenancy models (separate DB, schema-based, or shared tables) to achieve the right balance between <strong>performance, cost, and data isolation</strong>.</p><p>Instead of a <strong>one-size-fits-all</strong> approach, the system <strong>adapts based on tenant needs</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g0bMEANOBo_bUns7_E3xlQ.png" /><figcaption>Hybrid Architecture</figcaption></figure><h4>Advantages</h4><ul><li>Highly flexible and adaptable</li><li>Can optimize cost vs performance based on tenant size</li><li>Supports enterprise-grade isolation where needed</li><li>Efficient resource utilization for smaller tenants</li></ul><h4>Disadvantages</h4><ul><li>Increased architectural and operational complexity</li><li>More complex routing and tenant management logic</li><li>Harder to maintain consistency across different tenant setups</li><li>Trade-offs between isolation and efficiency must be carefully managed</li></ul><h3>How Multi-Tenancy Exists in Real Products</h3><h4>Slack</h4><ul><li>Each company creates a <strong>workspace</strong></li><li>All users inside that workspace belong to the same tenant</li><li>When you switch workspace, you’re essentially switching tenants</li></ul><h4>Salesforce</h4><ul><li>Each customer gets a <strong>separate org (organization account)</strong></li><li>Data, users, and configurations are tied to that org</li><li>Multiple companies use the same platform but operate independently</li></ul><h4>Google Workspace</h4><ul><li>Each company/domain (e.g., @company.com) acts as a tenant</li><li>Emails, Drive files, and users are isolated within that domain</li></ul><h4>Shopify</h4><ul><li>Each online store = one tenant</li><li>Store owners manage their own products, orders, and customers</li><li>Different stores don’t see each other’s data</li></ul><h4>Zoho</h4><ul><li>Each business account is treated as a tenant</li><li>Data across CRM, Books, Mail, etc. is scoped to that account</li></ul><h3>Conclusion</h3><p>Choosing the right multi-tenancy model is not about picking the “best” architecture it’s about selecting the <strong>right trade-off between isolation, cost, and scalability</strong>.</p><ul><li>If your priority is <strong>maximum security and compliance</strong> → go with <strong>single tenant</strong></li><li>If you want a <strong>balanced approach</strong> → use <strong>separate databases or schemas</strong></li><li>If you need <strong>high scalability with low cost</strong> → shared database (row-level) works best</li><li>And if your system serves <strong>diverse customers with different needs</strong> → <strong>hybrid multi-tenancy</strong> is the most practical choice</li></ul><p>In real-world systems, <strong>hybrid models are becoming the standard</strong>, because one size rarely fits all.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c62e529bed0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>