<?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 Gauravgupta on Medium]]></title>
        <description><![CDATA[Stories by Gauravgupta on Medium]]></description>
        <link>https://medium.com/@gauravgupta50300?source=rss-c5535ad11afa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*cNaaHElL1BUrns2T5XBB6Q.jpeg</url>
            <title>Stories by Gauravgupta on Medium</title>
            <link>https://medium.com/@gauravgupta50300?source=rss-c5535ad11afa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 21:04:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gauravgupta50300/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[Your pen is mightier than your computer]]></title>
            <link>https://medium.com/@gauravgupta50300/your-pen-is-mightier-than-your-computer-a62d5c96c119?source=rss-c5535ad11afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/a62d5c96c119</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[logic]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Gauravgupta]]></dc:creator>
            <pubDate>Mon, 22 Dec 2025 05:36:26 GMT</pubDate>
            <atom:updated>2025-12-22T05:36:26.110Z</atom:updated>
            <content:encoded><![CDATA[<p>Stop it, that just can’t be possible, right? Wrong. When I say, you listen and resonate. Your pen is nothing without you. Yes you, you are the x-factor. Your pen is simply a tool that you use to ‘pen’ down your ideas (see, I just did a word play there ;-). It helps you transform your neural signals, usually in the range of millivolts (mV), to well documented revolutionary ideas. Now, if you code, design or even build something regularly, scribbling increases efficiency and productivity. I have interacted with some of the finest developers, application architects, system engineers and even scientists, who have extremely powerful devices, rely on simple pen and paper to ideate and re-ideate.</p><p>This efficiency boost while working with pen and paper is mainly because of two reasons:</p><ol><li><strong>The freedom</strong>: While scribbling, you have the freedom to write or draw and scratch in multiple cycles. You have all the wrong and right ideas in front of you over which you can build your ultimate foolproof and resilient idea.</li><li><strong>The childhood habit</strong>: From our childhood days, we have been relying heavily on pen and paper to write. The comfort of having a pen and paper when noting down something is incomparable.</li></ol><p>There is nothing like the duo of pen and paper if you want to write down something important. From drawing blocks representing arrays or lists, to drawing screen layouts that you need to develop, from designing logo for your clients to implementing path planning algorithms, it all starts on a white paper. Trust me, when I restate myself, I have seen the best of the architects, developers and scientists document their ideas using pen before tapping on the keys. So next time, if you are solving a DSA problem, designing a complex system or a database, designing an aviation circuit or even an AIRCRAFT BODY!! never forget your mighty pen.</p><p><strong>P.S.:</strong> Your pen is a tool to note down the ideas popping up in your brain. If your brain is lazy and useless (just like mine), a pen would be of no use!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a62d5c96c119" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clarifying Cache…]]></title>
            <link>https://medium.com/@gauravgupta50300/clarifying-cache-48519d057bbc?source=rss-c5535ad11afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/48519d057bbc</guid>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[applicationdevelopement]]></category>
            <category><![CDATA[trending]]></category>
            <category><![CDATA[cache]]></category>
            <dc:creator><![CDATA[Gauravgupta]]></dc:creator>
            <pubDate>Sat, 21 Jun 2025 12:51:29 GMT</pubDate>
            <atom:updated>2025-06-21T12:51:29.016Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever cleared your phone’s cache (pronounced as cash + é) to free up space or boost performance, only to wonder — what exactly is cache, and why does it matter? Worry not, I am here to answer all such queries related to cache.</p><p>The concept behind cache was introduced by the British scientist <strong>Maurice Wilkes in 1965</strong>, however at that time cache was referred to as “slave memory”. Wilkes introduced this concept in his paper titled “Slave Memories and Dynamic Storage Allocation”. The core idea behind this “slave memory” was to create<strong> a faster layer of memory that could store frequently accessed data, thus improving overall system performance</strong>. IBM’s Model 85 became one of the first computers to utilize the concept of cache memory. Cache memory is now a fundamental part of computer architecture, used in CPUs, web browsers, and other applications to improve performance.</p><p>Let me explain to you the idea behind cache with a simple example. Imagine you’re researching a topic and need to refer to multiple books and journals. The best place to find them is a library, but going back and forth every time is inefficient and time-consuming. A smarter approach? Borrow the most useful books and keep them on your study desk. This way, you have quick access to key resources without repeatedly searching the library. Plus, you avoid wasting time skimming irrelevant material.</p><p>In this scenario:</p><ul><li>Your study desk = Cache (temporary storage for quick access)</li><li>The library = Main data source (original storage, like a server or database)</li><li>The borrowed books = Frequently accessed data (what your app needs regularly)</li></ul><p>Cache works the same way — it stores often-used data nearby so your system doesn’t have to fetch it repeatedly, saving time and improving performance. Going back to our library vs. study table analogy, there are a few important things to keep in mind when using cache effectively:</p><ul><li><strong>Limited Space, Smart Allocation — </strong>Your study table (cache) has limited space — you can’t keep every book (data) on it. Thus, the best strategy would be to keep only the most relevant books — those you refer to frequently. Similarly, cache should store highly accessed data to maximize efficiency.</li><li><strong>Timely Cleanup — </strong>Once you’re done with a book and won’t need it soon, remove it from the table to free up space. Likewise, cache should deallocate data that’s no longer needed, making room for more relevant entries.</li></ul><p>Now let us understand why and how some of the common applications around us use cache:</p><ul><li><strong>Web Browsers (Chrome, Firefox, Edge) </strong>— Browsers use cache to store static resources like images, CSS, and JavaScript files locally and keep frequently visited webpage elements in memory. It helps in faster page loads when revisiting sites and reduced bandwidth usage. So when you revisit a news site, the logo and layout load instantly from cache.</li><li><strong>Social Media (Instagram, Facebook) </strong>— These platforms use cache to pre-load our feed content, store profile pictures and stories and cache trending hashtags and posts. This helps in smooth scrolling experience and works better in low-network conditions. This overall helps our feed load instantly when reopening the app.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48519d057bbc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kafka — The messenger your applications need.]]></title>
            <link>https://medium.com/@gauravgupta50300/kafka-the-messenger-your-applications-need-d2d17dd59046?source=rss-c5535ad11afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2d17dd59046</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[kafka-producer]]></category>
            <category><![CDATA[api-development]]></category>
            <category><![CDATA[kafka-topic]]></category>
            <category><![CDATA[kafka-consumer]]></category>
            <dc:creator><![CDATA[Gauravgupta]]></dc:creator>
            <pubDate>Fri, 10 Jan 2025 08:36:18 GMT</pubDate>
            <atom:updated>2025-01-10T08:36:18.999Z</atom:updated>
            <content:encoded><![CDATA[<h3>Kafka — The messenger your applications need.</h3><p>Recently, as part of a project, I had the opportunity to work with Apache’s Kafka to establish communication between microservices. Before diving into the technical details, let’s first understand the concept of asynchronous communication with a simple real-life example. Imagine two scenarios of communicating with your boss. In the first scenario, you’re on a phone call, and your boss asks for an update on the day’s tasks. You’re under pressure to respond immediately with accurate facts and figures, which can be challenging if you’re not fully prepared. Now, consider a second scenario where your boss requests the updates via text or email. This approach is much more convenient for you. You have the time to gather all the necessary information, organize it properly, and present it in a well-structured manner without the stress of responding instantly. Here, communication through email represents asynchronous communication. In asynchronous communication, the sender and receiver do not need to be synchronized in real time. The sender can deliver the message, and the recipient can respond at their own convenience.</p><p>Imagine you are developing a food delivery application and have divided it into two layers. The first layer handles business validations for incoming requests, while the second layer forwards these requests to partner APIs to place orders. Now, suppose the second layer becomes temporarily unavailable due to high traffic. If the communication between these two layers is synchronous, customers would encounter “technical errors.” However, with Kafka in place, the requests from the first layer would be stored in a topic until they are processed by the second layer. This prevents technical glitches from affecting the customers. Instead, the application can display messages like “Request raised” or “Confirmation pending” on the user interface, ensuring a smoother and more user-friendly experience compared to the previous scenario where customers faced immediate errors.</p><p>Here I would explain the basic components of Kafka architecture and how you can implement asynchronous communication between two or more microservices using Kafka. Before we dive deeper, we need to be familiar with few terminologies — brokers, messages, topics, producers and consumers as these are essential components for implementing service communication using Kafka.</p><p>A Kafka server is referred to as a <strong>broker</strong> and multiple brokers are referred to as a <strong>cluster</strong>. A message is basically a record/event/request sent by one of the producers and will be consumed/read by one of the consumers. The basic responsibility of a broker is receiving and storing message from producers and facilitating the consumers to fetch the message intended to be consumed by them. <strong>Producers</strong>, as the name suggest are basically the senders in this communication scenario. They write the request/message to entities called <strong>topics </strong>which can be read/consumed by the <strong>consumers. </strong>Multiple producers can publish to a single topic and similarly, multiple consumers can consume data from a single topic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wFmEnWWre_NM6WoKWbJcBw.png" /><figcaption>Fig 1: The image depicts the basic components involved in Kafka communication architecture.</figcaption></figure><p>Kafka categorizes messages into topics. Ideally, the messages in a topic should be related. For example, in a hotel management service, the topic named orders will have all orders placed. Kafka has provisions for configuring the retention policy for individual topics. This basically means that we can configure how long a particular message stays in a topic before it gets dropped. Any message stays in the topic for this configured time period irrespective of the fact that it gets consumed or not. The topics are subdivided into several partitions as depicted in <em>fig. 1</em>.</p><p>Whenever a producer publishes a message into a topic, it gets <strong>appended </strong>into one of its partitions depending upon the key we are passing with the message. Here the word “appended” is of high importance. It conveys the sense that order of message is maintained in the partition. When a message is published into a topic, it can be written to any of the partitions inside the topic (load balancing can be implemented here), but it will always be appended <strong>to the end of the queue</strong> in that partition. Refer to <em>fig. 2</em> below for clarity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1023/1*BkLFWHdFOrAfDB6Xw8z8xQ.png" /><figcaption>Fig 2: The image depicts the process of publishing a message in Kafka topic.</figcaption></figure><p>Generally, a key is also generated with the message before the publisher publishes the message to the Kafka topic. This key is optional, but it becomes quite useful if the message is to be published into a particular partition of the topic. Ideally, a particular partition should have message with same/identical key. The keys can be configured to be of any data type: integer, string, UUID, etc.</p><p>Hopefully, we are now comfortable with the components of Kafka architecture and their primary roles in it. Now, let us understand how Kafka helps us implement asynchronous communication between microservices. The producer generates the message and publishes it to the broker. This broker then decides the partition where the message is to be published. This decision is influenced by several factors like the key generated with the request, the load balancing approach implemented, etc. Once the message is sent into the partition, now the consumers start issuing fetch requests to the brokers leading the partition it wants to consume. Logging is implemented in Kafka which helps keep track of what has been consumed. If the consumer is down or out of service due to some technical mishaps, the message resides in the topic — this facility to keep requests in the topic reduces the backpressure on the downstream systems as well which is very helpful during hours of high traffic. Once the consumer is active and resumes its services, it can consume the messages in the topic that were intended to be consumed by it. This ability to consume message as per the availability of the consumer helps in loose coupling of the microservices and facilitating independent development and deployment. The consumer and the related services are under no pressure to respond to the request immediately.</p><p>The advantages of Kafka based communication are as follows:</p><ol><li><strong>Loose coupling: </strong>Independent development and deployment of services.</li><li><strong>Scalability: </strong>Kafka helps building scalable application as it can handle high volume of data and traffic. This makes it an exemplary solution for real time data processing services.</li><li><strong>Fault tolerance: </strong>Kafka ensures message delivery and processing even case of service down-time and network failures. It also makes the service highly available.</li><li><strong>Reduced Back pressure: </strong>Kafka implementation ensures that the back pressure is reduced on the downstream systems as well, since the request reside inside the Kafka topics until it gets consumed. So, even if the downstream APIs are unavailable, Kafka manages those scenarios as well.</li></ol><p>These advantages of Kafka have made it an extremely demanding technology. Its ability to provide these benefits even with requirements managing huge amount of data is praise worthy. Several companies and firms like Netflix, Uber, PayPal, etc. have already implemented solutions using Kafka and several others have started migrating their architecture to Kafka. The demand for professionals having a knack for implementing Kafka based solutions is all time high and is predicted to rise even further. So, next time when you are trying to implement communication between microservices you can give Kafka a try!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2d17dd59046" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Securing your data using the HSM]]></title>
            <link>https://medium.com/@gauravgupta50300/securing-your-data-using-the-hsm-6402c7b999ac?source=rss-c5535ad11afa------2</link>
            <guid isPermaLink="false">https://medium.com/p/6402c7b999ac</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[hsm-541]]></category>
            <dc:creator><![CDATA[Gauravgupta]]></dc:creator>
            <pubDate>Sat, 14 Dec 2024 08:18:45 GMT</pubDate>
            <atom:updated>2024-12-20T14:23:23.810Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine you’ve stored all your wealth in a secure money vault (vault A) and decided to hide the key (Key K) under the doormat of your main entrance. Then, one day, your house is robbed, and the thieves immediately find the key under the mat. Alarming, isn’t it? You know you’re in danger. Now, picture a different approach where you’ve prioritized security: instead of hiding the key under the mat, you lock it inside another vault (vault B), secured with a password that only you know. Your assets are now much safer, right?</p><p>An HSM (Hardware Security Module) is a device primarily responsible for securely storing keys used for data encryption and decryption. In analogy with the previous example, think of your valuable assets as the sensitive data that needs protection. Just like the vault A secures your assets; encryption secures the sensitive data. Thus, the key of vault A becomes analogous to key used for data encryption. The HSM in fact encrypts this key itself, just like the vault B securely stores the key to vault A. The key role here is played by you, representing the HSM. Just as you store the ultimate passcode for Vault B securely in your memory, the HSM securely stores a master key called as <strong>LMK (Local Master Key)</strong> in its memory. You use the passcode to unlock vault B and get the keys for vault A, the HSM uses its master key to encrypt/decrypt the keys that is used later for data encryption. Like the passcode for Vault B that only you know, the LMK remains strictly private and secured inside the HSM. This setup ensures that only the HSM can decrypt keys encrypted with the LMK, just as only you can unlock Vault B.</p><p>Only the HSM that encrypted the data, or another HSM with identical inbuilt LMKs, can decrypt it. Additionally, the HSM generates the encryption and decryption keys internally. The HSM is incredibly fast, efficiently performing encryption and decryption tasks even under heavy workloads. Its tamper-proof design makes it an ideal choice for securing highly sensitive data in organizations such as banks. Beyond encryption, the HSM can also perform tasks like offset generation, PIN generation, random number generation, and more. All these tasks are assigned various codes called as <strong>command code</strong> which are sent as a part of command. This code helps the HSM identify which operation it has to perform. HSMs generally have a GUI from where all the admin changes can be done/monitored. To send commands to an HSM, a normal java-based application can be developed. The commands are sent via TCP communication established between the HSM and the application. The HSM understands commands in bytes format, so, the commands sent to HSM needs to be an array of bytes. The HSM response is also in bytes format. <strong>Special attention should be paid on the data types and length passed to the HSM, as these are the areas of mistakes that are often difficult to debug.</strong></p><p>The image below diagrammatically represents the process of encryption performed using HSM. The steps below clearly explain the complete process:</p><ol><li>The java application sends the data (to be encrypted) along with the encryption key (this is the key generated by HSM) to be used for encrypting the user’s data.</li><li>The HSM first decrypts the key (sent by the user) using the LMKs stored inside the HSM. The keys are now ready for encrypting the data sent by the user.</li><li>The key and the data are passed to the encryption block inside the HSM. The algorithm to be used for encryption can be selected by the user. The algorithms are assigned specific codes which can be passed in the command code.</li><li>The data encryption block generates the encrypted data using the keys and the algorithm selected by the user in command code.</li><li>The generated data is sent back to the application.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bx58vs7qm49plyuarvptgQ.png" /><figcaption>A simple block diagram representing the crucial blocks of an HSM.</figcaption></figure><p>Hence, we can conclude that HSM provides an additional layer of security by encrypting the keys itself. The fact that the keys can be decrypted only by the HSM itself and that the decrypted key can never be revealed to the outer world, makes the HSM an extremely efficient solution for implementing security in critical organizations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6402c7b999ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>