<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Sarim Nadeem</title>
    <description>The latest articles on Forem by Sarim Nadeem (@sarim_nadeem_888180307df8).</description>
    <link>https://forem.com/sarim_nadeem_888180307df8</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3759481%2F31d5b18a-a9d7-4370-aa09-9d4dfb454448.jpeg</url>
      <title>Forem: Sarim Nadeem</title>
      <link>https://forem.com/sarim_nadeem_888180307df8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sarim_nadeem_888180307df8"/>
    <language>en</language>
    <item>
      <title>From One to One Billion: A Guide to System Scalability</title>
      <dc:creator>Sarim Nadeem</dc:creator>
      <pubDate>Wed, 22 Apr 2026 12:12:00 +0000</pubDate>
      <link>https://forem.com/sarim_nadeem_888180307df8/from-one-to-one-billion-a-guide-to-system-scalability-1op8</link>
      <guid>https://forem.com/sarim_nadeem_888180307df8/from-one-to-one-billion-a-guide-to-system-scalability-1op8</guid>
      <description>&lt;h1&gt;
  
  
  From One to One Billion: A Guide to System Scalability
&lt;/h1&gt;

&lt;p&gt;In the world of modern computing, &lt;strong&gt;scalability&lt;/strong&gt; isn't just a "nice-to-have" feature—it is the difference between a successful application and a system crash. Whether you are building a small app or a global service, understanding how to handle growth is essential.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. What is Scalability?
&lt;/h2&gt;

&lt;p&gt;At its core, &lt;strong&gt;scalability&lt;/strong&gt; is the property of a system to handle a growing amount of work. It is a characteristic that applies to everything in the tech stack: computers, networks, algorithms, and even networking protocols.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Two Ways to Scale
&lt;/h3&gt;

&lt;p&gt;When a system needs more power, there are generally two directions to go:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Vertical Scaling (Scale Up):&lt;/strong&gt; Adding more power (CPU, RAM) to an existing machine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Horizontal Scaling (Scale Out):&lt;/strong&gt; Adding more machines to your network to share the load.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Concurrency vs. Parallelism
&lt;/h2&gt;

&lt;p&gt;These two terms are often used interchangeably, but they represent very different concepts in logic and execution.&lt;/p&gt;

&lt;h3&gt;
  
  
  Concurrency
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concurrency&lt;/strong&gt; is the ability of a system to manage multiple tasks at once. It doesn't necessarily mean they are running at the same instant; instead, the system uses &lt;strong&gt;time-sharing&lt;/strong&gt; (context switching) to juggle them. This improves responsiveness and throughput.&lt;/p&gt;

&lt;h3&gt;
  
  
  Parallelism
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Parallelism&lt;/strong&gt; is the simultaneous execution of tasks on multiple processing units (like a multi-core CPU). &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key Difference:&lt;/strong&gt; Concurrency is about &lt;strong&gt;dealing&lt;/strong&gt; with lots of things at once. Parallelism is about &lt;strong&gt;doing&lt;/strong&gt; lots of things at once.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  3. High-Performance Computing (HPC) &amp;amp; Scaling Laws
&lt;/h2&gt;

&lt;p&gt;When we talk about extreme levels of performance, we use two specific notions of scaling to measure efficiency:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Strong Scaling:&lt;/strong&gt; How the solution time varies with the number of processors for a &lt;strong&gt;fixed total problem size&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Weak Scaling:&lt;/strong&gt; How the solution time varies with the number of processors for a &lt;strong&gt;fixed problem size per processor&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Bottleneck Rule: Amdahl’s Law
&lt;/h3&gt;

&lt;p&gt;Amdahl’s Law is the most critical concept to understand when scaling software. It explains a harsh reality: &lt;strong&gt;You cannot make a program infinitely fast just by adding more processors.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The speed of your program is always limited by the part that &lt;strong&gt;cannot&lt;/strong&gt; be run in parallel (the "serial" part). If a portion of your code must happen in a specific order, that portion will eventually become your bottleneck.&lt;/p&gt;




&lt;h4&gt;
  
  
  1. The Formula
&lt;/h4&gt;

&lt;p&gt;To calculate the theoretical speedup of a task, we use this formula:&lt;/p&gt;

&lt;p&gt;$$S_{latency}(s) = \frac{1}{(1 - p) + \frac{p}{s}}$$&lt;/p&gt;

&lt;h4&gt;
  
  
  2. Breaking Down the Variables
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;$S_{latency}$&lt;/strong&gt;: This is the &lt;strong&gt;Total Speedup&lt;/strong&gt; you actually achieve.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;$p$&lt;/strong&gt;: The percentage of the program that &lt;strong&gt;can&lt;/strong&gt; be parallelized (e.g., 0.95 for 95%).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;$(1 - p)$&lt;/strong&gt;: The &lt;strong&gt;Serial Part&lt;/strong&gt; that must run one step at a time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;$s$&lt;/strong&gt;: The &lt;strong&gt;Resource Speedup&lt;/strong&gt; (usually how many CPU cores you are adding).&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  3. The "Plain English" Explanation
&lt;/h4&gt;

&lt;p&gt;Imagine you are baking a cake. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Parallel Part ($p$):&lt;/strong&gt; Cracking 10 eggs. If you have 10 people, you can do this almost instantly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Serial Part ($1-p$):&lt;/strong&gt; Baking the cake in the oven. No matter how many people you have in the kitchen, the cake still takes 30 minutes to bake.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The Takeaway:&lt;/strong&gt; If the "baking time" (serial part) takes up 50% of your total process, your total speedup will &lt;strong&gt;never&lt;/strong&gt; exceed 2x, even if you hire a thousand chefs to crack the eggs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  4. Why This Matters for Scalability
&lt;/h4&gt;

&lt;p&gt;When you scale a system, you must identify the serial bottlenecks first. Adding more hardware (Horizontal Scaling) only helps the parts of your code that are "parallel-ready." If your database lock or your network handshake is serial, that is where your scaling will hit a wall.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Web Scale Computing
&lt;/h2&gt;

&lt;p&gt;"Web Scale" is a term popularized by cloud giants like &lt;strong&gt;Google, Amazon, and Netflix&lt;/strong&gt;. It refers to architectures that enable extreme levels of agility and scalability. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web Scale Computing&lt;/strong&gt; involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Interprocess Communication (IPC):&lt;/strong&gt; The sharing of data between running processes to ensure the system stays synchronized.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Elasticity:&lt;/strong&gt; The ability to automatically scale resources up and down based on real-time demand.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Indeterminacy:&lt;/strong&gt; Managing the unpredictable effects that happen when thousands of cores and massive networks interact simultaneously.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Why Does This Matter?
&lt;/h2&gt;

&lt;p&gt;Understanding these principles allows you to build systems that don't just work today, but continue to work as your user base grows. By mastering the balance between &lt;strong&gt;IPC&lt;/strong&gt;, &lt;strong&gt;Parallelism&lt;/strong&gt;, and &lt;strong&gt;Horizontal Scaling&lt;/strong&gt;, you can achieve "Web Scale" levels of performance.&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>distributedsystems</category>
      <category>performance</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>The Internet’s Bouncer: A Clear Guide to SOP and CORS</title>
      <dc:creator>Sarim Nadeem</dc:creator>
      <pubDate>Tue, 14 Apr 2026 11:06:57 +0000</pubDate>
      <link>https://forem.com/sarim_nadeem_888180307df8/the-internets-bouncer-a-clear-guide-to-sop-and-cors-1954</link>
      <guid>https://forem.com/sarim_nadeem_888180307df8/the-internets-bouncer-a-clear-guide-to-sop-and-cors-1954</guid>
      <description>&lt;h1&gt;
  
  
  The Internet’s Bouncer: A Clear Guide to SOP and CORS
&lt;/h1&gt;

&lt;p&gt;If you’ve ever seen a red error message in your browser console shouting about "Cross-Origin Request Blocked," you’ve met the web’s most important security duo: &lt;strong&gt;SOP&lt;/strong&gt; and &lt;strong&gt;CORS&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Here is everything you need to know to understand how they work together to keep the web safe.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Same-Origin Policy (SOP)?
&lt;/h2&gt;

&lt;p&gt;The &lt;strong&gt;Same-Origin Policy (SOP)&lt;/strong&gt; is a fundamental security feature implemented by web browsers. It’s like the internet’s bouncer, preventing web pages from making requests to different origins unless they match. &lt;/p&gt;

&lt;p&gt;Without SOP, malicious websites could easily access sensitive data on other tabs you’ve got open—imagine your bank account details hanging out for all to see!&lt;/p&gt;

&lt;h3&gt;
  
  
  What Defines an "Origin"?
&lt;/h3&gt;

&lt;p&gt;If any of these three components differ between two URLs, they are considered to have different origins:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Protocol&lt;/strong&gt; (e.g., &lt;code&gt;http&lt;/code&gt; vs. &lt;code&gt;https&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Domain&lt;/strong&gt; (e.g., &lt;code&gt;example.com&lt;/code&gt; vs. &lt;code&gt;api.example.com&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Port&lt;/strong&gt; (e.g., &lt;code&gt;:80&lt;/code&gt; vs. &lt;code&gt;:443&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://example.com:443/page1  ✅ Same origin as https://example.com:443/page2
http://example.com/page1       ❌ Different origin from https://example.com/page2 (different protocol)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  How SOP Restricts Interactions
&lt;/h2&gt;

&lt;p&gt;To protect your data, the browser restricts what scripts can do across origins:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cookies:&lt;/strong&gt; You can only access cookies for your own origin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Storage:&lt;/strong&gt; &lt;code&gt;LocalStorage&lt;/code&gt; and &lt;code&gt;SessionStorage&lt;/code&gt; are origin-specific. No peeking at someone else’s data!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DOM Access:&lt;/strong&gt; A script from &lt;code&gt;Origin A&lt;/code&gt; cannot access the DOM of a page from &lt;code&gt;Origin B&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AJAX/Fetch Requests:&lt;/strong&gt; Requests are blocked by default unless explicitly allowed.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What Is CORS (Cross-Origin Resource Sharing)?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;CORS&lt;/strong&gt; is a security feature that allows or restricts resources on a web server to be requested from a different domain. It’s like giving permission to certain websites to knock on your server’s door and grab some data. &lt;/p&gt;

&lt;p&gt;Without CORS, web pages are locked in their own origin-sandbox, unable to communicate with external APIs, CDNs, or other resources.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Is CORS Important?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Enforces SOP:&lt;/strong&gt; It makes the strictness of SOP flexible for legitimate communication.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Controlled Sharing:&lt;/strong&gt; Servers can whitelist specific domains to keep data safe.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Prevents Attacks:&lt;/strong&gt; It helps protect against attacks like &lt;em&gt;Cross-Site Request Forgery (CSRF)&lt;/em&gt; and &lt;em&gt;Cross-Site Scripting (XSS)&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The CORS Workflow
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Simple Requests
&lt;/h3&gt;

&lt;p&gt;These include &lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, and &lt;code&gt;HEAD&lt;/code&gt; requests that don’t require special handling. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The browser sends the request with an &lt;code&gt;Origin&lt;/code&gt; header.&lt;/li&gt;
&lt;li&gt;If the server returns an &lt;code&gt;Access-Control-Allow-Origin&lt;/code&gt; header that matches, all is good.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Preflight Requests
&lt;/h3&gt;

&lt;p&gt;These are like asking the server, &lt;em&gt;"Hey, is it cool if I send a DELETE request?"&lt;/em&gt; before making the actual request. This is done via an &lt;code&gt;OPTIONS&lt;/code&gt; call.&lt;/p&gt;




&lt;h2&gt;
  
  
  CORS Headers You Should Know
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Access-Control-Allow-Origin&lt;/code&gt;&lt;/strong&gt;: Specifies which origins are allowed access.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Access-Control-Allow-Methods&lt;/code&gt;&lt;/strong&gt;: Defines permitted HTTP methods (&lt;code&gt;GET&lt;/code&gt;, &lt;code&gt;POST&lt;/code&gt;, etc.).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Access-Control-Allow-Headers&lt;/code&gt;&lt;/strong&gt;: Specifies which custom headers can be used.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Access-Control-Allow-Credentials&lt;/code&gt;&lt;/strong&gt;: Allows cookies or authorization headers to be included.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The Wildcard Policy
&lt;/h2&gt;

&lt;p&gt;A wildcard &lt;code&gt;*&lt;/code&gt; is appropriate when an API response is intended to be accessible to any code on any site, such as &lt;a href="https://fonts.google.com/" rel="noopener noreferrer"&gt;Google Fonts&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The value of &lt;code&gt;*&lt;/code&gt; is special because it &lt;strong&gt;does not&lt;/strong&gt; allow requests to supply credentials. This means it won't allow HTTP authentication, SSL certificates, or cookies to be sent in the cross-domain request.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SOP&lt;/strong&gt; is the "Default Deny" policy that keeps your browser secure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CORS&lt;/strong&gt; is the "Explicit Allow" protocol that lets modern web apps talk to each other.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>security</category>
      <category>discuss</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
