<?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 Barkha Shukla on Medium]]></title>
        <description><![CDATA[Stories by Barkha Shukla on Medium]]></description>
        <link>https://medium.com/@shuklabarkha17?source=rss-7362c2950b76------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eaBpb52UIaQ0G8ySXQ0J2A@2x.jpeg</url>
            <title>Stories by Barkha Shukla on Medium</title>
            <link>https://medium.com/@shuklabarkha17?source=rss-7362c2950b76------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 02:53:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shuklabarkha17/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[Hosting a static website on S3 and securely accessing it!]]></title>
            <link>https://medium.com/@shuklabarkha17/hosting-a-static-website-on-s3-and-securely-accessing-it-605d8ccca540?source=rss-7362c2950b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/605d8ccca540</guid>
            <category><![CDATA[route-53]]></category>
            <category><![CDATA[static-website-hosting]]></category>
            <category><![CDATA[cloudfront]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Barkha Shukla]]></dc:creator>
            <pubDate>Tue, 30 Jun 2020 02:23:39 GMT</pubDate>
            <atom:updated>2020-06-30T02:24:29.673Z</atom:updated>
            <content:encoded><![CDATA[<p>The hosting part is covered in- <a href="https://medium.com/@shuklabarkha17/create-a-portfolio-using-react-part-1-a8b7c0079457">https://medium.com/@shuklabarkha17/create-a-portfolio-using-react-part-1-a8b7c0079457</a></p><p>Let’s get ahead of the redundancy and dive straight into defining our problem!<br>After uploading the build version of your website on an S3 bucket, you notice that the URL of the bucket is visible, which poses a security issue!!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yLH5n1PQdyNonLCDH6pEHw.png" /></figure><p>Now, this can be addressed using Route53 as a DNS service, Certificate Manager, and CloudFront for distribution.</p><p>You will also need access to your domain name provider like Bluehost, GoDaddy, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*JoZWxyA7rbjGruI5ZpGNZw.png" /></figure><p>Route53 is configured to use CloudFront for all requests it receives, while the S3 bucket is set as the origin for CloudFront.<br>So, all requests will be served through CloudFront and not directly access the S3 bucket.<br>I know it might sound like a bunch of <em>jdhaskjdlad,</em> let’s look at each and every step to understand what’s going on here!</p><h4>Log in to the AWS console: <a href="https://aws.amazon.com/console/">https://aws.amazon.com/console/</a> and go to services…</h4><p>Assuming you have the S3 bucket ready with the website content.<br>Note: the S3 Bucket name should be the same as your domain name <br>Example- <br>domain name = barkhashukla.com and S3 bucket= barkhashukla.com</p><p>And the bucket policy should be: Read Only Permission to an Anonymous User (Documentation →Bucket Policy Examples)</p><p>Also, replace the Resource with your own domain name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*BgFXf5T3mwcjl-IY4nxIow.png" /><figcaption>S3 Bucket Policy</figcaption></figure><h3>#1. a) Configure Route53:<br>Select Route53 and you should see the Dashboard-</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X4RX_m9khVzgnEEObNSeUw.png" /><figcaption>Route53 Dashboard</figcaption></figure><p>Let’s go ahead and create a hosted zone! [Left panel — #2]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rKx4A0D0Hci04T9Zh4376Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*CDCit6Sw91O-yKT_Qynflw.png" /></figure><p>The Create Hosted Zone Button will lead you to this, just enter your domain name (same as s3 bucket name) and hit “Create”!<br>Example: In my case — the website is called “barkhashukla.com”</p><p>WE now need to create a recordset: Notice that you see 2 existing records of types: NS and SOA.<br>Copy the NS Records “Value” (all 4 of them) and go to the provider’s website. I have used GoDaddy.com. <br>Go to DNS and paste the 4 values (one on each line) under NameServers! Refresh the page to make sure the Nameservers are updated and we are done with GoDaddy! Let’s go back to the AWS Console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*unAu9JHrIpxJKy886ZxKCQ.png" /><figcaption>GoDaddy: DNS Management-NameServers</figcaption></figure><h3>#2. Configure CloudFront:<br>Select CloudFront from the list of AWS services :</h3><p>Fill out the Origin Domain Name and Viewer Protocol Policy as in the image below and hit “Create”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*QtdTmd_jEf5hJRHqeJre_g.png" /><figcaption>Create CloudFront Distribution</figcaption></figure><p>While this gets deployed, click on the distribution and enter the Alternate Domain name as your domain “barkhashukla.com”. Also, look at the SSL Certificate row right after it — go ahead and select “Custom SSL Certificate”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FUG_zia3cd2Rp8IZM-1hFQ.png" /><figcaption>CloudFront Distribution: Request a Certificate</figcaption></figure><p>You must have guessed it at this point (or not, it’s ok!) that we are paving our way for the Certificate Manager! Quickly click on “Request or Import a Certificate with ACM”.</p><h3>#3. Certificate Manager:</h3><h4>Simply enter your domain name “barkhashukla.com”, click next and opt for DNS Validation.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*od8FqnmiPdtKpyab9izlCA.png" /></figure><blockquote>To complete the validation process you need to add this record to Route53. This can be done manually or as AWS likes to make our lives easier- just click on “Create Record in Route53&quot;. To verify this, you can go to Route53 and see that there was a new CNAME record along with the 2 exi!</blockquote><blockquote>Hit Continue, the validation might take a while depending on the provider.</blockquote><h4>Going back to CloudFront:</h4><p>Refresh and you fill find your certificate within the dropdown list. Select the certificate and hit “Yes, Edit”. At this point, we are done with CloudFront and Certificate Manager, what’s left? one last thing to add on Route53.</p><h3>#1. b) Add Records to Route 53:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*ULsRFXcF8RqGhfwG_DY5QA.png" /></figure><p>Let’s go back to our hosted zone and create a new record.<br>Type: A-IPv4 address<br>Alias-Yes; select the CloudFront distribution from the dropdown.<br>Hit Create!</p><p>After the first request, the content will be cached by Cloudfront and served!</p><h3>Ready for the results? Go check your domain!</h3><h3>VOILA!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qe9u1BGN2AyttBj8JvPJTA.png" /><figcaption>Final Result</figcaption></figure><blockquote>If you found this article helpful, it would mean a lot if you gave it some applause 👏 and shared to help others find it!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=605d8ccca540" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Design: Instagram]]></title>
            <link>https://medium.com/@shuklabarkha17/system-design-instagram-f599ad3c3910?source=rss-7362c2950b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/f599ad3c3910</guid>
            <category><![CDATA[instagram]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <dc:creator><![CDATA[Barkha Shukla]]></dc:creator>
            <pubDate>Sun, 03 May 2020 19:53:49 GMT</pubDate>
            <atom:updated>2020-05-07T20:33:31.881Z</atom:updated>
            <content:encoded><![CDATA[<p>You know the drill!<br>Let’s begin…</p><p><strong>Features:</strong><br>1. Be able to store and pull images. <br><em>We need a cheaper storage solution to implement this!<br></em>2. Be able to follow people.<br>3. Be able to like/ comment on a post.<br><em>For now, we do not implement a chain of replies and comments (recursive) for the sake of simplicity, instead just one reply on a comment. You can also like a comment!</em></p><blockquote><em>Let’s see what the database looks like!</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LX-QwgEvtGDQVitasBTmdA.png" /><figcaption>Database : Instagram</figcaption></figure><p><strong>What table will give what information?</strong></p><p><strong>— POSTS Table: </strong>Get all posts for a user/ get a particular post.<br> — <strong>ACTIVITY Table: </strong>Get the number of likes on a post/comment.<br> — <strong>COMMENTS Table: </strong>Get all the comments on a post.<br> — <strong>LIKES Table: </strong>Get all the people who have liked a post.</p><blockquote>Now, How do we achieve the feature “following someone” ?</blockquote><p>You can have a table with the following columns:<br>FollowerID — FolloweeID — TimeStamp<br>This way you can retrieve all followers of a user! Easy right?</p><h3>Let’s look at the architecture now!</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yaIwjj0lAdUyb3GqS-sUPw.png" /><figcaption>Instagram: Architecture</figcaption></figure><h4>Optimization:</h4><ol><li>Expose an API: getPostsByUsers<br>will give all user IDs at once (bulk fetch)</li><li>Limit Posts to 20: Reduce the Network Load<br>Instead of using a for loop to get and set User IDs, we can pre-compute the user feed. Why? because the looping mechanism does not scale well and is definitely not cost-effective!<br><strong>How do we pre-compute? <br>Say we have a new post →Posts Service →Notify UserFeed service → Which maintains Queues in the Cache (uses Least Recently Used algorithm) → E.g: Post(User_ID=2)</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*mqVCPxfurMGGoo7DwfQJog.png" /></figure><p>The above technique is called a push model, we can also have a pull model where we wait for the user to request. We might also consider batch processing in case of millions of users.</p><blockquote>Gaurav Sen on Youtube has been amazing in explaining how Instagram newsfeed works. <em>If you found this article helpful, it would mean a lot if you gave it some applause 👏 and shared to help others find it!</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f599ad3c3910" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a Portfolio using React — Part 1]]></title>
            <link>https://medium.com/@shuklabarkha17/create-a-portfolio-using-react-part-1-a8b7c0079457?source=rss-7362c2950b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8b7c0079457</guid>
            <category><![CDATA[portfolio]]></category>
            <category><![CDATA[s3]]></category>
            <category><![CDATA[react-setup]]></category>
            <dc:creator><![CDATA[Barkha Shukla]]></dc:creator>
            <pubDate>Fri, 01 May 2020 21:14:01 GMT</pubDate>
            <atom:updated>2020-05-01T23:52:37.144Z</atom:updated>
            <content:encoded><![CDATA[<h3>Create a Portfolio using React &amp; AWS S3!</h3><p>After binge-watching Netflix for an entire day, I ended up creating <a href="http://barkhashukla.com/">this </a>website using React.js and deployed it using AWS S3 (utilize Free tier). <br>We will also be using a design template from colorlib (Jackson).</p><blockquote>Github: <a href="https://github.com/BarkhaShukla/My-Portfolio">https://github.com/BarkhaShukla/My-Portfolio</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pjg97UGsCZyv_a-pfEvTaQ.png" /></figure><h3>Let’s dive into the basic setup:</h3><p><strong>Pre-requisites:</strong></p><p>— A cup of tea/ coffee/ beer + some music!<br> — VS Code: An awesome editor/compiler for Web Applications or you can continue with Sublime, Atom, etc.(even Notepad++ !)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*tML5F64GyOjjlefnM-PvZg.png" /><figcaption>Verify Node installation success</figcaption></figure><p>— The next step is to download the Node.js installer (<a href="https://nodejs.org/en/download/">Download Here</a>), to be able to use React. Verify that the installation was successful by just typing “node — version” in the cmd prompt.</p><p><strong>Install Create-React-App package</strong> to simplify the process of creating and installing React (let’s use anything that can simplify this for us right?)<br>Go back to the cmd prompt: <strong>npm install -g create-react-app </strong>(-g stands for global, while npm is the package manager).<br>Now go ahead with — <strong>create-react-app portfolio </strong>(portfolio being the name of the directory, make sure you are in the right path/location).<br>The entire process is automated and begins with creating a new React app folder for the project, then installs packages and dependencies. The default packages include react, react-dom, and react-scripts.</p><p>To simplify the rest of the process, let’s eliminate cmd and go to visual studio code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iPcOF5eX6Z1eUUxTl8FJHQ.png" /></figure><p>Congratulations, you have successfully completed the basic setup required.<br>Now all you need to do is some magic! (or typing .. )</p><p><strong>Creating an AWS account: </strong><a href="https://aws.amazon.com/console/">https://aws.amazon.com/console/</a><br>We will only be using 2 commands to run and build the project:<br><strong>npm run start &amp; npm run build</strong>, the latter one being used in the end to create a build version, which will then be uploaded on S3.</p><p><strong>Design Template:</strong> <a href="https://colorlib.com/wp/template/jackson/">https://colorlib.com/wp/template/jackson/</a><br>Download the above template and add it to your project.</p><h3><strong>Time to dive into the Building Part —</strong></h3><p>For now, it is enough to know that React is the JavaScript library used for building UI components (Learning React would really help in adding components and features to this existing project template!)</p><p>Create a components folder under the src directory. This is where we will store our components.</p><ul><li>Copy all the images, fonts, CSS files you decided to work with into the public folder. (don’t worry if the answer is none, you can simply reverse engineer in that case)</li><li>Run the npm install command which will install dependent modules under node_module directory.</li><li>The npm start command will take you to<a href="https://localhost:3000/">https://localhost:3000</a> , where you can see the fruit of all this work!</li></ul><p>Remember the component folder which we created under thesrc directory ? Now we add components to this folder. Notice that the components are in JSX format, which is nothing but html that is understandable by React</p><ul><li>Start by identifying components you can create — like header, footer, and sidebar. Try looking into the Github Repository to see how components are structured.</li><li>Play around with the HTML and CSS to change the content according to your taste. You can try changing the content, try out different fonts, changing colors, and adding some pictures of your choice.</li></ul><h3>DEPLOYING ON S3:</h3><p>While there are many cloud providers available, AWS has its benefits:</p><ul><li>The “Free Tier” is a huge benefit !!</li><li>Offers unmatched scalability, elasticity, performance, and security.</li></ul><p>By using the static website hosting feature on an S3 bucket, we can host for less than $3/ month and scale for millions of users!<br>S3 consists of buckets which are storage containers for files. A bucket is high availability and high durability flat object store with no hierarchy.</p><ol><li><strong>NAMING YOUR S3 BUCKET:<br></strong>You need an S3 bucket first before you can even begin hosting. For this Portfolio project, it is important that your <strong>bucket has the same name as your domain name. </strong>Example: The domain name — <a href="http://www.barkhashukla.com,/">barkhashukla.com,</a> then your bucket name must be barkhashukla.com as well. <strong>Why? It </strong>has to do with how requests are routed to S3. The request comes into the bucket, and then S3 uses the Host header in the request to route to the appropriate bucket.</li><li><strong>CONFIGURING THE BUCKET:</strong></li></ol><ul><li>Navigate to S3 in the AWS Console. (type S3 in the search bar, way too many services if you are glancing for s3!)</li><li>Click into your bucket.</li><li>Click on the “Properties” section.</li><li>Click on the “Static website hosting” option.</li><li>Select “Use this bucket to host a website”.</li><li>Enter “index.html” as the index document.</li></ul><p>3.<strong> SETUP BUCKET POLICY:<br></strong>This bucket must be accessible to anyone in the world. This is called anonymous access. For our use case, we <strong>need </strong>a public access bucket policy (not the default behavior of a new s3 bucket). To allow this :</p><ol><li>Click into your bucket.</li><li>Select the “Permissions” tab at the top.</li><li>Uncheck all the options!</li></ol><p>You must complete this step before adding the bucket policy to your static website bucket.<br>Now you must update the Bucket Policy to have public read access to anyone in the world:</p><ul><li>Navigate to S3 in the AWS Console.</li><li>Click on your bucket.</li><li>Click the “Permissions” section.</li><li>Select “Bucket Policy”.</li><li>Add the following Bucket Policy and hit Save (play around with it to learn more, have a look at the policy generator.)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*eGmwdJjRBP5KryFTepGqTg.png" /></figure><p>It is important to note the &quot;Principal&quot;: { &quot;AWS&quot;: &quot;*&quot; }section of the bucket policy. Because of this, any object in this bucket is available to the public via the S3 website URL.<strong> Don’t add anything in this bucket that you’re not willing to share with the world.</strong></p><p><strong>Go to your S3 bucket and upload the build version of your project to it (you will see a build folder after executing npm run build)</strong></p><h3>Add a domain name:</h3><p>You have a bucket that is configured for static website hosting. It has an S3 website URL. You understand that this bucket is accessible to the world, good going!!</p><p>I bought a domain name for $1/year from godaddy.com, there are other such providers like Bluehost! Find one and buy a domain.</p><p>You’ll need to provide the mapping from your domain name<a href="http://www.my-awesome-site.com,/">,</a> to your S3 URL. This mapping is often referred to as a CNAME record in your Domain Name Server (DNS) Manager records.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CCIGKkqaQuFYKMsC6J7HtQ.png" /></figure><h3>FUTURE ADDITIONS:</h3><ul><li><strong>Blog: </strong>Create your own blog using Node.js and a NoSQL database like MongoDB and merge it into the portfolio.</li><li><strong>Add Route 53:</strong> to mask the S3 URL and add a layer of security.</li><li><strong>Twitter Feed:</strong> add a section showing recent tweets by you.</li></ul><blockquote><em>If you found this article helpful, it would mean a lot if you gave it some applause 👏 and shared to help others find it!</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8b7c0079457" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Design: Messaging Service]]></title>
            <link>https://medium.com/@shuklabarkha17/system-design-messaging-service-ed1483020a40?source=rss-7362c2950b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed1483020a40</guid>
            <category><![CDATA[messagingservice]]></category>
            <category><![CDATA[system-design-interview]]></category>
            <dc:creator><![CDATA[Barkha Shukla]]></dc:creator>
            <pubDate>Sat, 25 Apr 2020 21:34:34 GMT</pubDate>
            <atom:updated>2020-04-28T20:08:36.758Z</atom:updated>
            <content:encoded><![CDATA[<p>Once upon a time, I had to prep for an interview that involved system design. I came across this video on youtube by Tushar Roy that talked about this particular architecture.</p><p>Me not being a video tutorial person decided to summarize my notes and share it with ya’ll! Let’s cut the blabber and dive into it….</p><p><strong>Features:</strong><br>1. Available on mobile devices. (Assumption: no group chat, just 1:1)<br>2. Able to send images.<br>3. Indications if the user is online, and if the message is sent or read.</p><p><strong>Examples:</strong><br>1. Whatsapp: It provides data encryption and keeps the data only until it reaches the receiver.<br>2. FB Messenger: Does not provide encryption and persists the data forever, unless deleted. (This is what we are aiming for in our design approach!)</p><p><strong>What protocol to use? </strong>HTTP might not prove to be the option here since it only supports unidirectional data flow. Our application requires two-way communication between user A and user B, what can facilitate this? <em>WebSockets.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cs2Hoz_HTOk8yydxEGiWnQ.png" /></figure><p>WebSocket maintains sticky sessions, implying that it uses the same node for a particular user.</p><p><strong>Note:</strong><em> Why are we storing the information in-memory?<br></em>You can avail super fast read/ write operations. And don’t worry about the size of this table, one would not need more than 10 hosts to store the data of 1 billion users!</p><p><em>What is a Heartbeat?<br>While the session is active, the heartbeat gets constantly updated by the node, giving us the most recent timestamp — indicating “User is Online”.<br></em>If User A is inactive, N2 will stop Heartbeating, using this last timestamp we get the <em>“Last seen” </em>feature.</p><p>If N2 dies/ fails due to say a power cut (mice ate the wire!), the user will initiate a new connection with another node (maybe N1)</p><p><strong>Now, who is User A sending all this to? we need User B to receive the message!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D6gqIm51NyJIjfeaTe7aLQ.png" /></figure><p>In case the user is not online, the message will persist in DB and mark it as an unread message. When the receiving user comes online, the message is transmitted and Cache is updated.</p><p><strong>Let’s look at the Database!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_nkko637nnK-6gRfQjXV-A.png" /></figure><blockquote>If you found this article helpful, it would mean a lot if you gave it some applause 👏 and shared to help others find it!<br>Again, thanks to Tushar Roy!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed1483020a40" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[System Design Part 1 [Interview Prep]]]></title>
            <link>https://medium.com/@shuklabarkha17/system-design-part-1-interview-prep-73591dd638a?source=rss-7362c2950b76------2</link>
            <guid isPermaLink="false">https://medium.com/p/73591dd638a</guid>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[scaling]]></category>
            <category><![CDATA[cache]]></category>
            <dc:creator><![CDATA[Barkha Shukla]]></dc:creator>
            <pubDate>Thu, 23 Apr 2020 19:48:55 GMT</pubDate>
            <atom:updated>2020-04-24T19:07:39.783Z</atom:updated>
            <content:encoded><![CDATA[<h3>System Design Concepts</h3><ol><li><strong>Vertical and Horizontal Scaling: </strong><br><em>a.</em> <em>Vertical Scaling:</em> Bulking up resources like RAM, Hard drive, etc on an existing node/ machine/ host. <br><em>b.</em> <em>Horizontal Scaling: Add more nodes/ hosts (preferred: scales very well and is cost-efficient).</em></li><li><strong>Caching: </strong>Refers to rapid access to frequently used data.<br>A cache may or may not be shared between hosts. Cache shared by all hosts in the system can be called Global cache.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*xl_oaetcHPjtBsAORKVP_Q.png" /><figcaption>Note: Cache data cannot be the ultimate source of truth.</figcaption></figure><p><strong>3. CAP Theorem:<br></strong><em>a. Consistency: </em>Ensures that every request(read) gets the most recent data(write)— no stale data.<em><br>b. Availability: </em>Ensures that you will definitely get a response (maybe stale)<em><br>c. Partition Tolerance: </em>You can drop network packets (no you should not! therefore, this cannot be compromised at all)<strong><br></strong><em>Note: </em>You can only achieve 2 of the 3 since Partition Tolerance cannot be compromised on, you make a choice between Availability and Consistency depending on the system’s requirement.</p><p><strong>4. ACID v/s BASE:<br></strong><em>a. ACID: stands for, Atomicity, Consistency, Isolation, Durability — properties looked for in a Relational Database.<br>b. BASE: </em>stands for, Basically Available Soft-state Eventual Consistency,<br> indicates that the system guarantees availability.</p><p><strong>5. Strong v/s Eventual Consistency:<br></strong><em>a.</em> Strong Consistency: Read will definitely see the most recent write. (Relational DB)<em><br>b. </em>Eventual Consistency: Read will see some write, not all at once, but eventually, it can get all of the data. Why? Provides Higher availability for non-critical applications. (NoSQL DB)</p><p><strong>6. Relational DB v/s NoSQL DB: <br></strong><em>a. Relational DB:</em> represented in the form of tables and abides by the ACID properties. Examples: MySQL, MS SQL Server, IBM DB2, MariaDB.<br><em>b. NoSQL DB:can be represented in key-value pairs, Wide-column DB, Document-based DB or graph-based.<br>Examples: Firebase, MongoDB, Cassandra.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fKALXPE9cP7Synid95N3Dw.png" /></figure><p><strong>7. Optimistic v/s Pessimistic Locking: </strong>Refers to DB transactions.<br><em>a. Optimistic locking:</em> No locks are acquired, before committing the transaction check if the data has changed since.<br><em>b. Pessimistic locking:</em> Locks acquired before committing<strong>.</strong></p><p><strong>8. Data Partitioning v/s Sharding: </strong>A partition is a division of a logical database or its constituent elements into distinct independent parts. Database partitioning is normally done for manageability, performance, or availability reasons, as for load balancing.</p><p><em>a. Partitioning: </em>is more a generic term for dividing data across tables or databases.<br><em>b. Sharding: </em>is one specific type of partitioning (specifically horizontal partitioning). Horizontal partitioning splits one or more tables by row, usually within a single instance of a schema and a database server.</p><p>There is also Vertical Partitioning (VP) whereby you split a table into smaller distinct parts.</p><p><strong>9. Load Balancer: </strong>Operates on level 4 or level 7 of the OSI Model.<br>Load balancing is the process of distributing network traffic across multiple servers. This ensures no single server bears too much demand. By spreading the work evenly, load balancing improves application responsiveness. It also increases the availability of applications and websites for users.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/0*jJoG7OnaU9OUHO14" /></figure><p><strong>10. HTTP v/s HTTP/2 v/s WebSockets:<br></strong><em>a. HTTP: </em>Hypertext Transfer Protocol (<strong>HTTP</strong>) is an application-layer protocol for transmitting hypermedia documents, such as HTML. It was designed for communication between web browsers and web servers.<br>Unidirectional request-response between client and server.<br><em>b. HTTP/2: It </em>will make our applications faster, simpler, and more robust — a rare combination — by allowing us to undo many of the HTTP/1.1 workarounds previously done within our applications and address these concerns within the transport layer itself. Allows multiple requests over 1 connection.<br><em>c. WebSockets:</em> There is a persistent connection between the client and the server and both parties can start sending data at any time.<br>It allows bidirectional communication<strong>.</strong></p><p><strong>11. DNS Lookup: </strong>The basic idea of DNS is that humans can’t easily remember long strings of digits like machines can, but can much more easily remember words. So, when you type in a domain name like medium.com <em>the request is forwarded to a DNS server (whether locally or at an ISP), which returns the corresponding IP address. The two types of DNS lookups are forward DNS lookups and reverse DNS lookups.</em></p><blockquote>If you found this article helpful, it would mean a lot if you gave it some applause👏 and shared to help others find it! And feel free to leave a comment below. Thanks to Tushar Roy for amazing videos on system design architectures!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73591dd638a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>