<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged network</title>
<link>https://coderlegion.com/tag/network</link>
<description>Powered by Question2Answer</description>
<item>
<title>From Big Data to the Cloud, Part 1 — Why One Machine Is Never Enough</title>
<link>https://coderlegion.com/32321/from-big-data-to-the-cloud-part-1-why-one-machine-is-never-enough</link>
<description>&lt;p&gt;&lt;em&gt;A calm, sequential guide for anyone entering the field. The article is divided into smaller chapters to make it easier to understand.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This series grows out of the Cloud Computing labs I teach to fourth-year Computer Science students at the University of Hilla. The labs move quickly, because a lab has ninety minutes. The articles can afford to slow down. Here we take the same path the labs take, but we stop at every step and ask the question a careful student always asks: why this, and not something simpler?&lt;/p&gt;
&lt;p&gt;The path itself is short to state. Data has grown past the point where one machine can store it, process it, or analyse it efficiently. The answer is not a bigger machine but many ordinary machines working together. And the framework that manages those machines is Apache Hadoop. Each of those three sentences hides a chain of reasoning, and the purpose of this part is to lay that chain out link by link — so that by the end, the cluster does not look like a fashionable choice but like the answer the problem forces on us.&lt;/p&gt;
&lt;p&gt;The destination of this series is the cloud. But we will not begin there, because a definition of the cloud means little until you have felt the problem it was built to solve. So the series takes the long road on purpose: first the problem (this part), then the cluster that answered it and the burden that answer carried (Part 2), and only then the cloud — defined in Part 3, and explored service by service in the parts after it.&lt;/p&gt;
&lt;p&gt;We will not touch a configuration file in this part. What we build here is the problem — precisely enough that when Part 2 opens Hadoop up and looks at HDFS, MapReduce, and YARN from the inside, each component reads as the answer to a question we have already asked.&lt;br&gt;
&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=14814678934531802993&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;chapter-1-where-all-this-data-comes-from&quot;&gt;Chapter 1: Where All This Data Comes From&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Every Action Leaves a Record&lt;/strong&gt;&lt;br&gt;
Before we define anything, it is worth noticing how ordinary the sources of big data are. Every click, every purchase, every email, every chat message, and every social post creates data. None of these events is large on its own.&lt;/p&gt;
&lt;p&gt;But the sources do not stop at people typing. Sensors and IoT devices report what they measure. Banks record every transaction. Hospitals keep patient records. Streaming services log what their users watch. Each of these produces records continuously, whether or not anything interesting is happening.&lt;/p&gt;
&lt;p&gt;The individual record is small. What makes the situation new is the multiplication: small records, produced by enormous numbers of people and devices, without end. Data now reaches billions of records, and petabytes every day. The important words there are every day. The data does not arrive once. It keeps arriving.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=17695865734488853359&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;chapter-2-what-big-data-actually-means&quot;&gt;Chapter 2: What Big Data Actually Means&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;A Definition About Tools, Not Size&lt;/strong&gt;&lt;br&gt;
The most useful definition of big data is not a number. It is this: big data is datasets so large and complex that traditional tools — spreadsheets, a single database server — cannot store, process, or analyse them efficiently.&lt;/p&gt;
&lt;p&gt;It is worth being exact about why the definition is phrased this way. Students often ask how large data must be before it “counts” as big. The definition answers by pointing at the tools rather than at a size: data becomes big at the moment the ordinary tool stops coping with it. Notice also that it names three separate jobs — store, process, analyse — and a tool can fail at any one of them.&lt;/p&gt;
&lt;p&gt;The Goal Is Insight, Not Storage&lt;br&gt;
A second point is easy to miss: the goal is not only storing data. The goal is extracting insights from it — turning a mountain of records into a decision someone can act on.&lt;/p&gt;
&lt;p&gt;The classic example is an online store. It already keeps every purchase as a matter of bookkeeping. The value appears only when it analyses customer habits: what people buy, when, and together with what. With that analysis, the store can make targeted offers and discounts, which increases revenue. The data was there all along; what matters is the ability to read it. Hold onto this, because a system that can store huge data but cannot analyze it has solved only half the problem.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Three Shapes of Data&lt;/strong&gt;&lt;br&gt;
Data does not only come in different sizes. It comes in different shapes, and the shape decides which tools can handle it.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Structured data is the familiar case: every row has the same columns. A student table with a name, a department, and an age is structured.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Semi-structured data carries its own labels — tags in XML and HTML, keys in JSON — but does not promise that every record has the same fields. The keys tell you what each value means, yet there is no rigid schema forcing every record into one shape.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Unstructured data has no predefined format at all. An email body, a social post, an image, a video: the meaning is in there, but no column tells you where.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=15960471738695527241&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;And here is the uncomfortable fact: most of today’s data is unstructured, and that is exactly what traditional databases handle worst. They were built around the first row of that table. The world moved to the third.&lt;/p&gt;
&lt;h3 id=&quot;chapter-3-the-five-v-s&quot;&gt;Chapter 3: The Five V’s&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=10713862101712732463&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A Vocabulary for “Why It Is Hard”&lt;/strong&gt;&lt;br&gt;
“Too large and too complex” is a good definition, but it is too blunt to design a system against. We need to name the separate ways data can be difficult, because each one places a different demand on the machine that handles it. The standard vocabulary for this is the five V’s.&lt;/p&gt;
&lt;p&gt;One at a Time&lt;br&gt;
01 — Volume: how much. The huge amount of data, from terabytes to petabytes. Volume is the V that breaks storage first.&lt;/p&gt;
&lt;p&gt;02 — Velocity: how fast. How fast data is created and must be processed — think of stock trading or live streams. The second half of that sentence is the important one: these systems need answers quickly, not just storage quickly. Velocity is the V that breaks time.&lt;/p&gt;
&lt;p&gt;03 — Variety: how many shapes. Many types and formats of data — the structured, semi-structured, and unstructured shapes from Chapter 2, often mixed together. Variety is the V that breaks fixed schemas.&lt;/p&gt;
&lt;p&gt;04 — Veracity: how trustworthy. How accurate and trustworthy the data is. Real data is noisy, messy, and has missing values, so cleaning and checking quality stands between you and a conclusion you can defend.&lt;/p&gt;
&lt;p&gt;05 — Value: what we get out of it. The useful insight we finally get out of the data. This is the V that justifies the other four — the point Chapter 2 already made, now given its own name.&lt;/p&gt;
&lt;p&gt;Notice the split: the first three describe the data itself, while the last two describe whether we can trust it and whether it was worth the effort.&lt;/p&gt;
&lt;p&gt; Chapter 4: Why Traditional Systems Fail&lt;br&gt;
What “Traditional” Means Here&lt;br&gt;
By a traditional system we mean one built for structured data on a single powerful machine. All the data lives on that machine; all the work runs on it. This design is good at what it was built for. The point of this chapter is that big data asks it to do something it was never built for — and it breaks in five places.&lt;/p&gt;
&lt;p&gt;The Five Breaking Points&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;It was built for structured data on one machine. Its whole design assumes fixed rows and columns, and one computer doing all the work.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It cannot keep up with the volume and speed of modern data. This is Volume and Velocity together: too many bytes, arriving too fast, for one machine to absorb.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It has difficulty handling unstructured data — images, video, text. This is Variety. And since most of today’s data is unstructured, this is not an edge case; it is most of the data.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scaling up means buying a bigger, very expensive server — and there is always a limit. When one server is not enough, the traditional move is to scale up: replace it with a bigger one. That works for a while, but each step costs more, and eventually there is no bigger machine to buy.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It is slow to extract insights from huge datasets. Put the first four together and the last failure follows on its own. This is the failure that matters most, because it is a failure of Value.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Three Challenges, Stated Plainly&lt;br&gt;
All five breaking points reduce to three questions any big data system must answer.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Storage — where do we keep data that keeps growing?&lt;/li&gt;
&lt;li&gt;Processing — how do we analyse it fast enough to be useful?&lt;/li&gt;
&lt;li&gt;Scalability — how do we grow (or shrink) resources as data changes?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Read the third question twice, because it hides a detail that will matter later in this series. It does not only ask how to grow. It asks how to grow or shrink — how to have exactly as much capacity as the data needs, no more and no less. Keep that small word “shrink” in your pocket; we will come back for it.&lt;/p&gt;
&lt;p&gt;The single powerful machine answers none of them well once the data is big enough. So the question becomes: what architecture answers all three?&lt;/p&gt;
&lt;h3 id=&quot;chapter-5-the-distributed-idea&quot;&gt;Chapter 5: The Distributed Idea&lt;/h3&gt;
&lt;p&gt;Many Ordinary Machines, Working Together&lt;br&gt;
The answer is to stop making one machine bigger. Instead of one big machine (monolithic), we use many ordinary machines working together, called a cluster. Each machine in the cluster is a node. Both the data and the processing are split across the nodes. A cluster can range from a few nodes to thousands — and cheap commodity hardware is enough: normal PCs and servers, not specialised machines.&lt;/p&gt;
&lt;p&gt;This strategy is called scaling out: when you need more capacity, you do not replace the machine — you add more machines.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Price of Distribution&lt;/strong&gt;&lt;br&gt;
Scaling out is not free. The moment we spread data across many machines, we inherit three problems the single machine never had:&lt;/p&gt;
&lt;p&gt;Which data lives on which node? With one machine, a file is simply on its disk. With many, something must remember where every piece went.&lt;br&gt;
How do nodes communicate and coordinate? Many machines working on the same job is only useful if the work is divided and the results are brought back together.&lt;br&gt;
What happens when a machine crashes? On one server, a crash is a rare event. In large clusters, failures are normal.&lt;br&gt;
That last point changes how the whole system must be designed. If failure is the normal state of affairs, the system cannot treat it as an emergency. It must expect machines to fail and keep working anyway, without losing data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Stated as a General Rule&lt;/strong&gt;&lt;br&gt;
Scaling out trades one hard problem — a machine that cannot grow past its limit — for three new ones: tracking where data lives, coordinating the nodes, and surviving failure. The trade is worth it only if software solves those three problems, so that the people using the cluster do not have to. What the field needed was a framework that solves them once, for everyone.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=16529077324794030625&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;chapter-6-enter-hadoop&quot;&gt;Chapter 6: Enter Hadoop&lt;/h3&gt;
&lt;p&gt;What Hadoop Is&lt;br&gt;
Apache Hadoop is an open-source framework for distributed storage and parallel processing of big data. It runs on clusters of commodity hardware — exactly the cluster Chapter 5 described. It was created around 2005, when the volume of web data, from sites like Facebook and YouTube, exploded. It is free to download from Apache, and commercial distributions also exist, such as Cloudera, Hortonworks, and MapR.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Its Core Components, at a Glance&lt;/strong&gt;&lt;br&gt;
The cleanest way to understand Hadoop’s design is to hold it up against the three challenges from Chapter 4. Each core component answers one of them.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=3481848833855820308&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;We deliberately stay at this altitude for now. How HDFS splits and tracks blocks, why MapReduce runs the program where the data already is, and how YARN hands out CPU and memory are the subject of Part 2.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What Hadoop Buys&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Scalable — add more nodes as data grows. (Notice: as data grows. The “shrink” half of the Scalability question is still waiting.)&lt;/li&gt;
&lt;li&gt;Fault tolerant — keeps copies of data on different machines, so a hardware failure does not lose data. This is the answer to “what happens when a machine crashes?”&lt;/li&gt;
&lt;li&gt;Cost-effective — uses cheap commodity machines.&lt;/li&gt;
&lt;li&gt;Flexible — handles structured and unstructured data. This is the answer to Variety.&lt;/li&gt;
&lt;li&gt;Parallel — many nodes work at the same time.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;What Hadoop Costs&lt;/strong&gt;&lt;br&gt;
An honest account includes the other column.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It is designed for batch processing, not real time. For real-time work, Apache Spark is better.&lt;/li&gt;
&lt;li&gt;It is complex to configure and maintain — which is exactly what the labs practise.&lt;/li&gt;
&lt;li&gt;Replication uses extra storage space. Keeping copies on different machines is what makes Hadoop fault tolerant, but every copy takes up disk.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Where It Is Used&lt;/strong&gt;&lt;br&gt;
Healthcare: patient records, medical images, early disease prediction.&lt;br&gt;
Banking: fraud detection, transaction analysis.&lt;br&gt;
Social media: sentiment analysis of posts.&lt;br&gt;
E-commerce: recommendations, customer behaviour, inventory management — the online store from Chapter 2, now at full scale.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-comes-in-part-2&quot;&gt;What Comes in Part 2&lt;/h3&gt;
&lt;p&gt;We now have the problem in full, and the shape of the answer. We know why one machine is never enough, why a cluster is the way out, and which new problems the cluster creates. We have met Hadoop’s components by name. What we do not yet have is the inside view.&lt;/p&gt;
&lt;p&gt;Part 2 opens the components one at a time. We follow a 400 MB file as HDFS splits it into 128 MB blocks, and see why, with three copies of each block, that file ends up stored as twelve blocks across the cluster. We meet the NameNode that keeps track of which block is on which machine, and the DataNodes that send it a heartbeat to say “I’m alive” — and we ask what happens when one of them stops. We walk through MapReduce by hand, on a word count and on an average-age example, from Map through Shuffle &amp;amp; Sort to Reduce. And we watch YARN take a submitted job, start an ApplicationMaster for it, and request containers on the nodes that hold the data.&lt;/p&gt;
&lt;p&gt;The single principle running through all of it: Hadoop moves the work to the data, not the data to the work.&lt;/p&gt;
&lt;p&gt;And Part 2 will end where the rest of this series begins. Hadoop solves storage, processing, and growth — but it leaves us holding a cluster: machines to buy, a framework that is complex to configure and maintain, and capacity that can grow but not easily shrink. That remaining burden is exactly what the cloud takes off our hands, and it is where Part 3 picks up the story.&lt;/p&gt;
&lt;h3 id=&quot;references&quot;&gt;References&lt;/h3&gt;
&lt;p&gt;Deshpande, T., Karanth, S., &amp;amp; Turkington, G. Hadoop: Data Processing and Modelling (Learning Path). Packt Publishing.&lt;br&gt;
Oracle. What Is Big Data? &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.oracle.com/big-data/what-is-big-data/&quot;&gt;https://www.oracle.com/big-data/what-is-big-data/&lt;/a&gt;&lt;br&gt;
Big Data — Understanding Hadoop: Architecture, Features, Challenges &amp;amp; Applications. Medium. &lt;a rel=&quot;nofollow&quot; href=&quot;https://medium.com/@rp99452/big-data-understanding-hadoop-architecturefeatures-challenges-applications-c7ab7011e375&quot;&gt;https://medium.com/@rp99452/big-data-understanding-hadoop-architecturefeatures-challenges-applications-c7ab7011e375&lt;/a&gt;&lt;br&gt;
Mehta, C. B. (2022). A Comprehensive Review of Hadoop Ecosystem for Big Data Processing and Analytics. IJNRD, 7(10).&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/32321/from-big-data-to-the-cloud-part-1-why-one-machine-is-never-enough</guid>
<pubDate>Sun, 25 Oct 2026 05:46:00 +0000</pubDate>
</item>
<item>
<title>Can You Belong to a Community Without Finding Your Audience?</title>
<link>https://coderlegion.com/32113/can-you-belong-to-a-community-without-finding-your-audience</link>
<description>&lt;p&gt;Lately, I have been questioning whether CoderLegion is the right platform for the content I create.&lt;/p&gt;
&lt;p&gt;As a game developer sharing the progress of Life of Alex, I write about building mechanics, designing environments, solving problems, and learning through development. These are subjects I care about, and documenting them is part of how I contribute to the community.&lt;/p&gt;
&lt;p&gt;However, the traffic reaching that work has been limited. That has made me consider a question that might be familiar to other creators: how do you recognize when a platform is valuable to you, but might not be the best fit for your content?&lt;/p&gt;
&lt;p&gt;My experience with CoderLegion makes that question particularly interesting. I am a leader here, I have become a recognized voice, and have had the opportunity to share my career journey through an interview. Those things matter to me. They are meaningful reasons to remain involved.&lt;/p&gt;
&lt;p&gt;At the same time, recognition within a community and readership of your work are different things. You can feel welcomed and appreciated while still wondering whether what you publish is reaching people interested in the subject.&lt;/p&gt;
&lt;p&gt;I do not expect a role or a badge to guarantee an audience. Readers choose where to spend their time, and contributors have to earn that attention. But when you regularly share work and see limited traffic, it is reasonable to assess whether the subject, format, and audience are connecting.&lt;/p&gt;
&lt;p&gt;Game development can sit in an unusual position within broader technical communities. A development update might involve visual design, player experience, animation, or the gradual construction of an environment. Its value may be harder to communicate through a headline than a tutorial that answers a specific technical question.&lt;/p&gt;
&lt;p&gt;That is one possible explanation, rather than a conclusion about CoderLegion’s audience. Presentation, discoverability, and my own approach could also play a part. Low traffic tells me that something is not connecting; it does not tell me exactly why.&lt;/p&gt;
&lt;p&gt;There is also a practical limit to how far I want to adapt. I am happy to improve how I explain my work, provide more context, and make an article more useful to readers. However, I still want the subject to reflect the game I am actually building. If every post becomes a search for a more popular topic, the development journal gradually loses its purpose.&lt;/p&gt;
&lt;p&gt;For now, I want to remain part of CoderLegion while being realistic about what publishing here brings. A platform can have value through its relationships, conversations, and opportunities, even when it contributes little traffic. The question is how much time to invest in each of those benefits, particularly when that time also comes out of development.&lt;/p&gt;
&lt;p&gt;I would be interested to hear how other contributors approach this. Have you found an audience by changing how you present your work, or discovered that a community you enjoy simply has limited interest in your particular subject?&lt;/p&gt;
&lt;p&gt;I have tried everything under the sun: taking interest and contributing to other people's passions or careers, I created discussions over different topics, i posted more often and more rare, tried changing tags... I am at a loss...&lt;/p&gt;
&lt;p&gt;What helps you decide whether to keep adapting, publish less frequently, or put more effort into another platform?&lt;/p&gt;
</description>
<category>Discussions</category>
<guid isPermaLink="true">https://coderlegion.com/32113/can-you-belong-to-a-community-without-finding-your-audience</guid>
<pubDate>Thu, 22 Oct 2026 19:18:09 +0000</pubDate>
</item>
<item>
<title>My Network Engineering Home Lab setup</title>
<link>https://coderlegion.com/31586/my-network-engineering-home-lab-setup</link>
<description>&lt;h3 id=&quot;introduction&quot;&gt;Introduction&lt;/h3&gt;
&lt;p&gt;A while ago, I built a home lab to gain hands-on experience with Linux server administration and network engineering. Using some old hardware, a ThinkCentre M81 desktop and a Tenda router, I set up a private LAN, configured a static IP and DHCP reservations, and deployed an SSH-accessible Linux server running an Nginx web server.&lt;/p&gt;
&lt;p&gt;This project allowed me to apply concepts I had learned in college in a real-world scenario, practice network setup and IP management, and explore server configuration beyond the classroom. It’s also an example of repurposing older hardware to create a functional learning environment.&lt;/p&gt;
&lt;p&gt;Below, I’ve documented the full technical process, step by step, so you can see exactly how I built this setup and replicate it if you want to create your own home lab.&lt;/p&gt;
&lt;h3 id=&quot;tenda-router-setup&quot;&gt;Tenda Router Setup&lt;/h3&gt;
&lt;p&gt;The router I used is the Tenda AC1200 router: &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.tendacn.com/product/ac6.html&quot;&gt;https://www.tendacn.com/product/ac6.html&lt;/a&gt;.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Turn on the router.&lt;/li&gt;
&lt;li&gt;Connect to the router’s LAN port (1 or 2) via ethernet from a PC you are able to use.&lt;/li&gt;
&lt;li&gt;Visit &lt;code&gt;192.168.0.1&lt;/code&gt;, the default router IP (written in the back of your router) from a web browser.&lt;/li&gt;
&lt;li&gt;Enter the default login password (written in the back of your router).&lt;/li&gt;
&lt;li&gt;Go to system settings and change the login password&lt;/li&gt;
&lt;li&gt;Go to Wi-Fi settings and change the Wi-Fi name and password.&lt;/li&gt;
&lt;li&gt;Go to system settings and upgrade the firmware if needed.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The router is ready for connection. Disconnect the ethernet from the router, you can now access it via Wi-Fi.&lt;/p&gt;
&lt;h3 id=&quot;thinkcentre-m81-server-setup&quot;&gt;ThinkCentre M81 Server setup&lt;/h3&gt;
&lt;h4 id=&quot;installing-linux-mint&quot;&gt;Installing Linux Mint&lt;/h4&gt;
&lt;p&gt;Connect the ethernet port of the CPU to any the Tenda router’s LAN ports, and install linuxmint normally: &lt;a rel=&quot;nofollow&quot; href=&quot;https://linuxmint-installation-guide.readthedocs.io/en/latest/&quot;&gt;https://linuxmint-installation-guide.readthedocs.io/en/latest/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But during the installation process, choose to erase the whole disk and install linux mint while asked about partitions.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ls7krmvl10pl4igkljyt.png&quot; alt=&quot;mint-install-type&quot;&gt;&lt;/p&gt;
&lt;p&gt;Do not select to set up an encrypted LVM (full disk encryption) in the Advanced features. Using an LVM is okay but encrypted LVM for full disk encryption requires someone to type the password in the keyboard connected to the server every time it boots, and we want it to automatically boot and be ready for ssh login so it is not recommended.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tyxvjkc915vh5f6f0wyl.png&quot; alt=&quot;username-password-screen&quot;&gt;&lt;/p&gt;
&lt;p&gt;And the authorized ssh keys stay in the home folder of the user, so if you encrypt it, logging in to the user account will be required for key based ssh to work. Logging in remotely strictly using ssh keys will not work then. So do not encrypt the home folder.&lt;/p&gt;
&lt;p&gt;After the installation is complete, login and set the root password.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sudo passwd
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;turning-the-desktop-into-a-server&quot;&gt;Turning the desktop into a server&lt;/h4&gt;
&lt;p&gt;After that, we need to turn this into a server from a desktop.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install &lt;code&gt;openssh-server&lt;/code&gt; and configure it: &lt;a rel=&quot;nofollow&quot; href=&quot;https://wiki.debian.org/SSH#Installation_of_the_server&quot;&gt;https://wiki.debian.org/SSH#Installation_of_the_server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;[Not required but highly recommended] Make the ssh server run on a port different from 22, for security (to prevent automated brute force scripts).&lt;/li&gt;
&lt;li&gt;[Not required but highly recommended] Turn on firewall and allow the ssh. When the firewall is turned off, every port open on the system is open to the network. So turn it on to make sure only the ports you allow are accessible from the outside.&lt;pre&gt;&lt;code&gt;sudo ufw allow &amp;lt;ssh_port_number&amp;gt;
sudo ufw enable
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Now we need static IP for the server instead of DHCP from the router. We will be using systemd-networkd for this.&lt;pre&gt;&lt;code&gt;sudo ifconfig
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And remember the name of the ethernet port connecting to the router (usually eno1)&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;Now stop and disable NetworkManager, it is bound to the display manager so if we use primarily Network Manager, the server will not have networking when started headless.&lt;pre&gt;&lt;code&gt;sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Now enable systemd-networkd on boot&lt;pre&gt;&lt;code&gt;sudo systemctl enable systemd-networkd
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Create a file &lt;code&gt;/etc/systemd/network/10-eno1.network&lt;/code&gt; and put in the contents&lt;pre&gt;&lt;code&gt;[Match]
Name=eno1
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;[Network]&lt;br&gt;
Address=192.168.0.2/24&lt;br&gt;
Gateway=192.168.0.1&lt;br&gt;
DNS=192.168.0.1&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
Where `192.168.0.1` is the IP address of your router and `192.168.0.2` is the IP address of the server, and `eno1` is the name of the network interface of the ethernet port.
8. Reload systemd-networkd for the changes to take effect
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;sudo systemctl restart systemd-networkd&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;9. Now run `sudo ifconfig` again and the ip address should have changed on the ethernet port.
10. Now that we have static IP, go to router login page -&amp;gt; System Settings -&amp;gt; DHCP Reservation
![tenda-dhcp-reserv](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c4stq9hz8n3tpht6i728.png)
And manually bind the static IP to the MAC address of the server.

We have turned the desktop into a server. Now ssh into it from your PC to test if it works.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;ssh -p  username@192.168.0.2&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
## Making server headless

Once you have logged in to the server via ssh, you can easily turn it headless. You simply have to stop the display manager and disable it on boot so it always runs headless.

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(after ssh into server)&lt;br&gt;
sudo systemctl stop lightdm&lt;br&gt;
sudo systemctl disable lightdm&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
After this, the monitor screen connected to the desktop goes blank. This is expected. If you are not sure if the system hanged or if the graphical manager has stopped, press Ctrl+Alt+F1 to enter virtual terminal 1. If you see the virtual terminal, it is working properly. Now you can safely remove the monitor and keyboard and mouse from the server’s CPU as you won’t need it anymore and will always access it by ssh.

## Configuring Web Server
While you are still ssh-ed into the server, run
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;sudo apt install nginx&lt;br&gt;
sudo systemctl start nginx&lt;br&gt;
sudo systemctl enable nginx&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;To install, start and enable the web server on boot. It runs on port 80, the default port for HTTP. So allow it on the firewall for the website to be accessed from the LAN.

&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;sudo ufw allow 80&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;You can leave it as it is to get the default nginx server page or create a file `/var/www/html/index.html` with your own website on the `index.html` file, or even host a react app by copying the build files into the `/var/www/html` folder.


## Accessing the website

Connect to the Wi-Fi network of the Tenda router from any device that has Wi-Fi.
![wifi-con](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o16p8noin4w1xe8417wt.png)

And then open the IP address of the server in a web browser. You will get a no HTTPS warning but you can ignore it and continue since we are in a controlled environment.

![website](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/438xncg43o7z8v4zo6ff.png)


## SUCCESS
That’s it. The home LAB has been set up successfully. You have a LAN on Wi-Fi and a server that you can ssh into and use as backup storage, and a web server you can host websites on your LAN.


&lt;/code&gt;&lt;/pre&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/31586/my-network-engineering-home-lab-setup</guid>
<pubDate>Sun, 18 Oct 2026 07:57:18 +0000</pubDate>
</item>
<item>
<title>MyZubster: Building a Provenance Network for Knowledge, Skills, and Real-World Exchange</title>
<link>https://coderlegion.com/27460/myzubster-building-a-provenance-network-for-knowledge-skills-and-real-world-exchange</link>
<description>&lt;p&gt;MyZubster: Building a Provenance Network for Knowledge, Skills, and Real-World Exchange&lt;/p&gt;
&lt;p&gt;We started MyZubster with a simple real-world question:&lt;/p&gt;
&lt;p&gt;What happens if I give someone my kefir culture, they reproduce it at home, document what they learn, and eventually pass both the culture and the knowledge to someone else?&lt;/p&gt;
&lt;p&gt;That small experiment is evolving into something much larger.&lt;/p&gt;
&lt;p&gt;We're building MyZubster as an open-source system for representing how resources, knowledge, and skills move between people while preserving provenance and uncertainty.&lt;/p&gt;
&lt;p&gt;The core loop is simple:&lt;/p&gt;
&lt;p&gt;Share → Try → Observe → Improve → Share again&lt;br&gt;
From a kefir culture to a provenance graph&lt;/p&gt;
&lt;p&gt;Milk kefir is our first real-world prototype.&lt;/p&gt;
&lt;p&gt;Instead of storing only:&lt;/p&gt;
&lt;p&gt;Daniel gave kefir to Nicola&lt;/p&gt;
&lt;p&gt;we want the system to represent the actual lifecycle:&lt;/p&gt;
&lt;p&gt;Daniel's culture → Marketplace listing → Nicola accepts → Hand exchange → Nicola confirms receipt → Nicola maintains his culture → Observations → Future donation&lt;/p&gt;
&lt;p&gt;Every transition is a separate event.&lt;/p&gt;
&lt;p&gt;If something hasn't happened yet, the system shouldn't pretend it has.&lt;/p&gt;
&lt;p&gt;If a quantity, temperature, timestamp, outcome, or condition wasn't recorded, it stays:&lt;/p&gt;
&lt;p&gt;UNKNOWN&lt;/p&gt;
&lt;p&gt;This principle has become one of the foundations of the MyZubster Knowledge Protocol.&lt;br&gt;
Knowledge is another transferable resource&lt;/p&gt;
&lt;p&gt;Then we realized the same model can describe learning.&lt;/p&gt;
&lt;p&gt;Daniel has been helping Nicola work with GitHub, Docker, and the MyZubster ecosystem.&lt;/p&gt;
&lt;p&gt;That creates another graph:&lt;/p&gt;
&lt;p&gt;Daniel → Nicola learns → Nicola attempts → Observable artifact → Nicola can teach another person&lt;/p&gt;
&lt;p&gt;But there is an important rule:&lt;/p&gt;
&lt;p&gt;Evidence is not inherited.&lt;/p&gt;
&lt;p&gt;If Nicola teaches another participant, that participant must create their own evidence.&lt;/p&gt;
&lt;p&gt;So the graph becomes:&lt;/p&gt;
&lt;p&gt;Daniel → Nicola → Person B → Person C&lt;/p&gt;
&lt;p&gt;while every edge has independent provenance.&lt;br&gt;
From fermentation to a general knowledge network&lt;/p&gt;
&lt;p&gt;The repository has now expanded beyond fermentation.&lt;/p&gt;
&lt;p&gt;Current and newly introduced domains include:&lt;/p&gt;
&lt;p&gt;KF-&lt;em&gt; — Fermentation&lt;br&gt;
SND-&lt;/em&gt; — Sound systems&lt;br&gt;
DEV-&lt;em&gt; — Programming&lt;br&gt;
UNI-&lt;/em&gt; — University/research&lt;br&gt;
PET-&lt;em&gt; — Animals&lt;br&gt;
PERM-&lt;/em&gt; — Permaculture&lt;br&gt;
MUS-&lt;em&gt; — Music&lt;br&gt;
ART-&lt;/em&gt; — Art&lt;br&gt;
SPT-&lt;em&gt; — Sport&lt;br&gt;
MA-&lt;/em&gt; — Martial arts&lt;/p&gt;
&lt;p&gt;This allows very different communities to use the same underlying protocol.&lt;/p&gt;
&lt;p&gt;A tekno musician could teach someone how to operate or assemble part of a sound system.&lt;/p&gt;
&lt;p&gt;A musician could teach another person DJing, production, rhythm, or an instrument.&lt;/p&gt;
&lt;p&gt;An artist could teach drawing or comics.&lt;/p&gt;
&lt;p&gt;A calisthenics practitioner could document teaching a particular progression.&lt;/p&gt;
&lt;p&gt;A Thai-boxing practitioner or coach could document a bounded training session.&lt;/p&gt;
&lt;p&gt;The domain changes.&lt;/p&gt;
&lt;p&gt;The provenance model doesn't.&lt;br&gt;
Turning skills into marketplace objects&lt;/p&gt;
&lt;p&gt;We're now extending the MyZubster marketplace concept so that an offer doesn't necessarily represent a physical object.&lt;/p&gt;
&lt;p&gt;It could represent:&lt;/p&gt;
&lt;p&gt;a resource, a lesson, mentoring, a workshop, a demonstration, or a collaboration request.&lt;/p&gt;
&lt;p&gt;A skill exchange can therefore follow:&lt;/p&gt;
&lt;p&gt;Teacher → Skill Listing → Learner Accepts → Session → Participation Confirmation → Attempt → Evidence → MyZubster Record&lt;/p&gt;
&lt;p&gt;And eventually:&lt;/p&gt;
&lt;p&gt;A teaches B → B reproduces → B teaches C → C reproduces&lt;/p&gt;
&lt;p&gt;This creates a distributed graph of practical knowledge.&lt;br&gt;
Physical and knowledge graphs can intersect&lt;/p&gt;
&lt;p&gt;The interesting part is that MyZubster can maintain two separate graphs.&lt;/p&gt;
&lt;p&gt;A physical-resource graph:&lt;/p&gt;
&lt;p&gt;Daniel → Kefir → Nicola → New culture → Future recipient&lt;/p&gt;
&lt;p&gt;And a knowledge graph:&lt;/p&gt;
&lt;p&gt;Daniel → Nicola → Reproduced skill → New learner&lt;/p&gt;
&lt;p&gt;They can reference each other without becoming the same thing.&lt;/p&gt;
&lt;p&gt;Receiving kefir doesn't prove that someone knows how to maintain it.&lt;/p&gt;
&lt;p&gt;Reading a Knowledge Card doesn't prove that someone performed the procedure.&lt;/p&gt;
&lt;p&gt;Teaching a skill doesn't prove that the learner mastered it.&lt;/p&gt;
&lt;p&gt;Each statement needs its own evidence.&lt;br&gt;
Where blockchain fits&lt;/p&gt;
&lt;p&gt;Blockchain is intended as an optional provenance layer.&lt;/p&gt;
&lt;p&gt;We're deliberately avoiding the shortcut:&lt;/p&gt;
&lt;p&gt;blockchain = truth&lt;/p&gt;
&lt;p&gt;It doesn't.&lt;/p&gt;
&lt;p&gt;An on-chain record can establish that a particular commitment or declaration was recorded.&lt;/p&gt;
&lt;p&gt;For MyZubster, we therefore distinguish states such as:&lt;/p&gt;
&lt;p&gt;RECORDED&lt;/p&gt;
&lt;p&gt;from:&lt;/p&gt;
&lt;p&gt;ONCHAIN_RECORDED&lt;/p&gt;
&lt;p&gt;The latter should only exist when we have an actual network and verifiable transaction/record identifier.&lt;/p&gt;
&lt;p&gt;A transaction hash doesn't automatically prove competence, lesson quality, physical delivery, professional qualifications, or the truth of every statement committed to it.&lt;/p&gt;
&lt;p&gt;Those remain evidence problems.&lt;br&gt;
Evidence states&lt;/p&gt;
&lt;p&gt;MyZubster currently works with a deliberately small evidence vocabulary:&lt;/p&gt;
&lt;p&gt;PERSONAL_PRACTICE&lt;br&gt;
TRADITIONAL_PRACTICE&lt;br&gt;
OBSERVATION&lt;br&gt;
EXTERNAL_SOURCE&lt;br&gt;
VERIFIED_GUIDANCE&lt;/p&gt;
&lt;p&gt;And there is another important constraint:&lt;/p&gt;
&lt;p&gt;More observations do not automatically produce VERIFIED_GUIDANCE.&lt;/p&gt;
&lt;p&gt;Verification requires an explicit review step.&lt;/p&gt;
&lt;p&gt;That prevents a community voting mechanism or simple repetition counter from silently transforming popular claims into verified knowledge.&lt;br&gt;
The implementation&lt;/p&gt;
&lt;p&gt;This isn't only a concept document.&lt;/p&gt;
&lt;p&gt;The repository already contains tooling for:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;canonical Knowledge Cards;

domain validation;

evidence records;

claims and sources;

knowledge relations;

reproductions;

knowledge versions;

collaboration requests;

verification reviews;

integrity checking;

graph persistence;

transactional record/graph updates;

recovery logic;

a read-only Knowledge API;

a browser-based Knowledge Explorer.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We've also started creating real cross-domain records.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;p&gt;DEV-001 — Nicola's observable MyZubster/Docker/comics project artifacts&lt;/p&gt;
&lt;p&gt;DEV-002 — Nicola's reported learning/onboarding path&lt;/p&gt;
&lt;p&gt;ART-001 — Daniel's comics practice&lt;/p&gt;
&lt;p&gt;SPT-001 — Daniel's calisthenics practice&lt;/p&gt;
&lt;p&gt;MA-001 — Daniel's Thai-boxing practice&lt;/p&gt;
&lt;p&gt;For claims where supporting evidence hasn't yet been attached, the system explicitly preserves that limitation rather than manufacturing provenance.&lt;br&gt;
Current development status&lt;/p&gt;
&lt;p&gt;Our last confirmed complete local run was:&lt;/p&gt;
&lt;p&gt;110 tests / 110 passing&lt;/p&gt;
&lt;p&gt;That result predates the newest domain and Knowledge Card additions, so we're not claiming those latest changes as tested until the next complete run.&lt;/p&gt;
&lt;p&gt;That's another principle we're trying to follow throughout the project:&lt;/p&gt;
&lt;p&gt;don't convert an expected result into an observed result.&lt;/p&gt;
&lt;p&gt;The public Knowledge Explorer is available here:&lt;/p&gt;
&lt;p&gt;MyZubster Knowledge Explorer&lt;/p&gt;
&lt;p&gt;The source code and current protocol development are here:&lt;/p&gt;
&lt;p&gt;MyZubster on GitHub&lt;/p&gt;
&lt;p&gt;At the moment, GitHub contains newer work than the production Knowledge Explorer deployment, so the repository is the source of truth for the latest development.&lt;br&gt;
What's next&lt;/p&gt;
&lt;p&gt;The next major step is moving the new Skill Marketplace model from protocol documentation into structured schemas and runtime records.&lt;/p&gt;
&lt;p&gt;The target lifecycle is:&lt;/p&gt;
&lt;p&gt;Listing → Acceptance → Session/Exchange → Evidence → Knowledge Graph → Optional on-chain commitment&lt;/p&gt;
&lt;p&gt;After that, we can start testing the protocol with more real people and very different types of knowledge.&lt;/p&gt;
&lt;p&gt;Kefir is just the first physical experiment.&lt;/p&gt;
&lt;p&gt;The broader question behind MyZubster is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Can we build an open provenance graph showing not just what people say they know, but how knowledge and resources actually move, get reproduced, change, and get passed to the next person?
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That's what we're trying to find out.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/27460/myzubster-building-a-provenance-network-for-knowledge-skills-and-real-world-exchange</guid>
<pubDate>Thu, 17 Sep 2026 04:40:03 +0000</pubDate>
</item>
<item>
<title>Two Racing Lines: Annotations and the DSL in NetFlow 0.7.0</title>
<link>https://coderlegion.com/27052/two-racing-lines-annotations-and-the-dsl-in-netflow-0-7-0</link>
<description>&lt;p&gt;I have been building NetFlow, my Kotlin Multiplatform networking library, since it was an Android-only thing called Communication. I wrote about that migration and why I took it on in &lt;a rel=&quot;nofollow&quot; href=&quot;/posts/netflow-part1&quot;&gt;Why I Took the Leap from Android-Only to Kotlin Multiplatform&lt;/a&gt;, so I will not repeat it here. Version 0.6 I added a &lt;code&gt;transform&lt;/code&gt; parameter. The compiler forces you to provide whenever your DTO and your domain model are different types. Forget it and the build fails. No runtime surprise, no half-mapped object reaching the UI.&lt;/p&gt;
&lt;p&gt;Then I started a new data layer in a side project, opened an empty file, and typed &lt;code&gt;@GET&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Into my own library. Which did not have annotations.&lt;/p&gt;
&lt;p&gt;That is a small, stupid moment, and it told me something I had been avoiding. NetFlow has three stars on GitHub and, as far as I know, no users outside my own projects, so I cannot tell you what evaluators said about it. I can tell you what my own hands did when I was not paying attention.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-reflex&quot;&gt;The reflex&lt;/h3&gt;
&lt;p&gt;Years of Retrofit built a motor pattern into every Android developer I know, including me. You want an endpoint, you write an interface, you put &lt;code&gt;@GET(&quot;users/{id}&quot;)&lt;/code&gt; on a method. It is not a decision. It is closer to reaching for the indicator stalk.&lt;/p&gt;
&lt;p&gt;Here is what fetching a list looked like in NetFlow 0.6:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// commonMain
val todos = client.call {
    path = &quot;todos&quot;
    method = HttpMethod.Get
}.responseListFlow&amp;lt;TodoDto, Todo&amp;gt;(transform = { it.toModel() })
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Read that with fresh eyes. It says exactly what it does, it is one expression, and the mapping is compiler-checked. It is also nothing like what muscle memory reaches for.&lt;/p&gt;
&lt;p&gt;A developer evaluating a networking library gives it about ninety seconds of README. In that window, &quot;does this look like the thing I already know&quot; beats &quot;is this better&quot; almost every time. I don't think that is laziness. Familiarity is a real cost saving when you are picking one of five libraries that all do roughly the same job.&lt;/p&gt;
&lt;p&gt;So the 0.7.0 question was not &quot;annotations or DSL&quot;. It was: can I put a familiar entry on the front without weakening the thing behind it?&lt;/p&gt;
&lt;p&gt;What came out is a ladder with three rungs. The bottom rung is an annotated interface and covers most of what you write in a day. The middle rung annotates the request and hands the response back to you. The top rung is the DSL, unchanged, for the calls that need everything. You climb only as far as the call in front of you requires.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;rung-one-the-return-type-picks-the-strategy&quot;&gt;Rung one: the return type picks the strategy&lt;/h3&gt;
&lt;p&gt;The annotation layer lives in two new modules, &lt;code&gt;netflow-annotations&lt;/code&gt; and &lt;code&gt;netflow-ksp&lt;/code&gt;. You annotate an interface, KSP generates the implementation, and a factory extension hands it to you.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// commonMain
@NetFlowApi
interface TodoApi {

    @GET(&quot;todos&quot;)
    suspend fun getTodos(@Query completed: Boolean?): AsyncState&amp;lt;List&amp;lt;TodoDto&amp;gt;&amp;gt;

    @GET(&quot;todos/{id}&quot;)
    fun observeTodo(@Path id: Int): Flow&amp;lt;ResultState&amp;lt;TodoDto&amp;gt;&amp;gt;

    @Headers(&quot;Accept: application/json&quot;, &quot;X-Client: netflow&quot;)
    @POST(&quot;todos&quot;)
    suspend fun create(@Body request: CreateTodoRequest): AsyncState&amp;lt;TodoDto&amp;gt;

    @DELETE(&quot;todos/{id}&quot;)
    suspend fun delete(@Path id: Int): AsyncState&amp;lt;Unit&amp;gt;

    @GET(&quot;todos&quot;)
    fun pagedTodos(): Flow&amp;lt;PagingData&amp;lt;TodoDto&amp;gt;&amp;gt;
}

val api = client.createTodoApi()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The part I want to point at is that there is no &lt;code&gt;@Strategy&lt;/code&gt; annotation anywhere. The return type does that job.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;AsyncState&amp;lt;T&amp;gt;&lt;/code&gt; on a suspend function means a one-shot call. &lt;code&gt;Flow&amp;lt;ResultState&amp;lt;T&amp;gt;&amp;gt;&lt;/code&gt; on a non-suspend function means an observable call with loading and error states. &lt;code&gt;Flow&amp;lt;PagingData&amp;lt;T&amp;gt;&amp;gt;&lt;/code&gt; means a Paging 3 flow. &lt;code&gt;List&amp;lt;T&amp;gt;&lt;/code&gt; inside any of those routes to the list variants. The processor reads the shape and picks &lt;code&gt;responseAsync&lt;/code&gt;, &lt;code&gt;responseListAsync&lt;/code&gt;, &lt;code&gt;responseFlow&lt;/code&gt;, &lt;code&gt;responseListFlow&lt;/code&gt;, or &lt;code&gt;responsePaginated&lt;/code&gt; accordingly.&lt;/p&gt;
&lt;p&gt;This is not a clever trick, it is consistency. &lt;code&gt;Flow&amp;lt;ResultState&amp;lt;T&amp;gt;&amp;gt;&lt;/code&gt; already self-describes in the hand-written DSL. Making the annotation layer read the same signal means there is one fact to learn instead of two.&lt;/p&gt;
&lt;p&gt;The processor is strict about mismatches, and the errors are compile-time:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Function 'getTodos' returns AsyncState and must be suspend.
Function 'observeTodo' path declares '{id}' but there is no @Path parameter named 'id'.
Function 'create' has more than one @Body; at most one @Body is allowed.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;@Path&lt;/code&gt; and &lt;code&gt;@Query&lt;/code&gt; and &lt;code&gt;@Header&lt;/code&gt; take their wire name from the parameter name unless you override it, a nullable &lt;code&gt;@Query&lt;/code&gt; or &lt;code&gt;@Header&lt;/code&gt; is omitted from the request when it is null, and at most one &lt;code&gt;@Body&lt;/code&gt; is allowed per function.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-the-processor-actually-writes&quot;&gt;What the processor actually writes&lt;/h3&gt;
&lt;p&gt;This matters more than it sounds, so here is the generated file for two of those methods, copied out of &lt;code&gt;build/generated&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// _TodoApiImpl.kt, generated
internal class _TodoApiImpl(
  private val client: NetFlowClient,
) : TodoApi {
  override suspend fun getTodos(completed: Boolean?): AsyncState&amp;lt;List&amp;lt;TodoDto&amp;gt;&amp;gt; = client.call {
    method = HttpMethod.Get
    path = &quot;todos&quot;
    if (completed != null) parameter(&quot;completed&quot; to completed)
  }
  .responseListAsync&amp;lt;TodoDto&amp;gt;()

  override fun observeTodo(id: Int): Flow&amp;lt;ResultState&amp;lt;TodoDto&amp;gt;&amp;gt; = client.call {
    method = HttpMethod.Get
    path = &quot;todos/&quot; + id
  }
  .responseFlow&amp;lt;TodoDto&amp;gt;()
}

public fun NetFlowClient.createTodoApi(): TodoApi = _TodoApiImpl(this)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That is the 0.6 DSL. Byte for byte, it's the code you would have written by hand. The annotations are not a parallel implementation, they are a text expansion into the existing one. Nothing new runs at runtime, there is no reflection, and there is no second code path to keep in sync when the DSL changes.&lt;/p&gt;
&lt;p&gt;It also means you can open the file and read it.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-decision-that-matters-no-transform-in-annotations&quot;&gt;The decision that matters: no transform in annotations&lt;/h3&gt;
&lt;p&gt;Now the constraint that shaped everything else.&lt;/p&gt;
&lt;p&gt;An annotation cannot hold a lambda. Kotlin annotation parameters are limited to compile-time constants, so &lt;code&gt;transform = { it.toModel() }&lt;/code&gt; has nowhere to live. Neither does &lt;code&gt;onNetworkSuccess { db.insert(it) }&lt;/code&gt;, or &lt;code&gt;local { observe { db.todos() } }&lt;/code&gt;, or a paging &lt;code&gt;RemoteMediator&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The mapping problem has known workarounds and I looked at all of them. &lt;code&gt;@MappedBy(TodoMapper::class)&lt;/code&gt; pointing at an object with a &lt;code&gt;map&lt;/code&gt; function. A converter registry you populate at client construction. An interface the DTO implements. Every one of them takes a relationship the 0.6 compiler verifies and moves it somewhere the compiler cannot see, resolved by KSP at best and by a map lookup at worst. Forgetting a mapper would stop being a build error and start being a runtime cast exception on a device.&lt;/p&gt;
&lt;p&gt;I was not going to make the convenience layer less safe than the thing it is a convenience for. So annotated methods return the DTO. Full stop.&lt;/p&gt;
&lt;p&gt;The mapping moves one layer out, into the repository, using the &lt;code&gt;.map&lt;/code&gt; helpers NetFlow already ships. Their KDoc has said the same thing since 0.1: usually used in the repository to map the dto to the model.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// commonMain
class TodoApiRepositoryImpl(client: NetFlowClient) {

    private val api = client.createTodoApi()

    suspend fun getTodos(): AsyncState&amp;lt;List&amp;lt;Todo&amp;gt;&amp;gt; =
        api.getTodos(completed = null).map { dtos -&amp;gt; dtos.map { it.toModel() } }

    fun observeTodo(id: Int): Flow&amp;lt;ResultState&amp;lt;Todo&amp;gt;&amp;gt; =
        api.observeTodo(id).map { state -&amp;gt; state.map { it.toModel() } }

    fun pagedTodos(): Flow&amp;lt;PagingData&amp;lt;Todo&amp;gt;&amp;gt; =
        api.pagedTodos().map { page -&amp;gt; page.map { it.toModel() } }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The mapping is still explicit, still typed, still checked by the compiler. It moved. It did not weaken.&lt;/p&gt;
&lt;p&gt;If there is one transferable idea in this whole article, it's that one. When you build a convenience layer over a stricter API, the layer is allowed to be less capable. It's not allowed to be less safe. The moment it is, every user of the convenience layer is quietly worse off than the users who ignored it, and you have built a trap with good ergonomics.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-paged-endpoint-is-one-line&quot;&gt;The paged endpoint is one line&lt;/h3&gt;
&lt;p&gt;If there is a single place where this layering pays for itself, it's paging.&lt;/p&gt;
&lt;p&gt;An annotation library that only speaks HTTP gets you as far as the DTO. After that you write a &lt;code&gt;PagingSource&lt;/code&gt;: a &lt;code&gt;load&lt;/code&gt; that does the key arithmetic, a &lt;code&gt;getRefreshKey&lt;/code&gt; that reads &lt;code&gt;state.anchorPosition&lt;/code&gt; and reaches for the closest page, a &lt;code&gt;LoadResult&lt;/code&gt; branch for success and one for failure, then a &lt;code&gt;Pager&lt;/code&gt; and a &lt;code&gt;PagingConfig&lt;/code&gt; to assemble it. That is fifty lines you have written before, and fifty more for the next paged endpoint, because none of this is about your data.&lt;/p&gt;
&lt;p&gt;In NetFlow you only need a &lt;code&gt;PagingData&lt;/code&gt; return type.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// commonMain
@GET(&quot;todos&quot;)
fun pagedTodos(): Flow&amp;lt;PagingData&amp;lt;TodoDto&amp;gt;&amp;gt;

@Paginated(pageSize = 15)
@GET(&quot;todos&quot;)
fun pagedTodosSmall(): Flow&amp;lt;PagingData&amp;lt;TodoDto&amp;gt;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;@Paginated&lt;/code&gt; is optional, and it carries only the two things: the query parameter name for the page number, and the page size. Leave it off and you get &lt;code&gt;page&lt;/code&gt; and 20.&lt;/p&gt;
&lt;p&gt;The DTO extends &lt;code&gt;PagingModel&lt;/code&gt;, which is where the page number and the last-updated timestamp live:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;@Serializable
data class TodoDto(
    val userId: Int,
    val id: Int,
    val title: String,
    val completed: Boolean
) : PagingModel()
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Forget it and the build stops with &lt;code&gt;Flow&amp;lt;PagingData&amp;lt;T&amp;gt;&amp;gt; requires T to extend PagingModel&lt;/code&gt;. Put &lt;code&gt;@Paginated&lt;/code&gt; on a method that returns something else and the build stops there too. Neither is a runtime discovery.&lt;/p&gt;
&lt;p&gt;The repository maps exactly like every other annotated call, and the ViewModel does what it always does:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// commonMain
fun pagedTodos(): Flow&amp;lt;PagingData&amp;lt;Todo&amp;gt;&amp;gt; =
    api.pagedTodos().map { page -&amp;gt; page.map { it.toModel() } }

val todos = repository.pagedTodos().cachedIn(viewModelScope)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That flow is declared in &lt;code&gt;commonMain&lt;/code&gt;, and this is the part with no Ktorfit equivalent at all. On Android you collect it with &lt;code&gt;collectAsLazyPagingItems()&lt;/code&gt;. On iOS, &lt;code&gt;netflow-paging&lt;/code&gt; ships &lt;code&gt;PagingCollectionViewController&lt;/code&gt;, a Kotlin class exposing &lt;code&gt;loadStateFlow&lt;/code&gt;, &lt;code&gt;onPagesUpdatedFlow&lt;/code&gt;, &lt;code&gt;getItems()&lt;/code&gt; and &lt;code&gt;loadNextPage()&lt;/code&gt; to Swift through SKIE, so a SwiftUI list drives the same pager. One annotated method, both platforms, no per-platform paging code.&lt;/p&gt;
&lt;p&gt;Now the boundary. An annotated paged method is network-only. The generated call says so:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// generated
.responsePaginated&amp;lt;TodoDto, TodoDto&amp;gt; {
  onlyApiCall = true
  defaultPageSize = 15
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Remote plus local paging needs a &lt;code&gt;PagingSource&lt;/code&gt; factory, an &lt;code&gt;insertAll&lt;/code&gt; block, and a timestamp lambda. Three lambdas. So it stays where lambdas live, and getting there is the next rung.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;rung-two-netflowcall&quot;&gt;Rung two: NetFlowCall&lt;/h3&gt;
&lt;p&gt;That leaves an obvious hole. What about an endpoint whose request is pure boilerplate, path and method and three query params, but whose response needs a local cache?&lt;/p&gt;
&lt;p&gt;Under a strict reading of rung one you drop back to the full DSL and hand-write the request too, which means the annotation layer is useless for exactly the calls that have the most typing in them.&lt;/p&gt;
&lt;p&gt;0.7.0 splits the call in half. An annotated method can return &lt;code&gt;NetFlowCall&lt;/code&gt;, which is the request with no response strategy attached:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// commonMain
@GET(&quot;todos&quot;)
fun todosCall(): NetFlowCall
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The generated implementation stops at the request:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// generated
override fun todosCall(): NetFlowCall = client.prepareCall {
  method = HttpMethod.Get
  path = &quot;todos&quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And the caller composes the response side with the whole DSL available, &lt;code&gt;transform&lt;/code&gt; requirement included:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// commonMain
fun getTodos(): Flow&amp;lt;ResultState&amp;lt;List&amp;lt;Todo&amp;gt;&amp;gt;&amp;gt; =
    api.todosCall().responseListFlow&amp;lt;TodoDto, Todo&amp;gt;(transform = { it.toModel() }) {

        onNetworkSuccess { dtos -&amp;gt;
            database.todoQueries.transaction {
                dtos.forEach { database.todoQueries.insertTodo(it.toEntity()) }
            }
        }

        local(
            { observe { database.todoQueries.selectTodos() } },
            transform = { entities -&amp;gt; entities.map { it.toModel() } }
        )
    }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The annotation owns what annotations are good at: path, method, query parameters, headers, body. The repository owns what only a lambda can express.&lt;/p&gt;
&lt;p&gt;Because the response strategy now belongs to the caller, &lt;code&gt;@Wrapped&lt;/code&gt; on a &lt;code&gt;NetFlowCall&lt;/code&gt; method is a compile error, with a message that says why:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Function 'todosCall' returns NetFlowCall — @Wrapped is the caller's
response-strategy choice, not the interface's.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;@Paginated&lt;/code&gt; fails the same way, since it requires a &lt;code&gt;Flow&amp;lt;PagingData&amp;lt;T&amp;gt;&amp;gt;&lt;/code&gt; return type it will never see. I would rather refuse the annotation than silently pick a strategy on someone's behalf.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;prepareCall { }&lt;/code&gt; is public, so hand-written DSL users get the same split without touching annotations.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;rung-three-the-call-dsl&quot;&gt;Rung three: the call {} DSL&lt;/h3&gt;
&lt;p&gt;The top rung is unchanged. Remote plus local paging, &lt;code&gt;localQuery&lt;/code&gt; with its count and items and invalidation lambdas, retry policies with a &lt;code&gt;retryOn&lt;/code&gt; predicate, per-request headers computed at call time, &lt;code&gt;onlyLocalCall&lt;/code&gt; for offline reads. The paged call from two sections ago, with a database under it, looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// commonMain
@OptIn(ExperimentalPagingApi::class)
override fun getTodos(): Flow&amp;lt;PagingData&amp;lt;Todo&amp;gt;&amp;gt; = client.call {
    path = &quot;todos&quot;
}.responsePaginated&amp;lt;TodoDto, Todo&amp;gt; {
    localSource(
        pagingSource = { TodoPagingSource(database) },
        transform = { it.toModel() }
    )

    deleteOnRefresh = false
    insertAll(transform = { it.toEntity() }) { todos -&amp;gt;
        database.todoQueries.transaction {
            database.todoQueries.deleteTodos()
            todos.forEach { database.todoQueries.insertTodo(it) }
        }
    }

    firstItemDatabase(
        itemDatabase = { database.todoQueries.getFirstTodo().executeAsOneOrNull() },
        timestamp = { it.lastUpdatedTimestamp }
    )
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There is no annotation on earth that expresses that, and I did not try to invent one. The top of the ladder is supposed to look like this.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;three-rungs-or-three-libraries&quot;&gt;Three rungs, or three libraries&lt;/h3&gt;
&lt;p&gt;The alternative to layering is what most projects already do. Ktorfit for the HTTP calls, Store or something hand-rolled for the cache, Paging wired up separately with its own &lt;code&gt;RemoteMediator&lt;/code&gt;. It works. I have shipped it.&lt;/p&gt;
&lt;p&gt;What it costs is coherence. Three libraries mean three sets of state types that don't compose, three failure models, and three test setups. Your Ktorfit call throws, your cache layer returns a sealed class, your paging layer emits &lt;code&gt;LoadState&lt;/code&gt;, and the repository is the place where you write the glue that reconciles all of it. Then you write a MockEngine for one, a fake for another, and an in-memory database for the third.&lt;/p&gt;
&lt;p&gt;In NetFlow the three rungs return the same &lt;code&gt;ResultState&lt;/code&gt;, &lt;code&gt;AsyncState&lt;/code&gt;, and &lt;code&gt;PagingData&lt;/code&gt; types. They run on the same &lt;code&gt;NetFlowClient&lt;/code&gt;. And they are tested with the same &lt;code&gt;MockNetFlowClient&lt;/code&gt;, which intercepts requests without any network at all:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;@Test
fun `delete removes item from local database`() = runTest {
    val mockClient = MockNetFlowClient { _ -&amp;gt; NetFlowMockResponse.success() }
    val repository = TodoRepositoryImpl(mockClient, database)

    repository.deleteTodo(id = 1)

    mockClient.assertCalled(&quot;todos/1&quot;, HttpMethod.Delete)
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That test doesn't care which rung the repository used. Swap &lt;code&gt;getTodos&lt;/code&gt; from an annotated method to a &lt;code&gt;call {}&lt;/code&gt; block and the test still passes, because the boundary is the client, not the call style.&lt;/p&gt;
&lt;p&gt;Now the honest part. If you just want to use annotations, Ktorfit beats this comfortably. It has years of production use, multipart and form-data, streaming, response converters, a much larger vocabulary, and a community that has already hit the bugs you are about to hit. NetFlow 0.7.0 has a first pass and a roadmap item that still says multipart. If HTTP is genuinely all you need, use Ktorfit.&lt;/p&gt;
&lt;p&gt;The exception is the one I spent a whole section on. No annotation layer hands you a &lt;code&gt;Flow&amp;lt;PagingData&amp;lt;T&amp;gt;&amp;gt;&lt;/code&gt; from &lt;code&gt;commonMain&lt;/code&gt;, because that requires the paging integration to already be part of the same library. That is not me out-annotating Ktorfit, it's the stack underneath the annotations showing through, which is the only bet I am actually making.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;generating-into-commonmain-with-ksp&quot;&gt;Generating into commonMain with KSP&lt;/h3&gt;
&lt;p&gt;This is the part I found least documented, so here it is in full.&lt;/p&gt;
&lt;p&gt;The processor emits one file per annotated interface into the common metadata source set, and every target then compiles that file as ordinary common code. On the consumer side it is four pieces of wiring:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-kotlin&quot;&gt;// build.gradle.kts
plugins {
    alias(libs.plugins.ksp)
}

kotlin {
    sourceSets {
        commonMain {
            kotlin.srcDir(&quot;build/generated/ksp/metadata/commonMain/kotlin&quot;)
        }
        commonMain.dependencies {
            implementation(&quot;io.github.kmpbits:netflow-annotations:&amp;lt;latest_version&amp;gt;&quot;)
        }
    }
}

dependencies {
    add(&quot;kspCommonMainMetadata&quot;, &quot;io.github.kmpbits:netflow-ksp:&amp;lt;latest_version&amp;gt;&quot;)
}

tasks.withType&amp;lt;KotlinCompilationTask&amp;lt;*&amp;gt;&amp;gt;().configureEach {
    if (name != &quot;kspCommonMainKotlinMetadata&quot;) {
        dependsOn(&quot;kspCommonMainKotlinMetadata&quot;)
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;srcDir&lt;/code&gt; line and the &lt;code&gt;dependsOn&lt;/code&gt; block are the two that bite. Without &lt;code&gt;srcDir&lt;/code&gt;, the generated file exists on disk and no source set can see it. Without the task dependency, your Android compilation happily starts before KSP has produced anything, and you get an unresolved reference to &lt;code&gt;createTodoApi&lt;/code&gt; that disappears on the second build. That intermittent-failure flavour is the worst kind to debug, which is exactly why it is worth ten lines of Gradle.&lt;/p&gt;
&lt;p&gt;One detail worth mention: &lt;code&gt;netflow-ksp&lt;/code&gt; has no dependency on &lt;code&gt;netflow-paging&lt;/code&gt;. The processor emits &lt;code&gt;responsePaginated&lt;/code&gt; as a fully qualified name string and lets the consumer's own classpath resolve it. If you never return &lt;code&gt;Flow&amp;lt;PagingData&amp;lt;T&amp;gt;&amp;gt;&lt;/code&gt;, you never pull in Paging 3, and the annotation module stays a pure Kotlin Multiplatform artifact with no Android-flavoured transitive weight.&lt;/p&gt;
&lt;p&gt;I picked KSP over a compiler plugin for one reason: the output is a plain &lt;code&gt;.kt&lt;/code&gt; file you can open. When a generated call sends the wrong query parameter, you go look at the generated line and see it. A compiler plugin gives you IR, a stack trace, and a bad afternoon. Ktorfit itself ran on KSP for years and only moved to a compiler-plugin-only model after it had the user base to absorb that opacity. For a library at 0.7.0 with three stars, readable output is worth more than whatever the plugin route buys.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-line-i-hold&quot;&gt;The line I hold&lt;/h3&gt;
&lt;p&gt;Adding a familiar surface to an unfamiliar API is not a compromise, as long as the surface refuses to lie about what is underneath it. Annotations in NetFlow do not wrap the DSL, they generate it, they return the same types, they run on the same client, they break at compile time when you ask them for something they cannot do, and they stop at the exact line where a lambda becomes necessary. That stopping point is the design, not a gap in it.&lt;/p&gt;
&lt;p&gt;A layer that quietly did less checking so it could cover more cases would be a worse library with a better README.&lt;/p&gt;
&lt;p&gt;This is 0.7.0, and the honest framing is that I have no external users yet. The annotation surface may well shift in 0.8 or 0.9 once somebody who is not me tries to model an API with it. Read the code samples here as 0.7.0, not as a promise.&lt;/p&gt;
&lt;p&gt;But the shape I would defend regardless of version: put the familiar entry on the front, keep the harder API reachable from it without changing cars, and be loud about where one ends and the other begins.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Pit lane or full circuit, it is the same car. 🏁&lt;/em&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;The library is available on &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/kmpbits/netflow&quot;&gt;GitHub&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/27052/two-racing-lines-annotations-and-the-dsl-in-netflow-0-7-0</guid>
<pubDate>Mon, 14 Sep 2026 08:00:00 +0000</pubDate>
</item>
<item>
<title>Cloud Computing Is Just npm install for Infrastructure</title>
<link>https://coderlegion.com/24091/cloud-computing-is-just-npm-install-for-infrastructure</link>
<description>
&lt;p&gt;Hello, I'm Ganesh. I'm building &lt;em&gt;git-lrc&lt;/em&gt;, an AI code reviewer that runs on every commit. It is free, unlimited, and source-available on Github. &lt;a href=&quot;https://github.com/HexmosTech/git-lrc&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;Star git-lrc on GitHub&lt;/a&gt; to help more developers discover the project. Do give it a try and share your feedback for improving the product.&lt;/p&gt;

&lt;p&gt;Every time you pull in a third-party package instead of writing something yourself, you make a trade: you stop owning the internals, but you're still on the hook for how you use it, what it costs you at scale, and what happens the day it breaks in production. &lt;/p&gt;

&lt;p&gt;Cloud computing runs on the exact same trade: you're just importing servers, storage, and networking instead of a library.&lt;/p&gt;

&lt;p&gt;That mental model answers the questions that actually matter once you move past the marketing pitch: If I don't manage the OS anymore, what am I still on the hook for? Do I self-host, use a managed service, or mix both? Why does my bill move even when my code didn't change? And what happens when the dependency I'm relying on goes down, gets slow, or degrades under load?&lt;/p&gt;

&lt;p&gt;In this article, I'll walk through the 5 concepts that answer those questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. The Shared Responsibility Model
&lt;/h2&gt;

&lt;p&gt;While cloud providers manage a significant portion of the infrastructure, customers still have important security and operational responsibilities. &lt;/p&gt;

&lt;p&gt;This concept is known as the &lt;strong&gt;Shared Responsibility Model&lt;/strong&gt;, and the division of duties changes depending on whether you're running workloads &lt;strong&gt;On-Premises&lt;/strong&gt;, or using &lt;strong&gt;IaaS&lt;/strong&gt;, &lt;strong&gt;PaaS&lt;/strong&gt;, or &lt;strong&gt;SaaS&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  On-Premises: You Manage Everything
&lt;/h3&gt;

&lt;p&gt;When applications run in your own data center, every component&amp;mdash;data, devices, accounts, IAM, applications, network controls, operating systems, physical servers, networking, and the datacenter itself is your responsibility. &lt;/p&gt;

&lt;p&gt;Since there's no cloud provider involved, there's nothing to share.&lt;/p&gt;

&lt;h3&gt;
  
  
  Infrastructure as a Service (IaaS)
&lt;/h3&gt;

&lt;p&gt;Examples include virtual machines such as &lt;strong&gt;Amazon EC2&lt;/strong&gt;, &lt;strong&gt;Azure Virtual Machines&lt;/strong&gt;, and &lt;strong&gt;Google Compute Engine&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;The provider supplies the physical infrastructure, hosts, networking, and datacenters, while you manage data, devices, accounts, IAM, applications, network controls, and operating systems. &lt;/p&gt;

&lt;p&gt;IaaS offers the most flexibility of the cloud models but also requires the most operational management.&lt;/p&gt;

&lt;h3&gt;
  
  
  Platform as a Service (PaaS)
&lt;/h3&gt;

&lt;p&gt;Examples include &lt;strong&gt;Azure App Service&lt;/strong&gt;, &lt;strong&gt;AWS Elastic Beanstalk&lt;/strong&gt;, &lt;strong&gt;Google App Engine&lt;/strong&gt;, and &lt;strong&gt;Heroku&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;PaaS removes the burden of managing operating systems and infrastructure. Customers still manage data, devices, and accounts; IAM, applications, and network controls are shared; and the provider manages the OS, infrastructure, hosts, networking, and datacenters.&lt;/p&gt;

&lt;h3&gt;
  
  
  Software as a Service (SaaS)
&lt;/h3&gt;

&lt;p&gt;Examples include &lt;strong&gt;Microsoft 365&lt;/strong&gt;, &lt;strong&gt;Salesforce&lt;/strong&gt;, &lt;strong&gt;Google Workspace&lt;/strong&gt;, and &lt;strong&gt;Dropbox&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Customers manage data, devices, and accounts, with IAM as a shared responsibility. &lt;/p&gt;

&lt;p&gt;The provider manages everything else&amp;mdash;applications, network controls, OS, infrastructure, hosts, networking, and datacenters making SaaS the model with the lowest operational overhead.&lt;/p&gt;

&lt;h3&gt;
  
  
  Shared Responsibility at a Glance
&lt;/h3&gt;

&lt;div class=&quot;table-wrapper-paragraph&quot;&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service Model&lt;/th&gt;
&lt;th&gt;Customer Manages&lt;/th&gt;
&lt;th&gt;Shared&lt;/th&gt;
&lt;th&gt;Provider Manages&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;On-Premises&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Everything&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Nothing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;IaaS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;OS, applications, IAM, network controls, data&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Infrastructure &amp;amp; physical hardware&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;PaaS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Data, devices, accounts&lt;/td&gt;
&lt;td&gt;IAM, applications, network controls&lt;/td&gt;
&lt;td&gt;OS, infrastructure &amp;amp; physical hardware&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SaaS&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Data, devices, accounts&lt;/td&gt;
&lt;td&gt;IAM&lt;/td&gt;
&lt;td&gt;Applications, OS, infrastructure &amp;amp; physical hardware&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;No matter which model you choose, &lt;strong&gt;your data, devices, and user accounts remain your responsibility&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;As you move from On-Premises &amp;rarr; IaaS &amp;rarr; PaaS &amp;rarr; SaaS, the provider takes on progressively more of the operational burden but protecting users, managing access, and securing data always stay in your hands.&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgwhz66dm3bzh2vjz7f5e.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgwhz66dm3bzh2vjz7f5e.png&quot; alt=&quot;&quot; width=&quot;800&quot; height=&quot;533&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Cloud Deployment Models: Public, Private, and Hybrid
&lt;/h2&gt;

&lt;p&gt;A cloud deployment model defines where your infrastructure is hosted, who owns it, and who can access it. &lt;/p&gt;

&lt;p&gt;The three primary models are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Public&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Private&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hybrid&lt;/strong&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;each offer different levels of flexibility, security, and control.&lt;/p&gt;

&lt;h3&gt;
  
  
  Public Cloud
&lt;/h3&gt;

&lt;p&gt;Owned and operated by a provider such as Microsoft Azure, AWS, or Google Cloud Platform, with infrastructure shared among multiple customers.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics:&lt;/strong&gt; no hardware to maintain, rapid provisioning, pay-as-you-go pricing, high scalability, global availability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advantages:&lt;/strong&gt; lower upfront costs, rapid deployment, automatic maintenance, high availability ideal for startups and growing businesses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limitations:&lt;/strong&gt; less control, shared environment, potential compliance restrictions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best for:&lt;/strong&gt; web applications, mobile backends, dev/test environments, AI/ML workloads, disaster recovery.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Private Cloud
&lt;/h3&gt;

&lt;p&gt;Dedicated to a single organization, hosted either in-house or by a third-party provider, with no resource sharing across organizations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics:&lt;/strong&gt; dedicated infrastructure, greater administrative control, enhanced security, custom networking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advantages:&lt;/strong&gt; better compliance support, increased data privacy, full infrastructure control, custom security policies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limitations:&lt;/strong&gt; higher costs, requires skilled administrators, slower scaling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best for:&lt;/strong&gt; government, healthcare, banking and finance, and other heavily regulated enterprises.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Hybrid Cloud
&lt;/h3&gt;

&lt;p&gt;Combines public and private environments, letting workloads and data move between them as needed This keeps sensitive workloads private while using the public cloud for scale.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Characteristics:&lt;/strong&gt; combines both models, flexible workload placement, supports gradual migration, optimizes cost and performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advantages:&lt;/strong&gt; flexibility, business continuity, disaster recovery, cost optimization, easier migration from on-premises.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limitations:&lt;/strong&gt; more complex architecture, requires strong networking and identity management, more governance overhead.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Best for:&lt;/strong&gt; large enterprises, seasonal traffic spikes, backup/DR, organizations migrating to the cloud.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Quick Comparison
&lt;/h3&gt;

&lt;div class=&quot;table-wrapper-paragraph&quot;&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Public Cloud&lt;/th&gt;
&lt;th&gt;Private Cloud&lt;/th&gt;
&lt;th&gt;Hybrid Cloud&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Ownership&lt;/td&gt;
&lt;td&gt;Cloud provider&lt;/td&gt;
&lt;td&gt;Single organization&lt;/td&gt;
&lt;td&gt;Both&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost&lt;/td&gt;
&lt;td&gt;Low upfront&lt;/td&gt;
&lt;td&gt;Higher&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scalability&lt;/td&gt;
&lt;td&gt;Excellent&lt;/td&gt;
&lt;td&gt;Limited by hardware&lt;/td&gt;
&lt;td&gt;Excellent&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Security&lt;/td&gt;
&lt;td&gt;Good&lt;/td&gt;
&lt;td&gt;Very High&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Maintenance&lt;/td&gt;
&lt;td&gt;Provider&lt;/td&gt;
&lt;td&gt;Organization&lt;/td&gt;
&lt;td&gt;Shared&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flexibility&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;td&gt;Very High&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt; An e-commerce company might run its customer-facing website on the &lt;strong&gt;public cloud&lt;/strong&gt; to handle traffic spikes during sales events, store payment records in a &lt;strong&gt;private cloud&lt;/strong&gt; for compliance, and connect both through a &lt;strong&gt;hybrid architecture&lt;/strong&gt; for secure data exchange balancing security, performance, and cost.&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6r4rmhh6f2yhxknzsofq.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6r4rmhh6f2yhxknzsofq.png&quot; alt=&quot;&quot; width=&quot;800&quot; height=&quot;613&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  3. The Consumption-Based Pricing Model
&lt;/h2&gt;

&lt;p&gt;Instead of purchasing expensive servers and networking equipment upfront, the cloud lets businesses pay only for what they use, an approach known as the &lt;strong&gt;consumption-based model&lt;/strong&gt;, or pay-as-you-go pricing. Think of it like an electricity bill: you pay for the units you consume, not a fixed monthly amount.&lt;/p&gt;

&lt;h3&gt;
  
  
  Traditional Infrastructure vs. Cloud Consumption
&lt;/h3&gt;

&lt;div class=&quot;table-wrapper-paragraph&quot;&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Traditional Infrastructure&lt;/th&gt;
&lt;th&gt;Consumption-Based Cloud&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Large upfront hardware investment&lt;/td&gt;
&lt;td&gt;No upfront infrastructure purchase&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pay even when servers are idle&lt;/td&gt;
&lt;td&gt;Pay only for resources you use&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Capacity planning required&lt;/td&gt;
&lt;td&gt;Scale resources up or down instantly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hardware maintenance is your responsibility&lt;/td&gt;
&lt;td&gt;Cloud provider manages infrastructure&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbfec7bp8ez5zc34asivm.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbfec7bp8ez5zc34asivm.png&quot; alt=&quot;&quot; width=&quot;800&quot; height=&quot;630&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Benefits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;No upfront costs&lt;/strong&gt; : start using services immediately without buying hardware or licenses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pay only for what you use&lt;/strong&gt; : compute hours, storage, database transactions, data transfer, and function executions are all billed based on actual consumption.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scale when needed&lt;/strong&gt; : resources grow during demand spikes and shrink afterward, an elasticity that's expensive to replicate on-premises.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Better cost optimization&lt;/strong&gt; : usage-based billing encourages practices like shutting down unused VMs, right-sizing instances, using autoscaling, and monitoring spend regularly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2wqs8w0wm2xpn24vjvdq.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2wqs8w0wm2xpn24vjvdq.png&quot; alt=&quot;&quot; width=&quot;800&quot; height=&quot;575&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Consumption-Based vs. Subscription-Based Pricing
&lt;/h3&gt;

&lt;div class=&quot;table-wrapper-paragraph&quot;&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Consumption-Based&lt;/th&gt;
&lt;th&gt;Subscription-Based&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Pay for actual usage&lt;/td&gt;
&lt;td&gt;Fixed monthly or yearly fee&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Flexible costs&lt;/td&gt;
&lt;td&gt;Predictable costs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ideal for changing workloads&lt;/td&gt;
&lt;td&gt;Best for consistent workloads&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Easy to scale&lt;/td&gt;
&lt;td&gt;Usually includes predefined resource limits&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;An e-commerce site running a consumption-based model keeps only a few virtual machines running on normal days, automatically adds instances during festival sales, and scales back down once traffic normalizes, paying only for the extra capacity while it's actually in use.&lt;/p&gt;

&lt;p&gt;To avoid cost surprises, it's worth setting spending budgets, enabling billing alerts, monitoring usage, and reviewing bills regularly.&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F02ddhlq46lygqazjgcyt.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F02ddhlq46lygqazjgcyt.png&quot; alt=&quot;&quot; width=&quot;800&quot; height=&quot;559&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. High Availability vs. Scalability
&lt;/h2&gt;

&lt;p&gt;Two qualities determine whether users get a smooth experience in the cloud: &lt;strong&gt;high availability&lt;/strong&gt; and &lt;strong&gt;scalability&lt;/strong&gt;. They're often mentioned together, but they solve different problems.&lt;/p&gt;

&lt;h3&gt;
  
  
  High Availability
&lt;/h3&gt;

&lt;p&gt;High availability (HA) is a system's ability to remain operational even when failures occur. Rather than preventing every failure, cloud platforms detect problems and automatically shift workloads to healthy resources. Providers achieve this through redundant infrastructure, multiple data centers and Availability Zones, automatic failover, and SLAs that define expected uptime.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Example: if a server crashes during an online banking transaction, traffic is redirected to a healthy instance so customers don't lose access to their accounts.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Scalability
&lt;/h3&gt;

&lt;p&gt;Scalability is the ability to handle increasing or decreasing workloads by adjusting resources&amp;mdash;a matter of capacity rather than uptime.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Vertical scaling (scale up):&lt;/strong&gt; add more CPU, RAM, or faster storage to an existing machine&amp;mdash;simple, but limited by hardware ceilings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Horizontal scaling (scale out):&lt;/strong&gt; add more instances and distribute traffic across them  preferred for cloud-native applications, and often automated based on CPU, memory, or request volume.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  High Availability vs. Scalability
&lt;/h3&gt;

&lt;div class=&quot;table-wrapper-paragraph&quot;&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;High Availability&lt;/th&gt;
&lt;th&gt;Scalability&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Keeps services running during failures&lt;/td&gt;
&lt;td&gt;Handles increasing workloads efficiently&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Focuses on minimizing downtime&lt;/td&gt;
&lt;td&gt;Focuses on increasing capacity&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Uses redundancy and failover&lt;/td&gt;
&lt;td&gt;Uses additional computing resources&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Improves reliability&lt;/td&gt;
&lt;td&gt;Improves performance under load&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A movie ticket booking platform sees a traffic surge when tickets for a blockbuster release, the application automatically adds servers to handle demand (scalability), and if one server fails mid-rush, requests are redirected to healthy servers without interrupting users (high availability).&lt;/p&gt;

&lt;p&gt;A well-designed cloud application aims for both.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Reliability and Predictability: Building Trust Beyond Uptime
&lt;/h2&gt;

&lt;p&gt;Hosting an application in the cloud doesn't, by itself, guarantee a great experience. Users expect applications to stay available, recover quickly from failures, and perform consistently regardless of workload&amp;mdash;expectations built on two more fundamental principles: &lt;strong&gt;reliability&lt;/strong&gt; and &lt;strong&gt;predictability&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding Reliability
&lt;/h3&gt;

&lt;p&gt;Reliability is a system's ability to continue operating, or recover quickly, when failures occur. Hardware failures, software bugs, network outages, and even data center outages are inevitable in distributed systems, so rather than trying to eliminate every failure, cloud platforms are designed to detect, isolate, and recover from them automatically, distributing applications across multiple VMs, Availability Zones, or regions so that if one component goes down, another takes over with minimal disruption.&lt;/p&gt;

&lt;p&gt;For example, if a virtual machine crashes unexpectedly, the platform can automatically provision a replacement and restore service without manual intervention.&lt;/p&gt;

&lt;h3&gt;
  
  
  Understanding Predictability
&lt;/h3&gt;

&lt;p&gt;Predictability is about delivering consistent application behavior, performance, and costs over time, giving teams confidence that infrastructure will respond as expected under both normal and peak workloads. Providers support this through tools that monitor infrastructure health, analyze workload patterns, estimate future resource needs, and automatically adjust capacity. The result:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Stable application response times&lt;/li&gt;
&lt;li&gt;Consistent system behavior&lt;/li&gt;
&lt;li&gt;Predictable infrastructure costs&lt;/li&gt;
&lt;li&gt;Better resource planning&lt;/li&gt;
&lt;li&gt;Improved operational efficiency&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Reliability vs. Predictability
&lt;/h3&gt;

&lt;div class=&quot;table-wrapper-paragraph&quot;&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Reliability&lt;/th&gt;
&lt;th&gt;Predictability&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Focuses on recovering from failures&lt;/td&gt;
&lt;td&gt;Focuses on maintaining consistent performance and behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ensures applications remain available&lt;/td&gt;
&lt;td&gt;Ensures applications perform consistently over time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Achieved through redundancy, failover, and fault tolerance&lt;/td&gt;
&lt;td&gt;Achieved through monitoring, autoscaling, analytics, and capacity planning&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Measured by availability, resilience, and recovery&lt;/td&gt;
&lt;td&gt;Measured by performance consistency, scalability, and cost stability&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Reliability answers: &lt;em&gt;&quot;Will the application continue running if something fails?&quot;&lt;/em&gt; Predictability answers: &lt;em&gt;&quot;Will the application continue performing as expected as demand changes?&quot;&lt;/em&gt;&amp;lt;&lt;/p&gt;
</description>
<category>Other</category>
<guid isPermaLink="true">https://coderlegion.com/24091/cloud-computing-is-just-npm-install-for-infrastructure</guid>
<pubDate>Sun, 16 Aug 2026 08:44:28 +0000</pubDate>
</item>
<item>
<title>Cloud-Based Network Monitoring: How It Works, Key Metrics, and Best Practices</title>
<link>https://coderlegion.com/24217/cloud-based-network-monitoring-how-it-works-key-metrics-and-best-practices</link>
<description>&lt;p&gt;Cloud-based network monitoring enables organizations to monitor, manage, and optimize their network infrastructure remotely through cloud-hosted platforms. It provides real-time visibility into network performance, device health, traffic patterns, and security events, allowing IT teams to quickly identify and resolve issues before they impact business operations. Compared to traditional on-premises monitoring, cloud-based solutions offer greater scalability, flexibility, centralized management, and reduced infrastructure costs, making them well suited for modern hybrid and distributed environments.&lt;/p&gt;
&lt;p&gt;Successful cloud-based network monitoring depends on selecting the right monitoring platform, maintaining comprehensive visibility across cloud and on-premises resources, configuring real-time alerts, and continuously analyzing performance data. By adopting proactive monitoring practices, organizations can improve network reliability, strengthen security, optimize resource utilization, and ensure consistent performance as their infrastructure grows and evolves.&lt;/p&gt;
&lt;p&gt;Source: This summary is based on the blog &quot;Cloud-Based Network Monitoring&quot; by PathSolutions.&lt;/p&gt;
&lt;p&gt;Blog URL: &lt;a rel=&quot;nofollow&quot; href=&quot;http://Cloud-based%20network%20monitoring%20enables%20organizations%20to%20monitor,%20manage,%20and%20optimize%20their%20network%20infrastructure%20remotely%20through%20cloud-hosted%20platforms.%20It%20provides%20real-time%20visibility%20into%20network%20performance,%20device%20health,%20traffic%20patterns,%20and%20security%20events,%20allowing%20IT%20teams%20to%20quickly%20identify%20and%20resolve%20issues%20before%20they%20impact%20business%20operations.%20Compared%20to%20traditional%20on-premises%20monitoring,%20cloud-based%20solutions%20offer%20greater%20scalability,%20flexibility,%20centralized%20management,%20and%20reduced%20infrastructure%20costs,%20making%20them%20well%20suited%20for%20modern%20hybrid%20and%20distributed%20environments.%20%20Successful%20cloud-based%20network%20monitoring%20depends%20on%20selecting%20the%20right%20monitoring%20platform,%20maintaining%20comprehensive%20visibility%20across%20cloud%20and%20on-premises%20resources,%20configuring%20real-time%20alerts,%20and%20continuously%20analyzing%20performance%20data.%20By%20adopting%20proactive%20monitoring%20practices,%20organizations%20can%20improve%20network%20reliability,%20strengthen%20security,%20optimize%20resource%20utilization,%20and%20ensure%20consistent%20performance%20as%20their%20infrastructure%20grows%20and%20evolves.%20%20Source:%20This%20summary%20is%20based%20on%20the%20blog%20%22Cloud-Based%20Network%20Monitoring%22%20by%20PathSolutions.%20%20Blog%20URL:%20https://www.pathsolutions.com/blog/cloud-based-network-monitoring&quot;&gt;https://www.pathsolutions.com/blog/cloud-based-network-monitoring&lt;/a&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/24217/cloud-based-network-monitoring-how-it-works-key-metrics-and-best-practices</guid>
<pubDate>Thu, 06 Aug 2026 15:01:53 +0000</pubDate>
</item>
<item>
<title>Understanding Multiple Input and Output Neural Network</title>
<link>https://coderlegion.com/22513/understanding-multiple-input-and-output-neural-network</link>
<description>
&lt;p&gt;Hello, I'm Ganesh. I'm building &lt;em&gt;git-lrc&lt;/em&gt;, an AI code reviewer that runs on every commit. It is free, unlimited, and source-available on Github. &lt;a href=&quot;https://github.com/HexmosTech/git-lrc&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;Star git-lrc on GitHub&lt;/a&gt; to help more developers discover the project. Do give it a try and share your feedback for improving the product.&lt;/p&gt;

&lt;p&gt;In the previous article, we discussed how ReLU activation function works. Now let's see how multiple input and multiple output neural networks work.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Multiple Input and Output Neural Network works
&lt;/h2&gt;

&lt;p&gt;Until now, we worked with a neural network that had a single input and a single output. In real-world problems, we usually have multiple inputs and multiple outputs.&lt;/p&gt;

&lt;p&gt;In this article, we will build a neural network with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;2 inputs&lt;/strong&gt; (input1 and input2)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;1 hidden layer&lt;/strong&gt; with 2 neurons&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;3 outputs&lt;/strong&gt; (output1, output2, output3)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ReLU&lt;/strong&gt; as the activation function&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Network Structure
&lt;/h2&gt;



&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight plaintext&quot;&gt;&lt;code&gt;input1 &amp;#9472;&amp;#9472;&amp;#9488;
         &amp;#9500;&amp;#9472;&amp;#9472;&amp;#9658; hidden_neuron1 &amp;#9472;&amp;#9472;&amp;#9516;&amp;#9472;&amp;#9472;&amp;#9658; output1
input2 &amp;#9472;&amp;#9472;&amp;#9508;                     &amp;#9500;&amp;#9472;&amp;#9472;&amp;#9658; output2
         &amp;#9492;&amp;#9472;&amp;#9472;&amp;#9658; hidden_neuron2 &amp;#9472;&amp;#9472;&amp;#9524;&amp;#9472;&amp;#9472;&amp;#9658; output3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each input is connected to each hidden neuron, and each hidden neuron is connected to each output neuron.&lt;/p&gt;

&lt;h2&gt;
  
  
  Forward Pass Equations
&lt;/h2&gt;

&lt;p&gt;All weights and biases are assigned based on normal distribution.&lt;br&gt;
&lt;strong&gt;Hidden Layer Calculation&lt;/strong&gt;&lt;br&gt;
For &lt;strong&gt;hidden neuron 1&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;x1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;w1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;w2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b1&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;y1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReLU&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For &lt;strong&gt;hidden neuron 2&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;x2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;w3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;input2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;w4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b2&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;y2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReLU&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output Layer Calculation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For &lt;strong&gt;output1&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;output1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;w5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;w6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For &lt;strong&gt;output2&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;output2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;w7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;w8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b4&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For &lt;strong&gt;output3&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;output3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;w9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;w10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Example with Numbers
&lt;/h2&gt;

&lt;p&gt;Let's work through a concrete example.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Given inputs:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;input1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;input2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Assume the following initial weights and biases:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight plaintext&quot;&gt;&lt;code&gt;Hidden layer weights:
  w1 = 0.5,  w2 = -0.3,  b1 = 0.1
  w3 = -0.4, w4 = 0.8,   b2 = 0.2

Output layer weights:
  w5 = 0.6,  w6 = 0.7,  b3 = 0.1
  w7 = -0.5, w8 = 0.4,  b4 = 0.2
  w9 = 0.3,  w10 = -0.6, b5 = 0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Calculate hidden neuron values&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hidden neuron 1:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;x1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.1&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.9&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.1&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;y1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReLU&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Hidden neuron 2:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;x2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.8&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;2.4&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt;
   &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.8&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;y2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReLU&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.8&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Calculate outputs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output 1:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;output1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.8&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.1&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.12&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.26&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.1&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.48&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output 2:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;output2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.8&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.10&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.72&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.82&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output 3:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;output3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.8&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.0&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.06&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.08&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.0&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.02&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Final Results&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;output1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.48&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;output2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.82&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;output3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;1.02&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why ReLU works here
&lt;/h2&gt;

&lt;p&gt;Notice that x1 = 0.2 and x2 = 1.8 &amp;mdash; both are positive, so ReLU passes them through unchanged. &lt;/p&gt;

&lt;p&gt;If any x value were negative (say x1 = -0.5), then:&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight python&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;y1&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ReLU&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;0.5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That neuron would contribute nothing to the outputs, effectively &quot;turning off&quot; and making the network sparse and efficient.&lt;/p&gt;

&lt;h2&gt;
  
  
  Matrix Representation
&lt;/h2&gt;

&lt;p&gt;You can think of all the weights as a matrix of connections:&lt;br&gt;
&lt;/p&gt;

&lt;div class=&quot;highlight js-code-highlight&quot;&gt;
&lt;pre class=&quot;highlight plaintext&quot;&gt;&lt;code&gt;Hidden Layer (2x2 weight matrix + 2 biases):

  w1   w2   b1        w3   w4   b2
[ 0.5  -0.3  0.1 ]  [ -0.4  0.8  0.2 ]


Output Layer (3x2 weight matrix + 3 biases):

  w5   w6   b3
[ 0.6  0.7  0.1 ]   &amp;rarr; output1

  w7   w8   b4
[-0.5  0.4  0.2 ]   &amp;rarr; output2

  w9  w10   b5
[ 0.3 -0.6  0.0 ]   &amp;rarr; output3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each output neuron learns a different combination of the hidden neuron outputs, allowing the network to produce multiple independent predictions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;We now understand how a neural network with 2 inputs and 3 outputs works step by step using the ReLU activation function:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Each hidden neuron receives all inputs, computes a weighted sum plus bias, and applies ReLU.&lt;/li&gt;
&lt;li&gt;Each output neuron receives all hidden neuron outputs and computes its own weighted sum plus bias.&lt;/li&gt;
&lt;li&gt;The network can produce multiple distinct outputs simultaneously from the same inputs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/HexmosTech/git-lrc&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuphqwcp6bha9ol6pdo3.png&quot; alt=&quot;git-lrc&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Any feedback or contributors are welcome! It's online, source-available, and ready for anyone to use.&lt;/p&gt;

&lt;p&gt;&amp;#11088; &lt;a href=&quot;https://github.com/HexmosTech/git-lrc?utm_source=chatgpt.com&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;Star git-lrc on GitHub&lt;/a&gt;&lt;/p&gt;
</description>
<category>Other</category>
<guid isPermaLink="true">https://coderlegion.com/22513/understanding-multiple-input-and-output-neural-network</guid>
<pubDate>Wed, 15 Jul 2026 13:17:23 +0000</pubDate>
</item>
<item>
<title>Understanding Backpropagation: How Neural Networks Learn from Their Mistakes</title>
<link>https://coderlegion.com/21638/understanding-backpropagation-how-neural-networks-learn-from-their-mistakes</link>
<description>
&lt;h2&gt;
  
  
  From Linear Regression to Gradient Descent
&lt;/h2&gt;

&lt;p&gt;Hello, I'm Ganesh. I'm building &lt;em&gt;git-lrc&lt;/em&gt;, an AI code reviewer that runs on every commit. It is free, unlimited, and source-available on Github. &lt;a href=&quot;https://github.com/HexmosTech/git-lrc?utm_source=chatgpt.com&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;Star git-lrc on GitHub&lt;/a&gt; to help more developers discover the project. Do give it a try and share your feedback for improving the product.&lt;/p&gt;

&lt;p&gt;In previous parts we discussed about linear regression, gradient descent and how to calculate the optimal slope and intercept using Gradient Descent.&lt;/p&gt;

&lt;p&gt;In this article, we'll build an intuition for backpropagation, understand why it is necessary, and explore how the chain rule and gradient descent work together to enable neural network learning.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Backpropagation?
&lt;/h2&gt;

&lt;p&gt;Backpropagation is an algorithm used to train neural networks. &lt;/p&gt;

&lt;p&gt;It is a way to adjust the weights and biases of a neural network to reduce the error between the predicted output and the actual output. &lt;/p&gt;

&lt;p&gt;In simple terms, it is a way for the neural network to learn from its mistakes.&lt;/p&gt;

&lt;p&gt;This learning process is powered by an algorithm called &lt;strong&gt;backpropagation&lt;/strong&gt;, one of the most important concepts in machine learning. Backpropagation provides a systematic way for a neural network to determine which internal parameters contributed to an error and how those parameters should be updated to reduce future mistakes.&lt;/p&gt;

&lt;p&gt;Imagine teaching a student to solve math problems. &lt;/p&gt;

&lt;p&gt;After each attempt, you compare the student's answer with the correct one, identify where mistakes occurred, and provide feedback. Over time, the student adjusts their approach and improves. Backpropagation works in a similar way: the network makes a prediction, calculates the error, traces that error backward through the network, and updates its parameters accordingly.&lt;/p&gt;

&lt;p&gt;At its core, backpropagation combines two fundamental mathematical ideas:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The Chain Rule&lt;/strong&gt; from calculus, which helps determine how changes in one part of the network affect the final error.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gradient Descent&lt;/strong&gt;, an optimization technique that uses those calculations to update the network's parameters in the direction that reduces error.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;By repeatedly answering these questions across thousands or millions of training examples, neural networks gradually learn patterns hidden within data and become increasingly accurate.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/HexmosTech/git-lrc&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnuphqwcp6bha9ol6pdo3.png&quot; alt=&quot;git-lrc&quot; width=&quot;360&quot; height=&quot;540&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Any feedback or contributors are welcome! It&amp;rsquo;s online, source-available, and ready for anyone to use.&lt;/p&gt;

&lt;p&gt;&amp;#11088; &lt;a href=&quot;https://github.com/HexmosTech/git-lrc?utm_source=chatgpt.com&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;Star git-lrc on GitHub&lt;/a&gt;&lt;/p&gt;
</description>
<category>Other</category>
<guid isPermaLink="true">https://coderlegion.com/21638/understanding-backpropagation-how-neural-networks-learn-from-their-mistakes</guid>
<pubDate>Sun, 05 Jul 2026 07:23:45 +0000</pubDate>
</item>
<item>
<title>Introduction to Neural Networks</title>
<link>https://coderlegion.com/18993/introduction-to-neural-networks</link>
<description>
&lt;p&gt;Hello, I'm Ganesh. I'm building &lt;em&gt;git-lrc&lt;/em&gt;, a free, micro AI code review that runs on commit. It is free, and source-available on GitHub. &lt;a href=&quot;https://github.com/HexmosTech/git-lrc&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;Star Us&lt;/a&gt; to help devs discover the project. Do give it a try and share your feedback for improving the product.&lt;/p&gt;

&lt;p&gt;In this series of articles, we will explore the world of neural networks and how they work.&lt;/p&gt;

&lt;p&gt;In this article, we will discuss the fundamental idea of neural networks.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Neural Network?
&lt;/h2&gt;

&lt;p&gt;A neural network is a computational model that is inspired by the structure and function of the human brain.&lt;/p&gt;

&lt;p&gt;It is widely used in many fields like image recognition, natural language processing, etc.&lt;br&gt;
It is most popular machine learning algorithm.&lt;/p&gt;

&lt;p&gt;Simplest image of a Neural Network is : &lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhaprkizrj1f1xwo02kkj.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhaprkizrj1f1xwo02kkj.png&quot; alt=&quot;&quot; width=&quot;330&quot; height=&quot;397&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Neural Networks Manily Do?
&lt;/h2&gt;

&lt;p&gt;It tries to approximate the function of the given input and map it to the output.&lt;/p&gt;

&lt;p&gt;In simple terms, it tries to learn the relationship between the input and output. It approximates the output based on the input data.&lt;/p&gt;

&lt;p&gt;This will be be done with basic mathematical functions which totaly changes based on the data we provided.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;Let's take example of Drug which can cure illness.&lt;/p&gt;

&lt;p&gt;Now let's split the gruop of people based on dosage of drug they consume.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Low dosage: Group A&lt;/li&gt;
&lt;li&gt;Medium dosage: Group B&lt;/li&gt;
&lt;li&gt;High dosage: Group C&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Most Commonly Gruop results may be ploted as this in the graph.&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftg23g1z0ntul0hi07cs1.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftg23g1z0ntul0hi07cs1.png&quot; alt=&quot;&quot; width=&quot;800&quot; height=&quot;667&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To predict the efficacy of the dosage of drug we can't simply use simple straight line or normal distribution.&lt;/p&gt;

&lt;p&gt;As for example I ploted this graph for understaning on how it is done.&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5olh58w96ga2ebnxc943.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5olh58w96ga2ebnxc943.png&quot; alt=&quot;&quot; width=&quot;800&quot; height=&quot;667&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is where nerual network will help.&lt;/p&gt;

&lt;p&gt;If we have data points in different location it will find and draw a line to predict the values between the points.&lt;/p&gt;

&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgjwhimdcs5lawom60bb7.png&quot; class=&quot;article-body-image-wrapper&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgjwhimdcs5lawom60bb7.png&quot; alt=&quot;&quot; width=&quot;800&quot; height=&quot;667&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By above graph we can able to understand what neural network can do.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Neural Network is the best tool to fit the data points which are scattered with curve which we can use it to predict the values in between the data points.&lt;/p&gt;

&lt;p&gt;We got to know with basic example what it actualy do.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/HexmosTech/git-lrc&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;&lt;img src=&quot;https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fabn6nl3iehrohehnxgje.png&quot; alt=&quot;git-lrc&quot; width=&quot;800&quot; height=&quot;373&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Any feedback or contributors are welcome! It&amp;rsquo;s online, source-available, and ready for anyone to use. &lt;br&gt;
&amp;#11088; Star it on GitHub: &lt;a href=&quot;https://github.com/HexmosTech/git-lrc&quot; rel=&quot;noopener noreferrer nofollow&quot;&gt;https://github.com/HexmosTech/git-lrc&lt;/a&gt;&lt;/p&gt;


</description>
<category>Other</category>
<guid isPermaLink="true">https://coderlegion.com/18993/introduction-to-neural-networks</guid>
<pubDate>Sun, 31 May 2026 18:12:12 +0000</pubDate>
</item>
<item>
<title>Spectral Stability and Amplification Propagation in Interacting Agent Networks: (CAIT Part=4)</title>
<link>https://coderlegion.com/18077/spectral-stability-and-amplification-propagation-interacting-agent-networks-cait-part</link>
<description>&lt;p&gt;I donot want to bore anyone with technical details. IN short i can say THIS IS A FATHER of ALL RESEARCH PAPERS EVER PRODUCED! People generally do this much in their life time, Dedicated to all who are connected to me in any capacity. Thank you!&lt;/p&gt;
&lt;h2 id=&quot;1-global-operator-model&quot;&gt;1. Global Operator Model&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
A single mathematical engine that describes how all agents (humans + AI) influence each other.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Lets you model organization‑wide behavior (e.g., productivity, risk, misinformation spread) as one system instead of isolated departments.&lt;/p&gt;
&lt;h2 id=&quot;2-kronecker-jacobian-network-local-dynamics-&quot;&gt;2. Kronecker Jacobian (Network × Local Dynamics)&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
Separates what comes from individual behavior vs. what comes from the network structure.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Helps leaders see whether a problem is caused by:&lt;/p&gt;
&lt;p&gt;individual performance&lt;/p&gt;
&lt;p&gt;team structure&lt;/p&gt;
&lt;p&gt;communication patterns&lt;/p&gt;
&lt;p&gt;AI‑human interaction loops&lt;/p&gt;
&lt;p&gt;This is the math behind root‑cause analysis at scale.&lt;/p&gt;
&lt;h2 id=&quot;3-spectral-stability-law&quot;&gt;3. Spectral Stability Law&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
Stability = whether small problems die out or grow.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Predicts when:&lt;/p&gt;
&lt;p&gt;a rumor becomes a crisis&lt;/p&gt;
&lt;p&gt;a productivity issue becomes systemic&lt;/p&gt;
&lt;p&gt;a small AI error cascades across teams&lt;/p&gt;
&lt;p&gt;This is early‑warning detection for organizational instability.&lt;/p&gt;
&lt;h2 id=&quot;4-critical-coupling-law&quot;&gt;4. Critical Coupling Law&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
There is a threshold where interactions become “too connected” and the system destabilizes.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Shows when:&lt;/p&gt;
&lt;p&gt;too much collaboration slows the company&lt;/p&gt;
&lt;p&gt;too much AI‑automation creates fragility&lt;/p&gt;
&lt;p&gt;too many dependencies create bottlenecks&lt;/p&gt;
&lt;p&gt;This is the math behind optimal team size, optimal communication density, and optimal AI integration.&lt;/p&gt;
&lt;h2 id=&quot;5-fixed-point-equilibrium-theory&quot;&gt;5. Fixed‑Point Equilibrium Theory&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
Describes the long‑run steady state of the organization.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Predicts:&lt;/p&gt;
&lt;p&gt;the stable productivity level&lt;/p&gt;
&lt;p&gt;the stable inequality level&lt;/p&gt;
&lt;p&gt;the stable AI‑human workload distribution&lt;/p&gt;
&lt;p&gt;This is the math behind forecasting and scenario planning.&lt;/p&gt;
&lt;h2 id=&quot;6-heterogeneity-propagation&quot;&gt;6. Heterogeneity Propagation&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
Small differences between people or teams get amplified by the network.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Explains why:&lt;/p&gt;
&lt;p&gt;small skill gaps become large performance gaps&lt;/p&gt;
&lt;p&gt;minor misinformation becomes major divergence&lt;/p&gt;
&lt;p&gt;small AI‑tool differences create large outcome differences&lt;/p&gt;
&lt;p&gt;This is the math behind inequality, polarization, and performance divergence.&lt;/p&gt;
&lt;h2 id=&quot;7-topology-driven-bifurcation&quot;&gt;7. Topology‑Driven Bifurcation&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
The network can suddenly shift from “everyone similar” to “teams behaving very differently.”&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Predicts tipping points such as:&lt;/p&gt;
&lt;p&gt;sudden culture fragmentation&lt;/p&gt;
&lt;p&gt;sudden productivity divergence&lt;/p&gt;
&lt;p&gt;sudden AI‑adoption gaps&lt;/p&gt;
&lt;p&gt;This is the math behind organizational tipping points.&lt;/p&gt;
&lt;h2 id=&quot;8-perturbation-expansions&quot;&gt;8. Perturbation Expansions&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
You can compute how small changes affect the whole system.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Allows sensitivity analysis:&lt;/p&gt;
&lt;p&gt;“If we increase AI usage by 5%, what happens?”&lt;/p&gt;
&lt;p&gt;“If we reduce communication load by 10%, does stability improve?”&lt;/p&gt;
&lt;p&gt;This is the math behind policy simulation and optimization.&lt;/p&gt;
&lt;h2 id=&quot;9-spectral-shift-formula&quot;&gt;9. Spectral Shift Formula&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
Quantifies exactly how network structure changes stability.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Lets you redesign:&lt;/p&gt;
&lt;p&gt;reporting lines&lt;/p&gt;
&lt;p&gt;communication flows&lt;/p&gt;
&lt;p&gt;AI‑tool integration patterns&lt;/p&gt;
&lt;p&gt;to make the organization more stable.&lt;/p&gt;
&lt;h2 id=&quot;10-inequality-curvature-functional&quot;&gt;10. Inequality Curvature Functional&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
Measures how inequality grows as the system becomes unstable.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Predicts:&lt;/p&gt;
&lt;p&gt;when skill inequality will accelerate&lt;/p&gt;
&lt;p&gt;when AI‑tool inequality will widen&lt;/p&gt;
&lt;p&gt;when performance gaps will explode&lt;/p&gt;
&lt;p&gt;This is the math behind DEI risk, talent management, and fairness analysis.&lt;/p&gt;
&lt;h2 id=&quot;11-stability-margin-reduction-law&quot;&gt;11. Stability Margin Reduction Law&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
Networks always reduce stability unless carefully designed.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Explains why:&lt;/p&gt;
&lt;p&gt;fast‑moving companies become fragile&lt;/p&gt;
&lt;p&gt;hyper‑connected teams burn out&lt;/p&gt;
&lt;p&gt;AI‑heavy workflows collapse under stress&lt;/p&gt;
&lt;p&gt;This is the math behind organizational resilience.&lt;/p&gt;
&lt;h2 id=&quot;12-universal-spectral-law&quot;&gt;12. Universal Spectral Law&lt;/h2&gt;
&lt;p&gt;Meaning:&lt;br&gt;
All phenomena — stability, inequality, bifurcation, synchronization — come from one spectral mechanism.&lt;/p&gt;
&lt;p&gt;Business usefulness:&lt;br&gt;
Gives leaders a single unifying framework to understand:&lt;/p&gt;
&lt;p&gt;productivity&lt;/p&gt;
&lt;p&gt;risk&lt;/p&gt;
&lt;p&gt;inequality&lt;/p&gt;
&lt;p&gt;AI‑human interaction&lt;/p&gt;
&lt;p&gt;organizational design&lt;/p&gt;
&lt;p&gt;This is the math behind enterprise‑wide decision intelligence.&lt;/p&gt;
&lt;p&gt;Ultra‑Short Version (MBA‑level)&lt;br&gt;
Your paper gives a business leader the ability to:&lt;/p&gt;
&lt;p&gt;predict when systems become unstable&lt;/p&gt;
&lt;p&gt;detect early warning signals&lt;/p&gt;
&lt;p&gt;understand how small issues scale&lt;/p&gt;
&lt;p&gt;design better teams and workflows&lt;/p&gt;
&lt;p&gt;manage AI‑human interactions safely&lt;/p&gt;
&lt;p&gt;prevent inequality and performance divergence&lt;/p&gt;
&lt;p&gt;optimize communication and collaboration&lt;/p&gt;
&lt;p&gt;simulate organizational scenarios&lt;/p&gt;
&lt;p&gt;It is essentially a mathematical engine for organizational strategy, risk, and AI governance.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://explore.openaire.eu/search/result?pid=10.5281%2Fzenodo.20228867&quot;&gt;https://explore.openaire.eu/search/result?pid=10.5281/zenodo.20228867&lt;/a&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/18077/spectral-stability-and-amplification-propagation-interacting-agent-networks-cait-part</guid>
<pubDate>Sat, 16 May 2026 09:08:32 +0000</pubDate>
</item>
<item>
<title>How a Browser Works: A Beginner-Friendly Guide to Browser Internals</title>
<link>https://coderlegion.com/12834/how-a-browser-works-a-beginner-friendly-guide-to-browser-internals</link>
<description>&lt;h3 id=&quot;introduction-a-simple-action-a-complex-story&quot;&gt;Introduction: A Simple Action, a Complex Story&lt;/h3&gt;
&lt;p&gt;You type a URL.&lt;br&gt;
You press Enter.&lt;br&gt;
A webpage appears.&lt;/p&gt;
&lt;p&gt;It feels instant. Effortless.&lt;/p&gt;
&lt;p&gt;Nothing special, right?!!&lt;/p&gt;
&lt;p&gt;But under the hood, that single key press triggers a carefully coordinated chain of events involving networking, parsing, layout calculations, and rendering logic — all happening in &lt;em&gt;milliseconds or maybe less than that&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Most beginners assume a browser’s job is simple: “&lt;strong&gt;It opens websites&lt;/strong&gt;.”&lt;/p&gt;
&lt;p&gt;That’s not wrong — but it’s wildly incomplete.&lt;/p&gt;
&lt;p&gt;A browser is not just a viewer. It’s a system (or maybe we can say equivalent to an &lt;strong&gt;Operating System&lt;/strong&gt; itself). The one that &lt;strong&gt;fetches files, understands languages like HTML and CSS, converts text into structured data, calculates layouts, and finally paints pixels onto your screen&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In this guide, we’ll slow down that moment.&lt;/p&gt;
&lt;p&gt;We won’t dive into specifications.&lt;br&gt;
We won’t memorize components.&lt;br&gt;
We’ll follow a story — from typing a URL to seeing the pixels.&lt;/p&gt;
&lt;p&gt;When you press Enter, the browser doesn’t jump straight to drawing the page.&lt;br&gt;
It follows a pipeline — a sequence of steps — where each stage prepares data for the next.&lt;/p&gt;
&lt;p&gt;Let’s break that system down, and by the end, browsers will feel less like magic and more like &lt;strong&gt;well-designed machines&lt;/strong&gt; doing exactly what they’re supposed to do.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-is-a-browser-really-&quot;&gt;What Is a Browser, Really?&lt;/h3&gt;
&lt;p&gt;At a high level, a browser is a platform that does four core jobs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Provides a user interface (tabs, address bar, buttons)&lt;/li&gt;
&lt;li&gt;Fetches resources from the network&lt;/li&gt;
&lt;li&gt;Understands web languages (HTML, CSS, JavaScript)&lt;/li&gt;
&lt;li&gt;Converts those instructions into pixels on your screen&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Think of a browser like a restaurant:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The menu and tables are what you interact with&lt;/li&gt;
&lt;li&gt;The kitchen processes raw ingredients.&lt;/li&gt;
&lt;li&gt;The chefs follow instructions.&lt;/li&gt;
&lt;li&gt;The final dish is what gets served.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The important takeaway:&lt;br&gt;
&lt;strong&gt;A browser is a software application, a collection of cooperating components that is used to translate HTML into visual data, not a single program.&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;main-parts-of-a-browser&quot;&gt;Main Parts of a Browser&lt;/h3&gt;
&lt;p&gt;Here are the major players within the browsers:&lt;/p&gt;
&lt;h4 id=&quot;user-interface&quot;&gt;User Interface&lt;/h4&gt;
&lt;p&gt;Whatever you see in the browser except the window where the web page is rendered, is known as the UI of browser. The address bar, tabs, refresh button, back button — these are part of the &lt;strong&gt;browser’s control panel&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;What’s important to understand is this:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The UI doesn’t render websites.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It simply &lt;strong&gt;accepts your input&lt;/strong&gt; and hands off the real work to other components.&lt;/p&gt;
&lt;p&gt;When you type a URL and press Enter, the UI says:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;“Here’s the request. Handle it.”&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h4 id=&quot;browser-engine-&quot;&gt;Browser engine:&lt;/h4&gt;
&lt;p&gt;Browsers engine is the brain of the browser. It manages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Navigation: Back &amp;amp; Forth, the reloads&lt;/li&gt;
&lt;li&gt;Communication: Managing the flow between the UI layer &amp;amp; disk storage.&lt;/li&gt;
&lt;li&gt;Session management: it keeps track of sessions (from start to end), state across different tabs.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Example: Trident(Internet Explorer, Edge), Blink(Chrome, Opera, Brave), Webkit(Apple's Safari), Gecko(Firefox) etc.&lt;/p&gt;
&lt;h4 id=&quot;rendering-engine&quot;&gt;Rendering engine&lt;/h4&gt;
&lt;p&gt;The rendering engine is responsible to make HTML content visible.&lt;br&gt;
Rendering engine does the most heavy tasks like creating the DOM, CSSOM using parser, render tree, reflows, paint.&lt;/p&gt;
&lt;p&gt;It listen the commands of the browser engine like reload, refresh etc.&lt;/p&gt;
&lt;h4 id=&quot;networking&quot;&gt;Networking&lt;/h4&gt;
&lt;p&gt;Once the browser engine receives your URL, it asks the networking layer to fetch resources. It handles the DNS resolutions, request data from server using http/https&lt;/p&gt;
&lt;p&gt;Then, the browser requests for:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTML files&lt;/li&gt;
&lt;li&gt;CSS files&lt;/li&gt;
&lt;li&gt;Images, fonts, and more&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;At this stage, the browser doesn’t care how anything looks.&lt;br&gt;
It’s just collecting raw materials.&lt;/p&gt;
&lt;h4 id=&quot;js-interpreter&quot;&gt;JS Interpreter&lt;/h4&gt;
&lt;p&gt;This is the main layer that is responnsible to interpret and parse the JavaScript codes. Some JS engines are V8(used by NodeJS), SpiderMonkey(used by Mozilla Foundation; Firefox), JavaScriptCore(used by Apple, Bun), Chakra(Used by Microsoft Edge) etc.&lt;/p&gt;
&lt;h4 id=&quot;ui-backend&quot;&gt;UI backend&lt;/h4&gt;
&lt;p&gt;UI backend does the actual work of displaying the HTML content in the browser by lighting up the pixels and setting up the respective backends like what will happen after clicking on &quot;About&quot; button will be set up by thhis llayer.&lt;/p&gt;
&lt;p&gt;Rendering engine creates layout (reflow) and then in the paint process creates instructions and give it to UI backend.&lt;/p&gt;
&lt;h4 id=&quot;disk-api&quot;&gt;Disk API&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;It is used to save data into Browser cache, cookies, local storage, session storage etc.&lt;/li&gt;
&lt;li&gt;It also writes data into your computer's browser folder using some internal method.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is the high level overview of the browser components that what each component is responsible for.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fsbw8luokmy9o4z4joak.png&quot; alt=&quot;Browser Internals&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;how-browser-actually-works-&quot;&gt;How Browser Actually works?&lt;/h3&gt;
&lt;p&gt;Now, let's deep dive into how the components work together to render a website. I will again start with the same question: &lt;strong&gt;what happens when we write an URL on the address bar and Enter?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As you press Enter after entering URL:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The browser engine commands the networking layer for DNS resolution.&lt;/li&gt;
&lt;li&gt;The networking layer finds the IP address of the server, then a handshake connection is established. After connecting to the server, networking layer requests data using HTTP or HTTPs.&lt;/li&gt;
&lt;li&gt;As the first packet of data is recieved, networking layer sends the packet to the rendering engine.&lt;/li&gt;
&lt;li&gt;Now the rendering engine sends HTML codes to tokenizer to covert codes to tokens and then parse the HTML codes.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now, it’s clear how data is fetched to browser after entering the URL. Now we are going to deep dive into how the HTML and CSS are getting passed, how the reflux is generated, and ultimately how that display comes in front of us. &lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fas2fanc5chbrn7j2ybr.png&quot; alt=&quot;Browser Workings&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;html-parsing-from-text-to-dom&quot;&gt;HTML Parsing: From Text to DOM&lt;/h4&gt;
&lt;p&gt;HTML arrives as plain text.&lt;br&gt;
The browser doesn’t see “headings” or “sections” yet — it sees characters.&lt;/p&gt;
&lt;p&gt;So it parses the HTML:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Reads it token by token&lt;/li&gt;
&lt;li&gt;Understands tags and nesting&lt;/li&gt;
&lt;li&gt;Builds a structured representation called the &lt;strong&gt;DOM&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;What Is the DOM?&lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Document Object Model (DOM)&lt;/strong&gt; is a tree-like structure where:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Each HTML element becomes a node&lt;/li&gt;
&lt;li&gt;Parent-child relationships are preserved&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Think of the DOM as a family tree of elements.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u119z1ucsmv4ae068r3q.gif&quot; alt=&quot;DOM&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;css-parsing-from-styles-to-cssom&quot;&gt;CSS Parsing: From Styles to CSSOM&lt;/h4&gt;
&lt;p&gt;CSS also starts as text.&lt;br&gt;
The browser parses CSS into another structure called the &lt;strong&gt;CSSOM (CSS Object Model)&lt;/strong&gt;.&lt;br&gt;
This structure stores:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Selectors&lt;/li&gt;
&lt;li&gt;Properties&lt;/li&gt;
&lt;li&gt;Values&lt;/li&gt;
&lt;li&gt;Cascading and inheritance rules&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Important note:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The CSSOM doesn’t decide positions — it only defines how things should look.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/17bara5hdmlvc7gy36nc.png&quot; alt=&quot;CSSOM&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;content-sink-dom-mutation-observer&quot;&gt;Content Sink / DOM mutation observer&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;You can think content sink as the &lt;strong&gt;collector and dispatcher&lt;/strong&gt;. As the DOM nodes are parsed, it gets the reference of that node and sends that to the render engine to build the render tree.&lt;/li&gt;
&lt;li&gt;Content sink is also known as DOM Mutation Observer because as the DOM gets updates, it observes that and the render tree is built again.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;dom-cssom-render-tree&quot;&gt;DOM + CSSOM → Render Tree&lt;/h4&gt;
&lt;p&gt;Now the browser has:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Structure (&lt;strong&gt;DOM&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;Styling rules (&lt;strong&gt;CSSOM&lt;/strong&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It merges them into the &lt;strong&gt;Render Tree / Visual Tree&lt;/strong&gt;. The render tree:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Contains only visible elements&lt;/li&gt;
&lt;li&gt;Includes computed styles&lt;/li&gt;
&lt;li&gt;Is optimized for layout and painting&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can think of it as:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;The DOM dressed in CSS, ready to be drawn.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hogjuj5528pdijxl7o6d.png&quot; alt=&quot;Render Tree Generation&quot;&gt;&lt;/p&gt;
&lt;p&gt;Now we have completed an important checkpoint of creating a render tree. Now, we are in the final step where the browser will use render tree nodes and display them in the browser. Here are the further steps:&lt;/p&gt;
&lt;h4 id=&quot;frame-construction&quot;&gt;Frame Construction&lt;/h4&gt;
&lt;p&gt;After the render tree is created, the browser constructs &lt;strong&gt;frames&lt;/strong&gt;. Frames do not calculate the final size or position of elements. Instead, they define how each render tree node participates in &lt;strong&gt;layout&lt;/strong&gt;—whether it behaves as a block, inline, flex item, or grid item, and how it interacts with surrounding elements.&lt;/p&gt;
&lt;p&gt;The browser must &quot;re-construct&quot; this frame up to 60 times per second so that scrolling, animations, and interactions feel smooth rather than static.&lt;/p&gt;
&lt;h4 id=&quot;reflow-frame-tree-&quot;&gt;Reflow (Frame Tree)&lt;/h4&gt;
&lt;p&gt;This is the step where the browser calculates the width, length and the positions (x-axis &amp;amp; y-axis), margin, padding etc. This is the &lt;strong&gt;highest computational task performed by a browser&lt;/strong&gt; in this process.&lt;/p&gt;
&lt;p&gt;It takes the frames, viewport size as input and enables geometry to each frame. In simple terms, it &lt;strong&gt;creates the layout of website&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;paint&quot;&gt;Paint&lt;/h4&gt;
&lt;p&gt;This is the second last step of rendering the website. It translate frames layout into paint instructions. In simple words, it creates the instruction for the UI backend.&lt;/p&gt;
&lt;h4 id=&quot;ui-backend-1&quot;&gt;UI Backend&lt;/h4&gt;
&lt;p&gt;Now at the end, UI Backend comes into the picture and talk with your OS graphics API to lights up the pixels in the screen and decides how the behind-the-scenes should actually go on.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;conclusion-browsers-aren-t-magic-they-re-engineering&quot;&gt;Conclusion: Browsers Aren’t Magic — They’re Engineering&lt;/h3&gt;
&lt;p&gt;Browsers feel effortless because they’re incredibly well designed.&lt;/p&gt;
&lt;p&gt;They hide complexity behind clean interfaces, parallel processes, and optimized pipelines. What looks like “instant loading” is actually thousands of small, precise decisions executed at high speed.&lt;/p&gt;
&lt;p&gt;As a beginner, you don’t need to remember every component or step.&lt;br&gt;
What matters is understanding that:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Browsers parse, they don’t guess&lt;/li&gt;
&lt;li&gt;They build structures before drawing&lt;/li&gt;
&lt;li&gt;Rendering is a process, not a single action&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The next time you press Enter, you’ll know:&lt;br&gt;
&lt;em&gt;how a system just went to work — and did exactly what it was built to do&lt;/em&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;Follow for more beginner-friendly breakdowns of core software engineering concepts.&lt;/em&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/12834/how-a-browser-works-a-beginner-friendly-guide-to-browser-internals</guid>
<pubDate>Fri, 13 Mar 2026 12:34:31 +0000</pubDate>
</item>
<item>
<title>DNS Explained: How the Internet Finds Websites</title>
<link>https://coderlegion.com/12833/dns-explained-how-the-internet-finds-websites</link>
<description>&lt;h3 id=&quot;introduction-how-does-a-browser-know-where-a-website-lives-&quot;&gt;Introduction: How Does a Browser Know Where a Website Lives?&lt;/h3&gt;
&lt;p&gt;When you type &lt;code&gt;google.com&lt;/code&gt; into your browser, something interesting happens behind the scenes.&lt;br&gt;
Your browser doesn’t magically know where Google lives on the internet. &lt;strong&gt;It doesn’t even understand names like google.com at all&lt;/strong&gt;.&lt;br&gt;
What it understands are numbers—IP addresses like &lt;code&gt;142.250.190.14&lt;/code&gt;. So the real question becomes:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;How does a human-friendly name turn into a machine-friendly address?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;All these translation job is handled by &lt;strong&gt;&lt;em&gt;DNS&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-is-this-dns-&quot;&gt;What is this DNS?&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Domain Name System&lt;/strong&gt; (DNS) is the &lt;em&gt;phonebook of the Internet&lt;/em&gt;. What happens in phonebook? By this you remember people by names, phones connect using numbers. Humans access information online through domain names, like &lt;code&gt;google.com&lt;/code&gt; or &lt;code&gt;chaicode.com&lt;/code&gt;. Web browsers interact through Internet Protocol (IP) addresses. DNS translates domain names (example.com) to IP addresses (ex: 93.184.216.34) so browsers can load Internet resources.&lt;/p&gt;
&lt;p&gt;DNS works using the &lt;strong&gt;distributed hierarchical structure of servers&lt;/strong&gt;.&lt;br&gt;
Now the question is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;How does it actually work in our fingertips??
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Let's find out this in our next section.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;how-does-dns-work-&quot;&gt;How does DNS work?&lt;/h3&gt;
&lt;p&gt;When we search something in the browser's address bar, the browser does not know where the requested content exists. What do we do when we lose our way in a new place to reach our destination? We ask questions. Browsers do exactly that. They ask someone the address of the requested content, and that someone is DNS and the request is called a DNS Query. This DNS query can be broken down into several steps, ensuring that users can access websites by simply typing a domain name into their browser. The DNS resolution works recursively.&lt;br&gt;
The main motto of DNS is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Who should I talk to next?
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Everything in DNS is working based on this question. You are going to findout soon.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;User Input&lt;/strong&gt;: You enter a website address (for example, &lt;code&gt;chaicode.com&lt;/code&gt;) into your web browser's address bar.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Local Cache Check&lt;/strong&gt;: Your browser first checks its local cache to see if it has recently looked up the domain. It gets stored due to the DNS caching; DNS caching is a mechanism that stores DNS records locally to avoid querying external DNS servers repeatedly for the same information. This speeds up the browsing experience and reduces network traffic. If it finds the corresponding IP address, it uses that directly without querying external servers. And if it doesn't find it then it will move to the next step.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DNS Resolver Query&lt;/strong&gt;: If the IP address isn’t in the local cache, your browser sends the request to the DNS resolver. The resolver is typically provided by your Internet Service Provider (ISP) or by your Router.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Root DNS Server&lt;/strong&gt;: The DNS resolver sends the request to a root DNS server. There are in total &lt;strong&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.iana.org/domains/root/servers&quot;&gt;13 root Name Server&lt;/a&gt;&lt;/strong&gt; around the world, but thanks to &lt;em&gt;Anycast IP Addressing&lt;/em&gt;, which allows multiple physical severs to share the same IP, the total instances of Root Servers are &lt;strong&gt;more than 1700&lt;/strong&gt;. The root server doesn’t know the exact IP address for &lt;code&gt;chaicode.com&lt;/code&gt; but knows which Top-Level Domain (TLD) server to query based on the domain’s extension.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;TLD Server&lt;/strong&gt;: TLD stands for Top-Level-Domain, these servers manage domain extensions like .com, .org, .net, .edu, .gov and others. The TLD server for .com directs the resolver to the authoritative DNS server for &lt;code&gt;chaicode.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Authoritative DNS Server&lt;/strong&gt;: This server holds the actual DNS records for chaicode.com, including the IP address of the website’s server. There are many popular Authoritative DNS Servers around the world like: Cloudflare, Vercel, Netlify, Digital Ocean, Hostinger, Namecheap, Godaddy etc. It sends this IP address back to the resolver.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Final Response&lt;/strong&gt;: The DNS resolver sends the IP address to your browser, allowing it to connect to the website’s server and load the page. Besides that for future reference, the IP address gets stored in the local cache.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/omhkz6ki0504h5jfb4ds.png&quot; alt=&quot;How DNS Works&quot;&gt;&lt;/p&gt;
&lt;p&gt;So here we can see that every server is actually telling the DNS resolver that &lt;strong&gt;who should it talk to next to get more information&lt;/strong&gt;. That's why the resolver is often referred as &lt;strong&gt;&lt;em&gt;Recursive DNS Resolver&lt;/em&gt;&lt;/strong&gt;.&lt;br&gt;
If this feels like overwhelming, that’s okay. The key idea to remember is simple: &lt;em&gt;DNS keeps asking the next right server until it finds the final answer&lt;/em&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-and-why-the-dns-records&quot;&gt;What and Why the DNS Records&lt;/h3&gt;
&lt;p&gt;DNS records (aka zone files) are instructions that live in &lt;strong&gt;authoritative DNS servers&lt;/strong&gt; and provide information about a domain including &lt;strong&gt;what IP address is associated with that domain&lt;/strong&gt; and &lt;strong&gt;how to handle requests&lt;/strong&gt; for that domain. These records consist of a series of text files written in what is known as DNS syntax. DNS syntax is just a string of characters used as commands that tell the DNS server &lt;em&gt;what to do&lt;/em&gt;. All DNS records also have a ‘TTL’, which stands for time-to-live, which means how long a DNS record is cached before it expires. When the TTL expires, the cache is cleared and a fresh DNS query must be made.&lt;br&gt;
But before diving into individual DNS records, let’s look at how they all work together for a single website.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/si1s95nskbxqgd211gba.png&quot; alt=&quot;All DNS Records&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;most-common-types-of-dns-records&quot;&gt;Most common types of DNS records&lt;/h3&gt;
&lt;p&gt;DNS management relies on DNS server connections. Knowing how your DNS servers interact with each other via DNS records will make managing your DNS a less daunting task.&lt;/p&gt;
&lt;p&gt;The most common types of DNS records are:&lt;/p&gt;
&lt;h4 id=&quot;a-record&quot;&gt;A Record&lt;/h4&gt;
&lt;p&gt;Address records, or A records, are the most common DNS records used. They create a direct connection between an &lt;strong&gt;IPv4 address&lt;/strong&gt; and a domain name. IPv4 addresses have the following format: 93.184.216.34. This is the simplest record and this is the last cycle of a DNS query means the resolver looks for this record as its target. A record solves one simple problem: once DNS is done asking questions, this is the final answer it needs to reach the website. This is the most important IP also, because depending on this all the traffics would be sent to the server's machine. Example:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Domain        &lt;/th&gt;&lt;th&gt;Record &lt;/th&gt;&lt;th&gt;Value     &lt;/th&gt;&lt;th&gt;TTL&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;example.com   &lt;/td&gt;&lt;td&gt;A           &lt;/td&gt;&lt;td&gt;192.0.2.1 &lt;/td&gt;&lt;td&gt;14400&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id=&quot;aaaa-record&quot;&gt;AAAA Record&lt;/h4&gt;
&lt;p&gt;Same job as A records, but this type of record connects domain names to &lt;strong&gt;IPv6 addresses&lt;/strong&gt; (8 groups of 4 hexadecimal digits). IPv6 addresses have more numerals than IPv4 address and are becoming more common as options for IPv4 addresses are running out. Example:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Domain        &lt;/th&gt;&lt;th&gt;Record &lt;/th&gt;&lt;th&gt;Value     &lt;/th&gt;&lt;th&gt;TTL&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;@   &lt;/td&gt;&lt;td&gt;AAAA          &lt;/td&gt;&lt;td&gt;2606:2800:220:1:248:1893:25c8:1946 &lt;/td&gt;&lt;td&gt;14400&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The &quot;@&quot; symbol in this example indicates that this is a record for the root domain.&lt;/p&gt;
&lt;h4 id=&quot;cname-record&quot;&gt;CNAME Record&lt;/h4&gt;
&lt;p&gt;Canonical name records, or CNAME records, direct an alias domain to a canonical domain. This means that the CNAME record stores another domain and the A record of that domain would be the value of the former. This type of record is used to link subdomains to domain A or AAAA records. It answers the question:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;“This name is just an alias—what is the real name?”
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For example, instead of creating two A records for www.example.com and product.example.com, you could link product.example.com &amp;amp; www.example.com to a CNAME record that is then linked to an A record for example.com. The value is that if the IP address changes for the root domain, only the A record will have to be updated and the CNAME will update accordingly.&lt;br&gt;
For example:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Record        &lt;/th&gt;&lt;th&gt;Host &lt;/th&gt;&lt;th&gt;Value     &lt;/th&gt;&lt;th&gt;TTL&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;CNAME   &lt;/td&gt;&lt;td&gt;blog.piyushgarg.dev        &lt;/td&gt;&lt;td&gt;hashnode.network &lt;/td&gt;&lt;td&gt;10400&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;A &lt;/td&gt;&lt;td&gt;hashnode.network        &lt;/td&gt;&lt;td&gt;76.76.21.21 &lt;/td&gt;&lt;td&gt;10400&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/90sjx44li1yjmb2i7vgi.png&quot; alt=&quot;CNAME Record working&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;ns-record&quot;&gt;NS Record&lt;/h4&gt;
&lt;p&gt;The most important DNS record from the list. Nameserver, or NS records, show which DNS server is responsible for managing the DNS Queries and acting as the authoritative nameserver for your domain. Authoritative nameservers contain the final information about a specific domain and its corresponding IP address. An NS record points to all of the different records your domain holds. A domain often has multiple NS records which can indicate primary and secondary nameservers for that domain. Without NS records, users will not be able to access your website.&lt;br&gt;
By querying the NS record value, we will get the A record of a DNS server i.e, an IP of that DNS server which is storing our needed website details and after querying that server's IP we will get the IP address of the desired website.&lt;br&gt;
NS records don’t point to your website. They point to the DNS servers that know the answers about your website.&lt;/p&gt;
&lt;p&gt;Here is an example of an NS record:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;example.com      &lt;/th&gt;&lt;th&gt;Record &lt;/th&gt;&lt;th&gt;Value     &lt;/th&gt;&lt;th&gt;TTL&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;@   &lt;/td&gt;&lt;td&gt;NS        &lt;/td&gt;&lt;td&gt;pns1.exampleserver.com &lt;/td&gt;&lt;td&gt;20400&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Note that NS records can never point to a canonical name (CNAME) record.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5e400ewo9x81waii9a7c.png&quot; alt=&quot;NS Record internal working&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;mx-record&quot;&gt;MX Record&lt;/h4&gt;
&lt;p&gt;The &lt;strong&gt;Mail Exchanger&lt;/strong&gt; record is used for email. This simply points to the server where the emails should be delivered for that domain name. These records, along with an email server, allow for the creation of individual email accounts, such as &lt;em&gt;Emails are not allowed&lt;/em&gt;, that are linked to the domain (example.com) and it should be running on SMTP. The Mail Transfer Agent will query the MX record for that domain and will look for the email server, and then DNS will respond with the server details with whom the MTA should send the email.&lt;br&gt;
There are in general two email servers are used with different priorities. The 'priority' numbers before the domains for the MX records indicate preference; the lower 'priority' value is preferred. The server will always try mailhost1 first because 10 is lower than 20. In the result of a message send failure, the server will default to mailhost2.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;example.com      &lt;/th&gt;&lt;th&gt;Record &lt;/th&gt;&lt;th&gt;Priority &lt;/th&gt;&lt;th&gt;Value     &lt;/th&gt;&lt;th&gt;TTL&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;@   &lt;/td&gt;&lt;td&gt;MX &lt;/td&gt;&lt;td&gt;10 &lt;/td&gt;&lt;td&gt;mailhost1.example.com &lt;/td&gt;&lt;td&gt;40400&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;@   &lt;/td&gt;&lt;td&gt;MX &lt;/td&gt;&lt;td&gt;20 &lt;/td&gt;&lt;td&gt;mailhost2.example.com &lt;/td&gt;&lt;td&gt;40400&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zai4g6bieu5bugr0tcj0.png&quot; alt=&quot;MX Record Workings&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;txt-record&quot;&gt;TXT Record&lt;/h3&gt;
&lt;p&gt;Text, or TXT records, store miscellaneous textual information related to domains and subdomains. The TXT record was originally intended as a place for human-readable notes. However, now it is also possible to put some machine-readable data into TXT records. One domain can have many TXT records.&lt;br&gt;
Spammers often try to fake or forge the domains from which they send their email messages. TXT records are a key component of several different email authentication methods (Like: SPF, DKIM, DMARC) that help an email server determine if a message is from a trusted source. By configuring these records, domain operators can make it more difficult for spammers to spoof their domains and can track attempts to do so.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;SPF records: SPF TXT records list all the servers that are authorized to send email messages from a domain.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DKIM records: DKIM works with digital signature - each email using a public-private key pair. This helps verify that the email is actually from the domain it claims to be from.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;DMARC records: A DMARC TXT record references the domain's SPF and DKIM policies.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;conclusion-dns-is-a-system-not-a-set-of-memorized-records&quot;&gt;Conclusion: DNS Is a System, Not a Set of Memorized Records&lt;/h3&gt;
&lt;p&gt;At first glance, DNS can feel overwhelming—root servers, name servers, records with strange names, and numbers everywhere. But once you step back, a simple pattern emerges.&lt;/p&gt;
&lt;p&gt;DNS is not magic.&lt;br&gt;
DNS is a question-and-answer system.&lt;/p&gt;
&lt;p&gt;Each DNS record exists to solve &lt;strong&gt;one specific problem&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;NS records answer &lt;em&gt;who is responsible for this domain&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;A and AAAA records answer &lt;em&gt;where the website lives&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;CNAME records answer &lt;em&gt;is this name just an alias&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;MX records answer &lt;em&gt;where emails should be delivered&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;TXT records answer &lt;em&gt;how this domain can prove or describe itself&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Together, these records form a complete identity for a domain on the internet.&lt;/p&gt;
&lt;p&gt;So the next time you type a website into your browser, remember: your browser isn’t guessing. It’s calmly asking the internet the right questions, in the right order, until it gets a clear, final answer.&lt;br&gt;
And now—you know exactly how that happens.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;Follow for more beginner-friendly breakdowns of core software engineering concepts.&lt;/em&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/12833/dns-explained-how-the-internet-finds-websites</guid>
<pubDate>Fri, 13 Mar 2026 12:29:05 +0000</pubDate>
</item>
<item>
<title>Inside TCP: Establishment, Transfer, Reliability, and Connection Teardown</title>
<link>https://coderlegion.com/12774/inside-tcp-establishment-transfer-reliability-and-connection-teardown</link>
<description>&lt;h3 id=&quot;the-internet-without-rules-a-thought-experiment&quot;&gt;The Internet Without Rules: A Thought Experiment&lt;/h3&gt;
&lt;p&gt;Imagine two people trying to have a conversation over a call but it's a bit noisy phone line. Words can get dropped, repeated, or misunderstood — and there’s even no guarantee that the other side even heard you. That chaotic experience resembles what happens on a raw network without rules and guarantees.&lt;/p&gt;
&lt;p&gt;Computers also face the same challenges when transferring data over networks. Without a structured communicating mechanisms, information can be lost, arrive out of order, can be duplicated or be corrupted while getting transmitted. This is where TCP (Transmission Control Protocol) comes in: a set of rules and processes that turns an unreliable network into a reliable, ordered, and correct data delivery channel.&lt;/p&gt;
&lt;p&gt;In this blog, we go beyond definitions. We have already discussed a vast portion of the TCP protocol &lt;a rel=&quot;nofollow&quot; href=&quot;https://dev.to/ritam369/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http-4144&quot;&gt;in my previous blog&lt;/a&gt;. We’ll unpack how TCP actually works — from establishing a connection to transfer data and gracefully closing it.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-tcp-solves-the-big-picture&quot;&gt;What TCP Solves — The Big Picture&lt;/h3&gt;
&lt;p&gt;At its core, TCP is designed to solve four fundamental problems networks introduce:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Unreliable delivery: Packets may be dropped or never arrive.&lt;/li&gt;
&lt;li&gt;Out-of-order packets: They may arrive in a different sequence than they were sent.&lt;/li&gt;
&lt;li&gt;Corrupted data: Bits can flip/manipulated during transmission due to noise.&lt;/li&gt;
&lt;li&gt;data duplicacy: Data packets can be duplicated through out the transmission.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;TCP addresses these with:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Connection establishment (3-way handshake)&lt;/li&gt;
&lt;li&gt;Sequence numbering and acknowledgements&lt;/li&gt;
&lt;li&gt;Retransmission of lost data&lt;/li&gt;
&lt;li&gt;Flow control and error checking&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This transforms an unreliable network into reliable for HTTP, email, file transfer, and interactive remote sessions.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-3-way-handshake-starting-a-conversation&quot;&gt;The 3-Way Handshake: Starting a Conversation&lt;/h3&gt;
&lt;p&gt;Before meaningful data can transmit between two endpoints, TCP performs a 3-way handshake — an exchange that ensures both sides are ready for the communication.&lt;/p&gt;
&lt;p&gt;Here’s an easy real-world analogy:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Person A says: “Hello, Can you hear me? Are you ready to talk?”&lt;/li&gt;
&lt;li&gt;Person B replies: “Yes you are audible, I’m ready.”&lt;/li&gt;
&lt;li&gt;Person A confirms: “Great — let’s begin.”&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This three-step back-and-forth is precisely what TCP does to establish a reliable connection.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l97ixjvzx6vtdp17l9o0.png&quot; alt=&quot;Connection Establish&quot;&gt;&lt;/p&gt;
&lt;p&gt;The 3-way handshake can be both sides actually, if the client issues a request then that would be &lt;em&gt;Active Open&lt;/em&gt;, on the other hand, if the server tells that its TCP i.e, it's ready to accepts the connection, than that would be &lt;em&gt;Passive Open&lt;/em&gt;.&lt;/p&gt;
&lt;h4 id=&quot;step-1-syn&quot;&gt;Step 1 — SYN&lt;/h4&gt;
&lt;p&gt;The client sends a packet with the SYN (synchronize) flag set. This segment is for synchronization of Sequence numbers. It consumes one sequence number.&lt;br&gt;
This packet includes an initial sequence number — the first byte of data the client plans to send and every time that would be incremented by 1.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Client → Server: SYN (Seq = x)
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;step-2-syn-ack&quot;&gt;Step 2 — SYN-ACK&lt;/h4&gt;
&lt;p&gt;The server responds with a segment that has 2 flag bits set:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SYN set — to synchronize its own sequence number&lt;/li&gt;
&lt;li&gt;ACK set — acknowledging the client’s SYN&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It sends its own initial sequence number and consumes one sequence number.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Server → Client: SYN-ACK (Seq = y, Ack = x+1)
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&quot;step-3-ack&quot;&gt;Step 3 — ACK&lt;/h4&gt;
&lt;p&gt;The client sends a final acknowledgement segment back. It's just the acknowledgement of the second segment sent from the server-side and it consumes one acknowledge number field; doesn't consume any sequence number.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Client → Server: ACK (Ack = y+1)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Once this exchange completes, both sides have synchronized sequence numbers and the connection transitions into the &lt;strong&gt;ESTABLISHED state&lt;/strong&gt;. Once the handshake completes, TCP shifts from coordination to actual data delivery.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;how-data-transfer-works&quot;&gt;How Data Transfer Works&lt;/h3&gt;
&lt;p&gt;Once the connection is established, data is transferred in &lt;em&gt;segments&lt;/em&gt;, each carrying:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;sequence number&lt;/strong&gt; — to track ordering of bytes&lt;/li&gt;
&lt;li&gt;An &lt;strong&gt;acknowledgement number&lt;/strong&gt; — confirming receipt up to a certain byte&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;window size&lt;/strong&gt; — letting the other side know how much data it can send without overflow. It's byte-oriented.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here’s how TCP manages this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sender sends a segment with a sequence number.&lt;/li&gt;
&lt;li&gt;Receiver sends back an ACK indicating the next expected byte.&lt;/li&gt;
&lt;li&gt;Sender slides its window forward and sends more data.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This process continues until all data is sent and acknowledged.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1fi9stfgkrwpgtpjby04.png&quot; alt=&quot;Data Transfer&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;ensuring-reliability-and-correctness&quot;&gt;Ensuring Reliability and Correctness&lt;/h3&gt;
&lt;p&gt;TCP achieves reliability through several interlocking mechanisms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sequence Numbers&lt;/strong&gt;: Every byte in a TCP stream gets a monotonically increasing sequence number. This enables receivers to reorder out-of-order packets and detect missing data.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Acknowledgements&lt;/strong&gt;: Receivers send ACKs to confirm receipt. If an expected ACK does not arrive within a timeout, the sender assumes packet loss and retransmits.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Sliding Windows&lt;/strong&gt;: Used to make transitions more efficient as well as to control the flow of data, so that the destination doesn't get overwhelmed by the data.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Retransmission&lt;/strong&gt;: When data is lost (inferred by missing ACKs), TCP automatically resends the missing segments.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Catching Duplication&lt;/strong&gt;: If a data gets tranmitted again i.e, if duplication happens then it also helps to catch it during the transmission from the receiver side.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Flow Control&lt;/strong&gt;: By negotiating a “window size”, TCP ensures senders don’t overwhelm receivers.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Together, these mechanisms make TCP a reliable, ordered, and error-checked transport protocol.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s88m0s910sax165l4mer.png&quot; alt=&quot;Retransmission&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;connection-termination-ending-the-conversation&quot;&gt;Connection Termination: Ending the Conversation&lt;/h3&gt;
&lt;p&gt;Any of the two parties who are exchanging data, can close the connection, although in most of the cases, the termination is initiated from the client side. Most implementations allow 3-way handshaking for connection-termination.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;After the transmission gets completed, the client side sends the first &lt;em&gt;FIN segment&lt;/em&gt; to the receiver side. FIN flag set may include the last chunk of data sent by the client or it can be the control segment. It consumes one sequence number if it doesn't carry data.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The server after receiving the FIN segment informs its process about the situation and sends the second segment, a &lt;em&gt;FIN + ACK segment&lt;/em&gt; to confirm the receipt of the FIN flagset which is sent from the client-side and at the same time to announce the closing of the connection at server. This segment can also contain last chunk of data from the server, and if it doesn't carry that, it's gonna consume one sequence number.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The client sends the last segment, an &lt;em&gt;ACK segment&lt;/em&gt; to confirm the receipt of FIN segment that is sent from the server. It basically consumes the acknowledge number, which is 1 plus the sequence number received in FIN segment of the server. It doesn't carry data nor any sequence number.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y8jozkqhhzissz62uvgv.png&quot; alt=&quot;TCP Connection Termination&quot;&gt;&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;TCP doesn’t just send bits. It ensures a disciplined exchange that turns the unpredictable real world of networks into a dependable communication channel. Through:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The 3-way handshake&lt;/li&gt;
&lt;li&gt;Sequencing and ACKs&lt;/li&gt;
&lt;li&gt;Retransmission and flow control&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;TCP guarantees that data arrives reliably, in order, and free of corruption.&lt;/p&gt;
&lt;p&gt;Armed with this understanding, you’ll not only write better networking code — you’ll be able to &lt;strong&gt;architect systems that depend on predictable, resilient communications.&lt;/strong&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/12774/inside-tcp-establishment-transfer-reliability-and-connection-teardown</guid>
<pubDate>Wed, 11 Mar 2026 09:14:47 +0000</pubDate>
</item>
<item>
<title>TCP vs UDP: When to Use What, and How TCP Relates to HTTP</title>
<link>https://coderlegion.com/12773/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http</link>
<description>&lt;h3 id=&quot;introduction-the-internet-runs-on-rules&quot;&gt;Introduction: The Internet Runs on Rules&lt;/h3&gt;
&lt;p&gt;The internet is not magic. It’s a carefully negotiated contract between machines.&lt;/p&gt;
&lt;p&gt;Every email you send, every video you stream, every API call your backend makes—none of it happens randomly. Data moves because &lt;strong&gt;rules exist&lt;/strong&gt; that define &lt;em&gt;how&lt;/em&gt; information is packetized, &lt;em&gt;how&lt;/em&gt; it is delivered, and &lt;em&gt;what happens when things go wrong&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;At the heart of this contract sit two transport protocols: &lt;strong&gt;TCP&lt;/strong&gt; and &lt;strong&gt;UDP&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;They solve the same problem—&lt;em&gt;moving data between systems&lt;/em&gt;—but with different philosophies. One prioritizes &lt;strong&gt;reliability and order&lt;/strong&gt;, the other prioritizes &lt;strong&gt;speed and minimal overhead&lt;/strong&gt;. Understanding when to use each is not academic trivia; it’s a &lt;strong&gt;core architectural decision&lt;/strong&gt; that impacts performance, scalability, and user experience.&lt;/p&gt;
&lt;p&gt;And layered on top of this is &lt;strong&gt;HTTP&lt;/strong&gt;, often misunderstood, frequently misattributed, and routinely confused with TCP itself.&lt;/p&gt;
&lt;p&gt;Let’s clear the fog in this blog!!&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-are-tcp-and-udp-high-level-view-&quot;&gt;What Are TCP and UDP? (High-Level View)&lt;/h3&gt;
&lt;p&gt;At a very high level, &lt;strong&gt;TCP&lt;/strong&gt; and &lt;strong&gt;UDP&lt;/strong&gt; are &lt;strong&gt;transport-layer protocols&lt;/strong&gt;. Their job is simple in theory:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt; Move data from one machine to another. &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;How they &lt;em&gt;choose&lt;/em&gt; to do that is where everything changes.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ukk080yrl465ajsal6gy.png&quot; alt=&quot;TCP UDP&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;udp-the-fast-announcement-system-&quot;&gt;UDP — The Fast Announcement System:&lt;/h4&gt;
&lt;p&gt;The &lt;strong&gt;User Datagram Protocol&lt;/strong&gt; is also called &lt;strong&gt;connectionless, unreliable transport protocol&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;There are no host-to-host communication, It relies on Process-to-Process communication (based on Ports). Unlike TCP, UDP does not establish a connection before sending data, nor does it guarantee delivery, order, or error correction.&lt;/p&gt;
&lt;p&gt;Now the questions arise, &quot;&lt;strong&gt;If there are no reliability, no error-handling, no ordering, then why to use it??&lt;/strong&gt;&quot;&lt;/p&gt;
&lt;p&gt;Well with every disadvantages, there also comes some advantages. UDP is a simple protocol that use minimum overhead. If a process wants to send a message but doesn't care whether it's reached or not, it can use UDP. Sending a message by using UDP takes much less interaction between sender and receiver than using DCCP, SCTP, TCP making it ideal for time-sensitive applications where speed is prioritised over reliability..&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;UDP Header:&lt;/strong&gt; UDP packets, also called as User Datagrams, have a fixed size header of 8 bytes.&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Field &lt;/th&gt;&lt;th&gt;Size &lt;/th&gt;&lt;th&gt;Description&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Source Port &lt;/td&gt;&lt;td&gt;16 bits &lt;/td&gt;&lt;td&gt;Sender’s port number.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Destination Port &lt;/td&gt;&lt;td&gt;16 bits &lt;/td&gt;&lt;td&gt;Receiver’s port number.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Length &lt;/td&gt;&lt;td&gt;16 bits &lt;/td&gt;&lt;td&gt;Total length of UDP header and data.&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Checksum &lt;/td&gt;&lt;td&gt;16 bits &lt;/td&gt;&lt;td&gt;Used for error detection (&lt;strong&gt;optional&lt;/strong&gt; in IPv4, &lt;strong&gt;mandatory&lt;/strong&gt; in IPv6).&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/36mb088f4yl6e4eqthth.webp&quot; alt=&quot;UDP Header&quot;&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;Unlike TCP, checksum in UDP is optional. If checksum is not calculated then the field will be filled with 1s.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h5 id=&quot;features-&quot;&gt;Features:&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Less-Reliable&lt;/li&gt;
&lt;li&gt;No Error control &amp;amp; Flow control&lt;/li&gt;
&lt;li&gt;No Retransmission&lt;/li&gt;
&lt;li&gt;Fast&lt;/li&gt;
&lt;li&gt;No ordering&lt;/li&gt;
&lt;li&gt;No &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.geeksforgeeks.org/computer-networks/congestion-control-in-computer-networks/&quot;&gt;Congestion&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&quot;common-use-cases-of-udp-&quot;&gt;Common Use Cases of UDP:&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Broadcasting&lt;/li&gt;
&lt;li&gt;Video Conferencing&lt;/li&gt;
&lt;li&gt;Voice over IP (Services like WhatsApp voice calls, Wi-Fi calling)&lt;/li&gt;
&lt;li&gt;Online Gamings&lt;/li&gt;
&lt;li&gt;Live Video Streaming&lt;/li&gt;
&lt;li&gt;Music Streaming&lt;/li&gt;
&lt;li&gt;DNS Query/Resolution&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;tcp-the-reliable-courier&quot;&gt;TCP — The Reliable Courier&lt;/h4&gt;
&lt;p&gt;&lt;strong&gt;Transmission Control Protocol&lt;/strong&gt; is a &lt;strong&gt;Connection-oriented, Reliable&lt;/strong&gt; transport protocol.&lt;/p&gt;
&lt;p&gt;It's a core protocol of the Internet Protocol suite (TCP/IP), responsible for reliable, ordered, and error-checked delivery of data between applications over a network. As it's a Process-to-Process protocol like UDP, therefore it uses the Port numbers. Developed in the 1970s by Vint Cerf and Bob Kahn, TCP operates at the Transport Layer (Layer 4) of the OSI model and ensures that data sent from one device reaches another correctly and in the same order it was sent. &lt;/p&gt;
&lt;p&gt;Now a question should arise &quot;&lt;strong&gt;How this Protocol can achieve the Reliability, Error Handling, Order Checking??&lt;/strong&gt;&quot;&lt;/p&gt;
&lt;p&gt;A reliable connection is established between Client and Server via a &lt;strong&gt;Three-way Handshake&lt;/strong&gt; before data transfer even begins. It ensures that both sides are synchronised and ready to communicate using Positive Acknowledgement with Retransmission (PAR):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Each segment sent must be acknowledged.&lt;/li&gt;
&lt;li&gt;If a segment is lost or corrupted (detected using the checksum), the receiver discards it, and the sender retransmits.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But before knowing about 3-way handshake in detail, first we need to know about &quot;&lt;strong&gt;What is Segment??&lt;/strong&gt;&quot;&lt;/p&gt;
&lt;p&gt;A TCP segment consists of data bytes to be sent and a header that is added to the data by TCP as shown:&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wmq87h8z536fe2wtjc1a.png&quot; alt=&quot;TCP Segment&quot;&gt;&lt;/p&gt;
&lt;p&gt;The header of a TCP segment can range from 20-60 bytes. 40 bytes are for options. If there are no options, a header is 20 bytes else it can be of upmost 60 bytes. Header fields:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Source Port / Destination Port (16 bits each): Identify sending and receiving applications.&lt;/li&gt;
&lt;li&gt;Sequence Number (32 bits): Position of the first byte in this segment, used for ordering.&lt;/li&gt;
&lt;li&gt;Acknowledgement Number (32 bits): Next byte expected by the receiver (confirms data received).&lt;/li&gt;
&lt;li&gt;Header Length (HLEN): Size of the header (5–15 words, i.e., 20–60 bytes).&lt;/li&gt;
&lt;li&gt;Window Size: Receiver’s buffer size (for flow control).&lt;/li&gt;
&lt;li&gt;Checksum: Error detection (mandatory).&lt;/li&gt;
&lt;li&gt;Urgent Pointer: Position of urgent data (if URG flag is set).&lt;/li&gt;
&lt;li&gt;Control Flags (1 bit each):&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;URG: Urgent data&lt;/li&gt;
&lt;li&gt;ACK: Acknowledgement valid&lt;/li&gt;
&lt;li&gt;PSH: Push data immediately&lt;/li&gt;
&lt;li&gt;RST: Reset connection&lt;/li&gt;
&lt;li&gt;SYN: Synchronize sequence numbers&lt;/li&gt;
&lt;li&gt;FIN: Terminate connection&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So what actually happens in 3-way handshake is stated below step-by-step:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Step 1 (SYN):&lt;/strong&gt; In the first step, the client wants to establish a connection with a server, so it sends a segment with SYN (Synchronize Sequence Number) which informs the server that the client is likely to start communication.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step 2 (SYN + ACK):&lt;/strong&gt; Server responds to the client request with SYN-ACK signal bits set. Acknowledgement(ACK) signifies the response of the segment it received and SYN signifies with what sequence number it is likely to start the segments with.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Step 3 (ACK):&lt;/strong&gt; The client acknowledges the response of the server and they both establish a reliable connection with which they will start the actual data transfer.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mf1ea7daz35qpcrr0tw1.png&quot; alt=&quot;3-way Handshake&quot;&gt;&lt;/p&gt;
&lt;p&gt;Like the establishemt of the connection, Three-way Handshake is also used in connection termination. Though there's also another option available which is Four-way Handshake with half-close, but in most of the modern case implementation, 3-way handshake is used.&lt;/p&gt;
&lt;h5 id=&quot;features--1&quot;&gt;Features:&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Reliable&lt;/li&gt;
&lt;li&gt;Error control &amp;amp; Loss-detection&lt;/li&gt;
&lt;li&gt;Flow control&lt;/li&gt;
&lt;li&gt;Retransmission&lt;/li&gt;
&lt;li&gt;Slow&lt;/li&gt;
&lt;li&gt;Ordering&lt;/li&gt;
&lt;li&gt;Congestion Control &lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&quot;common-use-cases-of-tcp-&quot;&gt;Common Use Cases of TCP:&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;Web-Browsing (HTTP, HTTPS)&lt;/li&gt;
&lt;li&gt;Text-Communication&lt;/li&gt;
&lt;li&gt;Email (SMTP, IMAP)&lt;/li&gt;
&lt;li&gt;File Transfer (FTP, SFTP)&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-is-http-and-where-it-fits&quot;&gt;What Is HTTP—and Where It Fits&lt;/h3&gt;
&lt;p&gt;The &lt;strong&gt;Hypertext Transfer Protocol (HTTP)&lt;/strong&gt; is an &lt;strong&gt;Application level protocol&lt;/strong&gt; that is mainly used to access the data that are on the &lt;strong&gt;World Wide Web (www)&lt;/strong&gt;. Basically it enables the connection in between the server and the clients (Web Browsers).&lt;br&gt;
It operates on a &lt;strong&gt;request-response model&lt;/strong&gt;, where a client sends a request to a server, which then responds with the requested resource, such as an HTML page(texts, image, or video). HTTP is &lt;strong&gt;stateless&lt;/strong&gt;, meaning each request is independent. It runs over TCP and has evolved through versions like HTTP/1.1, HTTP/2, and HTTP/3, with each improving performance, security, and efficiency. &lt;br&gt;
HTTP functions as a combination of &lt;strong&gt;FTP&lt;/strong&gt; and &lt;strong&gt;SMTP&lt;/strong&gt;.&lt;br&gt;
HTTP uses the services of TCP on the &lt;strong&gt;port 80&lt;/strong&gt;.&lt;/p&gt;
&lt;h4 id=&quot;understanding-http-request-and-response&quot;&gt;Understanding HTTP Request and Response&lt;/h4&gt;
&lt;h5 id=&quot;http-request&quot;&gt;HTTP Request&lt;/h5&gt;
&lt;p&gt;An HTTP request is how your browser asks the server for something. It includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTTP Version: The version of HTTP (like HTTP/1.1 or HTTP/2) that is being used.&lt;/li&gt;
&lt;li&gt;URL: The specific address of the resource (e.g., &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.example.com/about&quot;&gt;https://www.example.com/about&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;HTTP Method: The type of action being requested (e.g., GET to retrieve information, POST to send data, PUT to send document from server etc).&lt;/li&gt;
&lt;li&gt;HTTP Request Headers: Extra information (metadata) about the request, like what kind of browser you're using or what kind of content you’re expecting.&lt;br&gt;
&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s4smfk0oo59upr6empep.webp&quot; alt=&quot;HTTP Req Header&quot;&gt;&lt;/li&gt;
&lt;li&gt;HTTP Request Body: In some cases, the request will include a body that contains data (e.g., when you submit a form).&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id=&quot;http-response&quot;&gt;HTTP Response&lt;/h5&gt;
&lt;p&gt;An HTTP response is the server’s answer to your request. It includes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTTP Status Code: A number that tells you if the request was successful or not (e.g., &lt;code&gt;200 OK&lt;/code&gt; means everything is fine, &lt;code&gt;404 Not Found&lt;/code&gt; means the requested page doesn’t exist, &lt;code&gt;500 Internal Server Error&lt;/code&gt; means server site related error might be crash).&lt;/li&gt;
&lt;li&gt;Response Headers: Information about the response (Metadata), like what kind of data is being sent (e.g., Content-Type: text/html means it’s an HTML page).&lt;br&gt;
&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/278dfzq8l97df5at5aeg.webp&quot; alt=&quot;HTTP Resp Header&quot;&gt;&lt;/li&gt;
&lt;li&gt;Response Body: The content that the server sends back (e.g., HTML code that the browser will use to display the webpage).&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m1u51fm7citsmoh7brid.webp&quot; alt=&quot;HTTP Request-Response&quot;&gt;&lt;/p&gt;
&lt;h4 id=&quot;more-about-http-methods&quot;&gt;More about HTTP Methods&lt;/h4&gt;
&lt;p&gt;An HTTP method, sometimes referred to as an HTTP verb, indicates the action that the HTTP request expects from the queried server. For example,&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Method &lt;/th&gt;&lt;th&gt;Action&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;GET &lt;/td&gt;&lt;td&gt;Client requests from the Server&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;HEAD &lt;/td&gt;&lt;td&gt;Request information about document but the not the document itself&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;POST &lt;/td&gt;&lt;td&gt;Sends information from Client to Server&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;PUT &lt;/td&gt;&lt;td&gt;Sends document from Server to Client&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;DELETE &lt;/td&gt;&lt;td&gt;Request the Sever to delete the specified resource&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OPTION &lt;/td&gt;&lt;td&gt;Inquiry about available options&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h4 id=&quot;more-about-http-status-codes&quot;&gt;More about HTTP Status Codes&lt;/h4&gt;
&lt;p&gt;HTTP status codes are standardized three-digit numbers returned by a server in response to a client's request. They are grouped into five classes based on the first digit:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;1xx (Informational)&lt;/strong&gt;: The request was received, and the process is continuing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;2xx (Success)&lt;/strong&gt;: The request was successfully received, understood, and accepted.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;3xx (Redirection)&lt;/strong&gt;: Further action is required to complete the request.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;4xx (Client Error)&lt;/strong&gt;: The request contains bad syntax or cannot be fulfilled.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;5xx (Server Error)&lt;/strong&gt;: The server failed to fulfill an apparently valid request.&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;&lt;p&gt;✅ &lt;strong&gt;Note&lt;/strong&gt;: The most commonly encountered codes are &lt;strong&gt;200 (OK)&lt;/strong&gt;, &lt;strong&gt;404 (Not Found)&lt;/strong&gt;, &lt;strong&gt;400 (Bad Request)&lt;/strong&gt;, &lt;strong&gt;500 (Internal Server Error)&lt;/strong&gt;, and &lt;strong&gt;301/302 (Redirects)&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;p&gt;You don’t need to memorize these flags—but understanding why they exist explains how TCP guarantees order and reliability.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-relationship-between-tcp-and-http-deep-dive-&quot;&gt;The Relationship Between TCP and HTTP (Deep Dive)&lt;/h3&gt;
&lt;h4 id=&quot;the-critical-clarification-http-runs-on-top-of-tcp&quot;&gt;The Critical Clarification: HTTP Runs on Top of TCP&lt;/h4&gt;
&lt;p&gt;At a fundamental level, HTTP and TCP operate at different layers and solve different classes of problems.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;TCP operates at the transport layer&lt;/li&gt;
&lt;li&gt;HTTP operates at the application layer&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This separation is intentional and foundational to how the internet scales.&lt;/p&gt;
&lt;p&gt;When we say “HTTP runs on top of TCP”, we mean this literally in terms of layering:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;HTTP does not send data directly over the network.&lt;br&gt;
It relies on TCP to carry its data reliably from one endpoint to another.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;HTTP is completely unconcerned with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Packet loss&lt;/li&gt;
&lt;li&gt;Retransmissions&lt;/li&gt;
&lt;li&gt;Ordering of bytes&lt;/li&gt;
&lt;li&gt;Congestion control&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All of that responsibility is delegated to TCP.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step-by-Step: What Actually Happens During an HTTP Request&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When you type a URL into a browser and hit Enter, the following sequence occurs (simplified but accurate):&lt;/p&gt;
&lt;p&gt;a. &lt;strong&gt;TCP Connection Establishment&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The client and server perform a TCP handshake.&lt;/li&gt;
&lt;li&gt;This creates a reliable, bidirectional communication channel.&lt;/li&gt;
&lt;li&gt;From this point on, both sides agree on sequence numbers, window sizes, and delivery guarantees.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;b. &lt;strong&gt;HTTP Constructs the Request&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;HTTP formats the request as structured text (method, headers, body).&lt;/li&gt;
&lt;li&gt;Example: GET /api/users HTTP/1.1&lt;/li&gt;
&lt;li&gt;HTTP does not worry about packet boundaries or fragmentation.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;c. &lt;strong&gt;TCP Transmits the Data&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;TCP breaks the HTTP message into segments.&lt;/li&gt;
&lt;li&gt;Each segment is numbered, tracked, and retransmitted if lost.&lt;/li&gt;
&lt;li&gt;TCP ensures all bytes arrive, in order, exactly once.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;d. &lt;strong&gt;HTTP Interprets the Response&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Once TCP delivers the byte stream, HTTP parses it.&lt;/li&gt;
&lt;li&gt;Status codes, headers, and body are interpreted at the application level.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jkux9y5gruybitw3fgnd.png&quot; alt=&quot;HTTP over TCP&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;why-http-does-not-and-cannot-replace-tcp&quot;&gt;Why HTTP Does Not (and Cannot) Replace TCP&lt;/h3&gt;
&lt;p&gt;A common misconception is assuming that HTTP could somehow “handle everything” on its own. This is architecturally incorrect.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Different Responsibilities, Different Layers&lt;/strong&gt;&lt;/p&gt;
&lt;h4 id=&quot;http-defines-semantics&quot;&gt;HTTP defines semantics&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;What does this request mean?&lt;/li&gt;
&lt;li&gt;Is this a GET or POST?&lt;/li&gt;
&lt;li&gt;What does this response mean?&lt;/li&gt;
&lt;li&gt;How should the response be interpreted?&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;tcp-defines-mechanics&quot;&gt;TCP defines mechanics&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;How do bytes move across unreliable networks?&lt;/li&gt;
&lt;li&gt;What happens when packets are lost?&lt;/li&gt;
&lt;li&gt;Are the packets sent in order?&lt;/li&gt;
&lt;li&gt;How is congestion managed?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;HTTP is deliberately designed without transport logic. This is not a limitation—it is a strength.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;conclusion-protocols-are-design-decisions-not-just-theory&quot;&gt;Conclusion: Protocols Are Design Decisions, Not Just Theory&lt;/h3&gt;
&lt;p&gt;TCP, UDP, and HTTP are not competing technologies—they are collaborating layers, each solving a different class of problems.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;TCP exists to make unreliable networks usable&lt;/li&gt;
&lt;li&gt;UDP exists to make real-time systems possible&lt;/li&gt;
&lt;li&gt;HTTP exists to standardize communication on the web&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Choosing between TCP and UDP is not about which protocol is “better”.&lt;br&gt;
It’s about &lt;strong&gt;what your system values more&lt;/strong&gt;—reliability or latency, correctness or responsiveness.&lt;br&gt;
HTTP does not replace TCP.&lt;br&gt;
It &lt;strong&gt;depends on it&lt;/strong&gt;.&lt;br&gt;
Once you understand this layering, networking stops feeling abstract. You stop memorizing protocols and &lt;strong&gt;start designing systems intentionally&lt;/strong&gt;.&lt;br&gt;
And that is the real goal—not passing an exam, but making informed architectural choices in real-world software.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/12773/tcp-vs-udp-when-to-use-what-and-how-tcp-relates-to-http</guid>
<pubDate>Wed, 11 Mar 2026 09:10:19 +0000</pubDate>
</item>
<item>
<title>Understanding Network Devices &amp; their Functionalities</title>
<link>https://coderlegion.com/12772/understanding-network-devices-their-functionalities</link>
<description>&lt;h3 id=&quot;introduction-1&quot;&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Every time we connect to Wi-Fi, open any website, or use an online app, a silent conversation starts between multiple network devices. Data moves from our device, through cables and radio waves across networks we never see, and comes back in milliseconds or maybe less than that!! This entire process often feels invisible and confusing.&lt;/p&gt;
&lt;p&gt;In this blog, we are going to try to overcome this confusion.&lt;/p&gt;
&lt;p&gt;We will start from the very basics and build a clear mental model of how the internet actually reaches our home or office. Step by step, we will explore common network devices, such as modems, routers, switches, hubs, firewalls, and finally, we will learn about the wireless network concept that we use in our daily lives, i.e., Wi-Fi, and how the internet actually works. &lt;/p&gt;
&lt;p&gt;Instead of memorizing definitions, we will understand &lt;strong&gt;why each device exists&lt;/strong&gt;, &lt;strong&gt;what problem it solves&lt;/strong&gt;, and &lt;strong&gt;how all of them work together&lt;/strong&gt; in real-world systems.&lt;/p&gt;
&lt;p&gt;By the end of this blog, we will be able to look at any network and understand what is happening behind the scenes. Let's dive into it.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;modem-your-network-s-gateway-to-the-internet&quot;&gt;Modem: Your Network’s Gateway to the Internet&lt;/h3&gt;
&lt;p&gt;This is the main thing that you need to connect your home to the internet. Without a modem, it's not possible at all. A modem establishes and maintains a dedicated internet connection to the Internet Service Provider.&lt;/p&gt;
&lt;p&gt;A modem is mainly responsible for signal modulation or demodulation. That is, the analog signal gets converted into the digital signal, and also the digital signal gets converted into the analog signal. That's why its name is &quot;Modular Demodulator,&quot; which is in short form &quot;Modem.&quot; As our computer only reads digital signals and the internet uses analog signals, a modem demodulates the incoming analog signal into a digital signal and modulates the outgoing digital signal into an analog signal. That's why a modem is really very important to establish the internet connection in our home or office. &lt;/p&gt;
&lt;p&gt;There are different types of modems in real life, and the structure and the port structure are also different. But mainly there are commonly three ports in a modem: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;One power port to have continuous power flow.&lt;/li&gt;
&lt;li&gt;The Ethernet port is used to connect the Ethernet cable which is connected with the router.&lt;/li&gt;
&lt;li&gt;One is used for internet input, where we use optical fiber cable or coaxial cable or telephone line.&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h3 id=&quot;router-the-traffic-director-of-the-network&quot;&gt;Router: The Traffic Director of the Network&lt;/h3&gt;
&lt;p&gt;The main thing that comes after the modem is &lt;strong&gt;Router,&lt;/strong&gt; whose sole target is to allow multiple electronic devices in our home to share the same internet connection. &lt;/p&gt;
&lt;p&gt;As we know that the internet service provider is providing your home with an internet connection but via a single wire only!! So how can the other devices in our home can have access of the internet?!! &lt;/p&gt;
&lt;p&gt;And here the ROUTER comes into the picture!! The &lt;strong&gt;router decides where traffic goes&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Router allows internet connection in two different ways. &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The &lt;strong&gt;Antennas&lt;/strong&gt; through which the router provides the wireless internet access or Wifi to our home.&lt;/li&gt;
&lt;li&gt;Using the &lt;strong&gt;Ethernet ports&lt;/strong&gt; through which we can have the wired connection to the internet.&lt;br&gt;
When an electronic device gets connected to the Router, the router sends a private dynamic IP address to distinguish it from other connected devices. This happens only due to the DHCP (Dynamic Host Configuration Protocol) server which also stores the table of MAC addresses of those devices that are already connected to the internet. By this IP address and the MAC address, router can decide on which device as well as at which application, the response should be sent.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There's also a table that is being used within the Router which maintains a list of known connected devices and the best path to reach them (which is calculated by different routing algorithms: Dijkstra's Algorithm, Bellman-Ford Algorithm, Floyd-Warshall Algorithm etc.). This table is known as the Routing Table.&lt;/p&gt;
&lt;p&gt;There's also another table is also being used which is NAT (Network Address Translation) Table, which maps internal private IPs to external public IPs for internet access as our devices gets the private IPs but the internet only sees one public IP.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;modem-vs-router-what-s-the-difference-&quot;&gt;Modem vs. Router: What’s the Difference?&lt;/h3&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Feature &lt;/th&gt;&lt;th&gt;&lt;strong&gt;Modem&lt;/strong&gt; &lt;/th&gt;&lt;th&gt;&lt;strong&gt;Router&lt;/strong&gt;&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Purpose &lt;/td&gt;&lt;td&gt;Connects to ISP &lt;/td&gt;&lt;td&gt;Connects multiple devices to the modem&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Function &lt;/td&gt;&lt;td&gt;Converts analog ↔ digital signals &lt;/td&gt;&lt;td&gt;Distributes internet via Wi-Fi or Ethernet&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Internet Access &lt;/td&gt;&lt;td&gt;Required for internet &lt;/td&gt;&lt;td&gt;Not sufficient alone&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Example Use &lt;/td&gt;&lt;td&gt;Needed to get online &lt;/td&gt;&lt;td&gt;Needed to share internet across devices&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9rsubfo9l81rdtz5l3km.jpg&quot; alt=&quot;Modem-Router&quot;&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Many modern devices combine both functions into a &lt;strong&gt;modem-router combo&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;hub-vs-switch-how-local-networks-really-work&quot;&gt;Hub vs Switch: How Local Networks Really Work&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Hub&lt;/strong&gt; is a device which is used to connect all of our network devices together on an internal network by multiple Ethernet connection. Hub is &lt;strong&gt;not intelligent&lt;/strong&gt; as it only knows whether any devices are connected to any of its Ports, so it doesn't filter any data or has any intelligence as to where to send the data. So when a data packet arrives at one of the ports, it is copied to all other ports, thus all the devices that are connected to the hub receives the data packets. As it is not only a matter of &lt;strong&gt;security concerns&lt;/strong&gt; but also creates &lt;strong&gt;unnecessary traffic&lt;/strong&gt; in the network wasting the bandwidth, that's why in modern world, Hub is not that much used (obsolete).&lt;/p&gt;
&lt;p&gt;In the other hand, Switch is very similar to Hub i.e, a device that has multiple ports that accepts Ethernet connections from network devices, but unlike a hub, &lt;strong&gt;Switch is intelligent&lt;/strong&gt; as it actually stores the IP addresses (maps within the &lt;strong&gt;ARP table&lt;/strong&gt;) as well as the physical addresses of the devices (MAC address) that are connected to the switch (maintains the &lt;strong&gt;CAM table&lt;/strong&gt;). So when a data packet is sent to a switch, it's only directed to the intended destination port. Thus switches are more preferable over hubs in modern world because there will not be any unnecessary traffics over the network.&lt;/p&gt;
&lt;p&gt;Both hubs and switches are used to exchange data within a LAN, not used to exchange data outside their own network.&lt;/p&gt;
&lt;p&gt;To exchange data outside their own network there should be a device that needs to be able to read the IP addresses (because both switch and hub can't read IP addresses).&lt;/p&gt;
&lt;p&gt;So here comes the Router. Router acts as the gateway of a network. If data packet is received by a router, the router detects the IP of the data packet and determines if the data packet was meant for its own network or another. &lt;/p&gt;
&lt;p&gt;So here's the main &lt;strong&gt;difference between Hub &amp;amp; Switch&lt;/strong&gt;: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Hub only detects that a device is physically connected to it.&lt;/li&gt;
&lt;li&gt;But Switch can detect the specific devices that are connected to it because of the records of the MAC addresses of those devices.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/byq9p2rn9tdkjnbn7h41.png&quot; alt=&quot;Switch Hub&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;firewall-where-security-actually-lives&quot;&gt;Firewall: Where Security Actually Lives&lt;/h3&gt;
&lt;p&gt;A firewall is a system that is designed to prevent the unauthorised access from entering a private network by just filtering the data packets that comes in from the internet i.e, to create a safety barrier between a private network and the public internet. As we already know, in the internet there are always going to be hackers or any malicious software that may try to penetrate into our private network and that's why a firewall is needed to prevent them. Besides our home, a firewall is very much important for the large organisations or businesses as they would obviously need to protect their secured data from the internet. It works by filtering the incoming network by checking the Access Control List where the sender's IP addresses, the protocols that's being used for the data transmission, the destination's IP address, Domain names, Protocols, Ports are stored. this access control list is designed by the Network Administrator and by this it can be decided what can enter the local network and what can not. A firewall can be either software or can be hardware or it also can be the mixture of both. Firewalls are basically of two types.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Host-based Firewall&lt;/strong&gt;: This is a software based firewall and it's installed in the computer. It's prime focus is to protect the computer only nothing else. For example: In Windows, there are already pre-installed firewall that are used. Besides that there are also some 3rd party software based firewall that can be used to protect the computer. Besides that, there are a lot of antivirus programs that have built-in host based firewall.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Network-based Firewall&lt;/strong&gt;: The hardware based or combination of both hardware and software based firewall that are used to protect the entire network; not only focused to only one computer. It works upon the network layer and operates in between the private network and internet. As we have already mentioned, the Network-based firewall can be a stand-alone hardware device or it can also be implemented within the Router.&lt;/li&gt;
&lt;/ol&gt;
&lt;blockquote&gt;&lt;p&gt;In the large organisations, they mostly use both the network-based and host-based firewall to ensure maximum protection.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3rbgvfwvxmqotcpm6lxs.png&quot; alt=&quot;Firewall&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-is-wi-fi-and-what-actually-happens-internally&quot;&gt;What Is Wi-Fi — And What Actually Happens Internally&lt;/h3&gt;
&lt;p&gt;WIFI, aka IEEE 802.11, is simply a &lt;strong&gt;wireless communication method&lt;/strong&gt; that allows electronic devices to talk to a local network using radio waves.&lt;/p&gt;
&lt;p&gt;Let's discuss what actually happens. &lt;/p&gt;
&lt;p&gt;When we switch on wifi in our phone, it shows nearby networks, which are actually the SSIDs of the networks. Now the question arises that, what is this SSID?!! Don't be overwhelmed by the fancy name; it's just the name of the network, a unique identifier for that wireless network. Most routers broadcast their SSID by default, making the network visible to nearby devices.&lt;/p&gt;
&lt;p&gt;It seems simple that we just click on the network name we need to connect to with our phone, and then it gets connected automatically after the password verification. But it's NOT THAT SIMPLE!!&lt;/p&gt;
&lt;p&gt;When we connect, the phone joins the network, the password gets verified &amp;amp; then an IP address is sent to the phone by the router. But here's a question that should arise in your mind that &quot;How does a router get to know to which device it needs to send data or from which device it needs to receive data?&quot;&lt;/p&gt;
&lt;p&gt;The answer we have already discussed previously in the router section, each device gets a unique private IP address (e.g., 192.168.1.5) from the router via &lt;strong&gt;DHCP&lt;/strong&gt; server. The router uses this to determine where to send incoming or outgoing data packets. Also, there are some tables that are used, to track which IP addresses are assigned to which MAC addresses(devices) (DHCP Lease Table) and a list of known networks and the best path to reach them (Routing Table). &lt;/p&gt;
&lt;p&gt;Now let's assume you want to watch a YouTube video. From your phone, you send a request to access that YouTube video. What actually happens is that your request is at first getting divided into several data packets that are in the bits format (0/1). At first the switch checks the other connected devices for the request, if it's available in other devices then it will be fetched from there, and if not then the request will be forwarded to the Router. The router then will forward the data request to the Internet Service Provider. The Internet Service Provider will then send that data request to the YouTube server. Then the YouTube server will send the response (in data packets and bits format) to the Internet service provider. The Internet service provider will send that response to the router. The router will send that to the switch, and according to the MAC address and the port, the switch will send the response to the device that has requested for it. The device that has requested for the video will merge that data packets according to the ordering and protocols and convert that bitstream into the video format so that the user who has requested it can watch it. And when the data is moving in between the LAN and the WAN, there is always the firewall that maintains the records and checks whether the response is sent by the hackers or the malicious software. All this scenario is happening within, like, some milliseconds or less than that!!&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3kdqqy0haqoxzcli4jzv.png&quot; alt=&quot;Internet flow&quot;&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;conclusion-1&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;Networking often feels complex not because it is magic, but because most of its work happens silently in the background. Every click, every video, and every message depends on multiple devices working together in perfect coordination — each with a very specific responsibility.&lt;/p&gt;
&lt;p&gt;In this blog, we started from the basics and gradually built a clear picture of how data moves from our device to the internet and back. We saw how the modem connects us to the outside world, how the router manages and directs traffic, how switches and hubs handle local communication, how firewalls protect our networks, and how Wi-Fi enables wireless access to all of this infrastructure.&lt;/p&gt;
&lt;p&gt;The key takeaway is simple: &lt;strong&gt;networks are layered systems&lt;/strong&gt;. No single device does everything. Each one solves a focused problem, and together they form a reliable, scalable, and secure communication system.&lt;/p&gt;
&lt;p&gt;This is just the foundation. With this mental model, you are now better prepared to explore deeper topics like OSI model, TCP vs UDP, DNS, cloud networking, and real-world production architectures.&lt;/p&gt;
&lt;p&gt;And that’s where things start to get really interesting.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/12772/understanding-network-devices-their-functionalities</guid>
<pubDate>Wed, 11 Mar 2026 09:00:54 +0000</pubDate>
</item>
<item>
<title>The Discreet Lives of Apps</title>
<link>https://coderlegion.com/5197/the-discreet-lives-of-apps</link>
<description>&lt;p&gt;Ever wonder how your phone streams Netflix, checks email, refreshes social media, and syncs your weather app—all at the same time—without mixing everything up? It feels like magic. But under the hood, your operating system is quietly running a well-organized show with something called &lt;strong&gt;ports&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5i1a0q5wl4ju6mr13b73.gif&quot; alt=&quot;Spy hamster&quot;&gt;&lt;/p&gt;
&lt;p&gt;Think of apps like secret agents living in the same embassy (your phone). Every time they “phone home” across the internet, they need a unique badge number that proves who they are. That badge number? It’s the port.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;1-the-secret-identities-of-your-apps&quot;&gt;1. The Secret Identities of Your Apps&lt;/h3&gt;
&lt;p&gt;When an app sends data out into the internet, it doesn’t just say, “Hey, I’m Instagram!” Instead, it uses a port number, like &lt;strong&gt;80&lt;/strong&gt; or &lt;strong&gt;443&lt;/strong&gt;, to signal how the data should be handled.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Port 80&lt;/strong&gt;: the old-school door for unencrypted web traffic (HTTP).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Port 443&lt;/strong&gt;: the secure, encrypted door for HTTPS traffic.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Without ports, it would be like a hundred spies all whispering in the same room—pure chaos. With ports, everyone knows whose message is whose.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Fun Facts&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Port &lt;strong&gt;443&lt;/strong&gt; handles over &lt;strong&gt;80% of all web traffic today&lt;/strong&gt;—that’s like being the busiest checkout lane in a store that never closes.&lt;/li&gt;
&lt;li&gt;Tech culture nicknames ports too: &lt;strong&gt;Port 666&lt;/strong&gt; is sometimes called &lt;em&gt;“doom”&lt;/em&gt; (after the video game), and &lt;strong&gt;1337&lt;/strong&gt; spells &lt;em&gt;leet&lt;/em&gt; in hacker speak.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;2-the-os-master-connection-handler&quot;&gt;2. The OS: Master Connection Handler&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ygxuywc3tt077n6iz78.gif&quot; alt=&quot;Master spy johnny english&quot;&gt;&lt;/p&gt;
&lt;p&gt;Behind the curtain, your &lt;strong&gt;operating system (OS)&lt;/strong&gt; is the spymaster. It hands out ports, tracks who’s using what, and makes sure your Netflix stream doesn’t collide with your WhatsApp call.&lt;/p&gt;
&lt;p&gt;This coordination happens through &lt;strong&gt;sockets&lt;/strong&gt;—temporary pipelines that connect apps to the network.&lt;/p&gt;
&lt;p&gt;Imagine the OS as a phone operator in the 1950s, manually plugging cables into switchboards. Only today, the switchboard is digital, lightning-fast, and juggling thousands of lines at once.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Fun Facts&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Your phone can theoretically handle &lt;strong&gt;65,000+ simultaneous connections&lt;/strong&gt;—basically, holding a conversation with an entire stadium of people.&lt;/li&gt;
&lt;li&gt;Even in normal use, your phone might juggle &lt;strong&gt;50–100 ports&lt;/strong&gt; just for background refreshes, social media, and emails.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;3-why-port-443-took-over-the-internet&quot;&gt;3. Why Port 443 Took Over the Internet&lt;/h3&gt;
&lt;p&gt;Port 443 isn’t just another door; it’s the &lt;strong&gt;secure door&lt;/strong&gt;. It became popular because it supports &lt;strong&gt;SSL/TLS encryption&lt;/strong&gt;, the tech behind HTTPS.&lt;/p&gt;
&lt;p&gt;Why does that matter? Well, the difference between browsing over Port 80 (HTTP) and Port 443 (HTTPS) is like whispering your bank password loudly in public versus using a sealed envelope with your name on it.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Fun Facts&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The “s” in &lt;strong&gt;https://&lt;/strong&gt; was such a game-changer that Google actually ranks HTTPS sites higher in search results.&lt;/li&gt;
&lt;li&gt;Today, &lt;strong&gt;Netflix alone probably generates more 443 traffic in a day than the entire internet did in 1995.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;4-ephemeral-ports-the-mall-parking-spaces&quot;&gt;4. Ephemeral Ports: The Mall Parking Spaces&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h80ywuf4m0z5wm97izma.gif&quot; alt=&quot;Ghost Hamster&quot;&gt;&lt;/p&gt;
&lt;p&gt;Here’s where things get clever. Your phone doesn’t just use ports like 80 and 443. It also creates &lt;strong&gt;temporary ports&lt;/strong&gt;, called &lt;strong&gt;ephemeral ports&lt;/strong&gt;, to handle unique conversations.&lt;/p&gt;
&lt;p&gt;Think of them as parking spots in a busy shopping mall. You drive in, park for a while, leave, and the spot becomes available for someone else.&lt;/p&gt;
&lt;p&gt;So when your browser connects to &lt;code&gt;https://example.com&lt;/code&gt; on port 443, your OS might assign your app a temporary local port (say, 49152). The site knows you by this parking spot, while the OS ensures you don’t collide with another app’s connection.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Fun Facts&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Your computer can create and destroy &lt;strong&gt;thousands of ephemeral ports per minute&lt;/strong&gt; without you noticing.&lt;/li&gt;
&lt;li&gt;It’s one of the quietest but most important juggling acts your device performs.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;5-local-vs-internet-ports-what-s-the-difference-&quot;&gt;5. Local vs. Internet Ports: What’s the Difference?&lt;/h3&gt;
&lt;p&gt;Not all ports are global superstars like 80 and 443. Some are &lt;strong&gt;local ports&lt;/strong&gt;, used by developers and apps running just on your machine.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;8080&lt;/strong&gt;: A common “backup” web port, often used for local testing.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;5555&lt;/strong&gt;: Frequently used by Android devices for debugging.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;25565&lt;/strong&gt;: Used by Minecraft servers so friends can connect.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These local ports are like service entrances in a building—different from the front doors (like 80 and 443) that face the internet. They help apps communicate internally or set up test servers without colliding with the main network highways.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Fun Facts&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Port &lt;strong&gt;8080&lt;/strong&gt; is so common it’s basically the internet’s “Plan B” when 80 is busy.&lt;/li&gt;
&lt;li&gt;Gamers literally “open ports” to create digital doorways for friends to join matches.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;6-why-all-this-matters&quot;&gt;6. Why All This Matters&lt;/h3&gt;
&lt;p&gt;From your perspective, it’s seamless. You just tap Instagram, join a Zoom call, or watch Netflix, and it all “just works.” But under the hood, your OS is running a high-stakes logistics game: handing out ports, securing them, and reusing them efficiently.&lt;/p&gt;
&lt;p&gt;And while it feels invisible, understanding ports is the first step to understanding how the internet truly works—and why security and efficiency go hand in hand.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;Bonus Fun Facts&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hackers often scan for open ports like burglars checking for unlocked windows—that’s why firewalls are critical.&lt;/li&gt;
&lt;li&gt;If Port 443 traffic were a highway, it would need about &lt;strong&gt;50 lanes&lt;/strong&gt; to handle rush-hour internet traffic.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h4 id=&quot;want-to-learn-more-&quot;&gt;Want to Learn More?&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml&quot;&gt;IANA Port Number Registry&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.cloudflare.com/learning/ssl/what-is-https/&quot;&gt;How HTTPS Works (Cloudflare)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://inl.info.ucl.ac.be/CNP3&quot;&gt;Computer Networking: Principles, Protocols and Practice (Free Textbook)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
<category>Full-stack Dev</category>
<guid isPermaLink="true">https://coderlegion.com/5197/the-discreet-lives-of-apps</guid>
<pubDate>Fri, 05 Sep 2025 00:25:21 +0000</pubDate>
</item>
<item>
<title>Kernel TLS, NIC Offload, and Socket Sharding: What’s New and Who Uses It?</title>
<link>https://coderlegion.com/4769/kernel-tls-nic-offload-and-socket-sharding-whats-new-and-who-uses-it</link>
<description>&lt;p&gt;Modern servers are expected to push &lt;strong&gt;hundreds of gigabits per second&lt;/strong&gt; while keeping latency low and CPU use manageable. Two kernel-level innovations—&lt;strong&gt;socket sharding&lt;/strong&gt; and &lt;strong&gt;kernel TLS (kTLS)&lt;/strong&gt;—help make that possible. When paired with &lt;strong&gt;NIC TLS offload&lt;/strong&gt;, the gains are even bigger.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;socket-sharding&quot;&gt;Socket Sharding&lt;/h3&gt;
&lt;p&gt;Traditionally, only one process could &lt;code&gt;accept()&lt;/code&gt; connections from a TCP socket.&lt;br&gt;
With Linux &lt;strong&gt;4.5 (2016)&lt;/strong&gt; and &lt;code&gt;SO_REUSEPORT&lt;/code&gt; enhancements, multiple processes can share a listening socket. This “socket sharding” lets the kernel distribute connections efficiently across worker processes.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Adopted in &lt;strong&gt;NGINX&lt;/strong&gt; and &lt;strong&gt;HAProxy&lt;/strong&gt;.  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;FreeBSD&lt;/strong&gt; has similar support.  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Windows&lt;/strong&gt; does not provide this functionality.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;✅ Result: Better scalability on multi-core systems with no user-space load balancer needed.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;kernel-tls-ktls-&quot;&gt;Kernel TLS (kTLS)&lt;/h3&gt;
&lt;p&gt;Linux introduced &lt;strong&gt;kTLS&lt;/strong&gt; in &lt;strong&gt;4.13 (2017)&lt;/strong&gt; (send path first, later receive).&lt;br&gt;
Instead of copying encrypted data between user space and kernel space, the kernel itself handles TLS record encryption/decryption.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Avoids extra copies and syscalls.  &lt;/li&gt;
&lt;li&gt;Yields &lt;strong&gt;20–40% CPU savings&lt;/strong&gt; in many workloads.  &lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;benchmarks&quot;&gt;Benchmarks&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;FreeBSD&lt;/strong&gt; users: throughput improved from &lt;strong&gt;25–30 Gb/s → 100+ Gb/s&lt;/strong&gt; with dual-100G NICs.  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NGINX with kTLS + &lt;code&gt;SSL_sendfile()&lt;/code&gt;&lt;/strong&gt;: roughly &lt;strong&gt;2× throughput&lt;/strong&gt; when serving static files compared to user-space TLS.  &lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;nic-tls-offload&quot;&gt;NIC TLS Offload&lt;/h3&gt;
&lt;p&gt;Some NICs (Mellanox/NVIDIA ConnectX, Chelsio T6, Intel QAT) can offload encryption entirely.&lt;br&gt;
The kernel sets up the session keys, while the NIC performs the crypto inline.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Netflix (FreeBSD + Mellanox CX6-DX)&lt;/strong&gt;:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;In production, serving &lt;strong&gt;400–800 Gb/s per server&lt;/strong&gt;.  &lt;/li&gt;
&lt;li&gt;Reported &lt;strong&gt;~50% reduction in memory bandwidth use&lt;/strong&gt; vs CPU crypto.  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;NVIDIA/Mellanox (netdev conf)&lt;/strong&gt;:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Inline TLS offload gave &lt;strong&gt;~2× throughput&lt;/strong&gt; vs software kTLS.  &lt;/li&gt;
&lt;li&gt;Example: &lt;strong&gt;8.8 Gb/s vs 4.4 Gb/s&lt;/strong&gt; in test environments.  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Chelsio T6&lt;/strong&gt;:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Vendor benchmarks show &lt;strong&gt;~44.8 Gb/s TLS throughput&lt;/strong&gt; with very low CPU use.  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Academic 2024 SmartNIC study&lt;/strong&gt;:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Inline mode: &lt;strong&gt;~9.3 Gb/s&lt;/strong&gt; throughput under parallel load.  &lt;/li&gt;
&lt;li&gt;Coprocessor mode: less throughput but &lt;strong&gt;lowest CPU cost&lt;/strong&gt;.  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;windows-support-&quot;&gt;Windows Support?&lt;/h3&gt;
&lt;p&gt;Unlike Linux and FreeBSD, &lt;strong&gt;Windows does not support kernel TLS&lt;/strong&gt;.&lt;br&gt;
TLS remains in user space via SChannel or libraries like OpenSSL/BoringSSL, with no NIC offload integration.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;summary&quot;&gt;Summary&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Socket sharding&lt;/strong&gt; (Linux 4.5+) spreads load across processes → higher scalability.  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;kTLS&lt;/strong&gt; (Linux 4.13+, FreeBSD 13+) avoids copies → &lt;strong&gt;20–40% CPU savings&lt;/strong&gt;, ~&lt;strong&gt;2× throughput&lt;/strong&gt; for NGINX.  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;NIC TLS offload&lt;/strong&gt; (Netflix, NVIDIA, Chelsio):  &lt;ul&gt;
&lt;li&gt;&lt;strong&gt;2× throughput&lt;/strong&gt;, huge CPU savings,  &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;400–800 Gb/s per server&lt;/strong&gt; possible in production.  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Windows&lt;/strong&gt;: No kernel TLS or NIC offload support today.  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These optimizations matter most at hyperscaler scale, but are increasingly available to anyone running &lt;strong&gt;NGINX&lt;/strong&gt;, &lt;strong&gt;HAProxy&lt;/strong&gt;, or workloads on modern NICs.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;references-1&quot;&gt;References&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.f5.com/company/blog/nginx/improving-nginx-performance-with-kernel-tls&quot;&gt;F5 NGINX Blog – &lt;em&gt;Improving NGINX Performance with Kernel TLS&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.managedserver.eu/performance-improvement-of-nginx-with-kernel-tls-and-ssl_sendfile/&quot;&gt;Managed Server Blog – &lt;em&gt;Performance Improvement of NGINX with Kernel TLS and SSL_sendfile&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://web.archive.org/web/20250425030610/https://people.freebsd.org/~rrs/asiabsd_tls_improved.pdf&quot;&gt;Netflix Tech Blog (PDF) – &lt;em&gt;FreeBSD Kernel TLS and NIC Offload in Production&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.chelsio.com/nginx-offload/&quot;&gt;Chelsio Communications – &lt;em&gt;TLS/SSL Offload with Chelsio T6&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://leris.dcomp.ufscar.br/wp-content/uploads/2024/01/IEEE_NOMS_2024__Unlocking_Security_to_the_Board__An_Evaluation_of_SmartNIC_driven_TLS_Acceleration_with_kTLS-1.pdf&quot;&gt;SmartNIC + kTLS Academic Paper (IEEE NOMS 2024)&lt;/a&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/4769/kernel-tls-nic-offload-and-socket-sharding-whats-new-and-who-uses-it</guid>
<pubDate>Sun, 17 Aug 2025 22:00:14 +0000</pubDate>
</item>
<item>
<title>Broadcast devices' name on the local network</title>
<link>https://coderlegion.com/3711/broadcast-devices-name-on-the-local-network</link>
<description>&lt;p&gt;With years, I accumulated devices on my local network, which in general run on Linux. I meticulously added them to my &lt;code&gt;/etc/hosts/&lt;/code&gt; file, so as not to remember their IP. Something puzzled me, though: my Synology NAS was readily available as &lt;code&gt;nas.local&lt;/code&gt; on the network, without doing anything. I have close to zero skills in system administration, so here are my findings.&lt;/p&gt;
&lt;h3 id=&quot;the-local-domain&quot;&gt;The &lt;code&gt;.local&lt;/code&gt; domain&lt;/h3&gt;
&lt;p&gt;We can learn more about &lt;code&gt;.local&lt;/code&gt; domain from Wikipedia.&lt;/p&gt;
&lt;p&gt;&amp;gt;The domain name &lt;em&gt;.local&lt;/em&gt; is a special-use domain name reserved by the Internet Engineering Task Force (IETF) so that it may not be installed as a top-level domain in the Domain Name System (DNS) of the Internet. As such it is similar to the other special domain names, such as .localhost. However, .local has since been designated for use in link-local networking, in applications of multicast DNS (mDNS) and zero-configuration networking (zeroconf) so that DNS service may be established without local installations of conventional DNS infrastructure on local area networks. &lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;gt;-- &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/.local&quot;&gt;.local&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The next step is obviously checking the Multicast DNS definition:&lt;/p&gt;
&lt;p&gt;&amp;gt;&lt;em&gt;Multicast DNS (mDNS)&lt;/em&gt; is a computer networking protocol that resolves hostnames to IP addresses within small networks that do not include a local name server. It is a zero-configuration service, using essentially the same programming interfaces, packet formats and operating semantics as unicast Domain Name System (DNS). It was designed to work as either a stand-alone protocol or compatible with standard DNS servers.&lt;br&gt;
&amp;gt;It uses IP multicast User Datagram Protocol (UDP) packets and is implemented by the Apple Bonjour and open-source Avahi software packages, included in most Linux distributions.&lt;br&gt;
&amp;gt;Although the Windows 10 implementation was limited to discovering networked printers, subsequent releases resolved hostnames as well. mDNS can work in conjunction with DNS Service Discovery (DNS-SD), a companion zero-configuration networking technique specified separately in RFC 6763.&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;&amp;gt;-- &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Multicast_DNS&quot;&gt;Multicast DNS&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;In short, when you send a request to a &lt;code&gt;.local&lt;/code&gt; domain, you sent it to a special multicast IP–&lt;code&gt;224.0.0.251&lt;/code&gt;. Devices can join the multicast group associated to this IP. From this point on, the router forwards the request to all devices in the group.The one with the corresponding host will respond, others will ignore it.&lt;/p&gt;
&lt;p&gt;Here's the result of pinging the above IP on my local network:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;PING 224.0.0.251 (224.0.0.251): 56 data bytes
64 bytes from 192.168.1.73: icmp_seq=0 ttl=64 time=0.251 ms
64 bytes from 224.0.0.251: icmp_seq=0 ttl=255 time=13.876 ms
64 bytes from 192.168.1.36: icmp_seq=0 ttl=64 time=127.181 ms
64 bytes from 192.168.1.71: icmp_seq=0 ttl=64 time=128.267 ms
64 bytes from 192.168.1.80: icmp_seq=0 ttl=64 time=128.588 ms
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Notice that I get responses from other IPs.&lt;/p&gt;
&lt;p&gt;With this approach, local networks can avoid the burden of setting up an internal DNS and the configuration that goes with it on each device.&lt;/p&gt;
&lt;h3 id=&quot;setting-up-a-local-domain&quot;&gt;Setting up a &lt;code&gt;.local&lt;/code&gt; domain&lt;/h3&gt;
&lt;p&gt;For my own local network, I prefer the &lt;code&gt;.local&lt;/code&gt; domain to a full-fledged DNS &lt;strong&gt;and&lt;/strong&gt; configuring every device. As I mentioned above, my Synology NAS does it automatically.&lt;/p&gt;
&lt;p&gt;Let's set it up for my Raspberry Pi. It works for any Linux-based distribution. I'll use &lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Avahi_(software)&quot;&gt;Avahi&lt;/a&gt;, which implements mDNS.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;sudo apt-get update
sudo apt-get install avahi-daemon
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We also need to update the &lt;code&gt;/etc/nsswitch.conf&lt;/code&gt; to plugin in into the host resolution system.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;...
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The above configuration tries to resolve host in order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Look in &lt;code&gt;/etc/hosts&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use Avahi&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If the host hasn't been resolved at this point, return. Note that options after this stage are for documentation only: you can remove them with no side-effect, but it allows admins what options are available.&lt;/p&gt;
&lt;p&gt;Since I started using Ansible to manage my Pi, here's the corresponding playbook:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-yaml&quot;&gt;- name: Configure Raspberry Pi
  hosts: 192.168.1.144
  vars:
    ansible_user: johndoe
  tasks:
    - name: Update apt cache
      become: true
      apt:
        update_cache: yes
    - name: Broadcast device as pi.local
      block:
        - name: Set hostname to pi
          become: true
          hostname:
            name: pi
        - name: Update /etc/hosts with new hostname
          become: true
          lineinfile:
            path: /etc/hosts
            regexp: '^127\.0\.1\.1\s+'
            line: '127.0.1.1       pi'
        - name: Install avahi-daemon
          become: true
          apt:
            name: avahi-daemon
            state: present
        - name: Ensure avahi-daemon is enabled and running
          service:
            name: avahi-daemon
            state: started
            enabled: true
        - name: Set mdns in /etc/nsswitch.conf
          become: true
          lineinfile:
            path: /etc/nsswitch.conf
            regexp: '^hosts:'
            line: 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4'
            backup: true
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;conclusion-2&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;If you operate a small local network that only a few trusted people have access to, you can benefit from multicast and the &lt;code&gt;.local&lt;/code&gt; domain instead of full-fledged internal DNS server. We only had to install the Avahi daemon locally and tweak the &lt;code&gt;/etc/nsswitch.conf&lt;/code&gt; file. For Infrastructure-as-Code purposes, I used an Ansible playbook.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To go further:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/.local&quot;&gt;The .local domain&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Multicast_DNS&quot;&gt;Multicast DNS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://en.wikipedia.org/wiki/Avahi_(software)&quot;&gt;Avahi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://docs.ansible.com/&quot;&gt;Ansible documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;Originally published at &lt;a rel=&quot;nofollow&quot; href=&quot;https://blog.frankel.ch/broadcast-devices-name-local-network/&quot;&gt;A Java Geek&lt;/a&gt; on June 29&lt;sup&gt;th&lt;/sup&gt;, 2025&lt;/em&gt;&lt;/p&gt;
</description>
<category>Networking</category>
<guid isPermaLink="true">https://coderlegion.com/3711/broadcast-devices-name-on-the-local-network</guid>
<pubDate>Thu, 03 Jul 2025 20:55:48 +0000</pubDate>
</item>
</channel>
</rss>