<?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>DEV Community: Vishal Rajput</title>
    <description>The latest articles on DEV Community by Vishal Rajput (@vishal_rajput_310e810159e).</description>
    <link>https://dev.to/vishal_rajput_310e810159e</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%2F2782995%2F395477d9-d4d7-4d09-a031-287d5f09f1f2.png</url>
      <title>DEV Community: Vishal Rajput</title>
      <link>https://dev.to/vishal_rajput_310e810159e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vishal_rajput_310e810159e"/>
    <language>en</language>
    <item>
      <title>PHP JIT Compiler</title>
      <dc:creator>Vishal Rajput</dc:creator>
      <pubDate>Tue, 23 Sep 2025 06:23:47 +0000</pubDate>
      <link>https://dev.to/vishal_rajput_310e810159e/php-jit-compiler-4kk1</link>
      <guid>https://dev.to/vishal_rajput_310e810159e/php-jit-compiler-4kk1</guid>
      <description>&lt;h2&gt;
  
  
  PHP JIT Compiler: How It Works and Why It Matters
&lt;/h2&gt;




&lt;p&gt;Introduction&lt;/p&gt;

&lt;p&gt;PHP has traditionally been an interpreted language, which means that every time you run your PHP code, the Zend Engine parses and executes it line by line. With the release of PHP 8.0, a new feature called JIT (Just-In-Time) Compiler was introduced. JIT can significantly speed up certain types of operations by compiling PHP code into machine-level instructions that the CPU can execute directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In this blog, we’ll explore:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What JIT is and how it works in PHP&lt;/li&gt;
&lt;li&gt;How PHP worked before JIT&lt;/li&gt;
&lt;li&gt;A practical example showing the performance difference with and without JIT&lt;/li&gt;
&lt;li&gt;When JIT is most effective&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is a JIT Compiler?
&lt;/h2&gt;

&lt;p&gt;JIT (Just-In-Time) Compilation is a technique used by modern programming languages to improve performance. Instead of interpreting code at runtime (slower), JIT translates frequently used code paths into native machine code that the CPU can execute directly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Benefits:&lt;/strong&gt; Faster execution for CPU-heavy tasks, such as mathematical calculations or image processing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Limitations:&lt;/strong&gt; JIT is not very useful for I/O-heavy operations like database queries, file reading, or network calls, because the bottleneck is not the CPU.&lt;/p&gt;

&lt;p&gt;Think of JIT as a “shortcut” for the CPU. It doesn’t change how PHP works logically, but it executes heavy loops or math operations much faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  How PHP Worked Before JIT
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Before PHP 8.0:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP code is parsed by the Zend Engine.&lt;/li&gt;
&lt;li&gt;The code is converted into opcodes (intermediate instructions).&lt;/li&gt;
&lt;li&gt;The Zend Virtual Machine executes these opcodes line by line.&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;&amp;lt;?php
$a = 0;
for ($i = 0; $i &amp;lt; 1000000; $i++) {
    $a += $i;
}
echo $a;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loop above is interpreted opcode by opcode, which adds overhead for each iteration.&lt;/p&gt;

&lt;p&gt;PHP could be speed up using OPcache, which caches the opcodes in memory to avoid parsing every time, but the interpretation step still exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  How PHP Works With JIT
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;With JIT enabled:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;PHP still generates opcodes.&lt;/li&gt;
&lt;li&gt;Monitoring which parts of the code run often (hot code).&lt;/li&gt;
&lt;li&gt;Compiling just those parts into native machine code.&lt;/li&gt;
&lt;li&gt;Keeping less-used code in interpreted form (no compilation cost wasted).&lt;/li&gt;
&lt;li&gt;The CPU executes the machine code directly, skipping the Zend VM overhead.&lt;/li&gt;
&lt;li&gt;This is especially beneficial for CPU-heavy operations like math, graphics, or scientific computations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Loop Example: With vs Without JIT
&lt;/h2&gt;

&lt;p&gt;Even though we cannot run JIT in your current WAMP setup, here’s a benchmark example showing the expected time difference:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php
function heavyCalc($n) {
    $sum = 0;
    for ($i = 0; $i &amp;lt; $n; $i++) {
        $sum += sqrt($i); // CPU-heavy math operation
    }
    return $sum;
}

$start = hrtime(true);
$result = heavyCalc(1000000000);
$end = hrtime(true);

echo "Result: $result\n";
echo "Execution Time: " . (($end - $start) / 1e+9) . " seconds\n";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;Results&lt;br&gt;
Scenario    Execution Time (approx.)&lt;br&gt;
Without JIT 23.55 seconds&lt;br&gt;
With JIT    13.26 seconds&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Observation:&lt;/strong&gt; There's literally a difference of 10 seconds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; JIT does not significantly improve performance for database queries or other I/O operations, because the bottleneck there is not CPU-bound.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Takeaways
&lt;/h2&gt;

&lt;p&gt;PHP 8+ JIT allows PHP to execute mathematical and CPU-heavy operations much faster.&lt;/p&gt;

&lt;p&gt;Normal web applications that rely on DB queries or API calls may not see a noticeable speed-up.&lt;/p&gt;

&lt;p&gt;JIT works by compiling hot code paths into machine instructions for the CPU.&lt;/p&gt;

&lt;p&gt;Benchmarks show that heavy loops or math operations benefit the most from JIT.&lt;/p&gt;

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

&lt;p&gt;PHP JIT is a powerful addition to PHP 8+, especially for developers working on computational-heavy applications like simulations, games, or image processing. While it doesn’t replace traditional performance optimization for web applications, it opens up new possibilities for CPU-bound PHP programs.&lt;/p&gt;

&lt;p&gt;By understanding how JIT works and where it is effective, developers can write more optimized PHP code for scenarios that benefit the most from native execution.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>php</category>
      <category>jit</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Understanding SOLID Principles</title>
      <dc:creator>Vishal Rajput</dc:creator>
      <pubDate>Fri, 19 Sep 2025 05:22:46 +0000</pubDate>
      <link>https://dev.to/vishal_rajput_310e810159e/understanding-solid-principles-1jg6</link>
      <guid>https://dev.to/vishal_rajput_310e810159e/understanding-solid-principles-1jg6</guid>
      <description>&lt;p&gt;When we build software, the way we organize classes and code matters a lot. Good design makes programs easier to fix, grow, and understand. The SOLID principles are five important rules that help programmers write cleaner and safer code. Let’s break them down with simple explanations and examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Single Responsibility Principle (SRP)
&lt;/h2&gt;

&lt;p&gt;A class should only do one job. And it should have Only one reason to change. Don’t make one class handle too many things. Each class should focus on a single task.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt;: If a class does too much, changing one part can accidentally break another.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Wrong: It Does two jobs
class UserService {
    void createUser(User user) { 
        /* save to DB */ 
    }
    void sendWelcomeEmail(User user) { 
        /* email logic */ 
    }
}

// Right: Split into two classes
class UserRepository {
    void save(User user) { /* save to DB */ }
}

class EmailService {
    void sendWelcomeEmail(User user) { /* email logic */ }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Open/Closed Principle (OCP)
&lt;/h2&gt;

&lt;p&gt;Code should be easy to extend, but you shouldn’t have to change old code. In Simple words: Extending new functionality should not need to change business logic OR Add new features without Modifying tested code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt;: Keeps your system safer and easier to grow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Wrong: Adding a new method means editing this class
class PaymentProcessor {
    void pay(String method) {
        if (method.equals("credit")) { /* credit card */ }
        else if (method.equals("paypal")) { /* PayPal */ }
    }
}

// Right: Add new payment types without changing old code
interface PaymentMethod { void pay(); }

class CreditCardPayment implements PaymentMethod {
    public void pay() { /* credit card logic */ }
}

class PayPalPayment implements PaymentMethod {
    public void pay() { /* PayPal logic */ }
}

class PaymentProcessor {
    void process(PaymentMethod payment) { payment.pay(); }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Liskov Substitution Principle (LSP)
&lt;/h2&gt;

&lt;p&gt;Child classes should work like their parent classes without causing problems. If something works for a parent class, it should also work for a child class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt;: Keeps your program predictable and safe.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Wrong: Ostrich is a bird but can’t fly
class Bird { void fly() { } }
class Ostrich extends Bird { void fly() { throw new UnsupportedOperationException(); } }

// Right: Separate flying birds from non-flying birds
interface Bird {
  void wings();
}

interface FlyingBird extends Bird { void fly(); }

class Sparrow implements FlyingBird {
    public void wings() { /* sparrow has wings */ }
    public void fly() { /* sparrow flies */ }
}

class Ostrich implements Bird { 
    public void wings() { /* Ostrich has wings */ }
    /* no fly method needed */ 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Interface Segregation Principle (ISP)
&lt;/h2&gt;

&lt;p&gt;Don’t force classes to use methods they don’t need. It’s better to have small, specific interfaces instead of one big one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt;: Saves classes from having useless code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Wrong: Printer doesn’t need scan or fax
interface Machine {
    void print();
    void scan();
    void fax();
}

class Printer implements Machine {
    public void print() { }
    public void scan() { throw new UnsupportedOperationException(); }
    public void fax() { throw new UnsupportedOperationException(); }
}

// Right: Smaller, focused interfaces
interface Printer { void print(); }
interface Scanner { void scan(); }
interface Fax { void fax(); }

class BasicPrinter implements Printer {
    public void print() { }
}

class MultiFunctionPrinter implements Printer, Scanner, Fax {
    public void print() { }
    public void scan() { }
    public void fax() { }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Dependency Inversion Principle (DIP)
&lt;/h2&gt;

&lt;p&gt;Depend on ideas, not details. Classes should use interfaces or abstract classes, not fixed code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why&lt;/strong&gt;: Makes systems easier to change and test.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Wrong: Always stuck with MySQL
class UserService {
    private MySQLUserRepository repo = new MySQLUserRepository();
    void createUser(User user) { repo.save(user); }
}

// Right: Can switch databases easily
interface UserRepository { void save(User user); }

class MySQLUserRepository implements UserRepository {
    public void save(User user) { /* MySQL logic */ }
}

class MongoUserRepository implements UserRepository {
    public void save(User user) { /* Mongo logic */ }
}

class UserService {
    private UserRepository repo;
    public UserService(UserRepository repo) { this.repo = repo; } 
    /* Now its depend on Abstraction instead lower level module */
    void createUser(User user) { repo.save(user); }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;SRP =&amp;gt; One class, one job.&lt;/p&gt;

&lt;p&gt;OCP =&amp;gt; Add new features without changing old code.&lt;/p&gt;

&lt;p&gt;LSP =&amp;gt; Subclasses should act like their parent classes.&lt;/p&gt;

&lt;p&gt;ISP =&amp;gt; Use small, simple interfaces.&lt;/p&gt;

&lt;p&gt;DIP =&amp;gt; Depend on ideas, not details.&lt;/p&gt;

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

&lt;p&gt;Following the SOLID principles helps make software easier to change, test, and keep working as it grows. Even though the names sound big, the ideas are simple: write code that is clear, focused, and easy to build on later.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>systemdesign</category>
      <category>programming</category>
      <category>discuss</category>
    </item>
    <item>
      <title>DNS LOOKUP</title>
      <dc:creator>Vishal Rajput</dc:creator>
      <pubDate>Mon, 15 Sep 2025 11:03:25 +0000</pubDate>
      <link>https://dev.to/vishal_rajput_310e810159e/dns-lookup-3d06</link>
      <guid>https://dev.to/vishal_rajput_310e810159e/dns-lookup-3d06</guid>
      <description>&lt;p&gt;When you type &lt;a href="http://www.google.com" rel="noopener noreferrer"&gt;www.google.com&lt;/a&gt; in your browser, have you ever wonder how your computer magically know about where the google server are?&lt;/p&gt;

&lt;p&gt;That's where DNS Lookup comes in, it’s like the phonebook of the internet, translating human-friendly domain names into machine-readable IP addresses.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is DNS Lookup
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;DNS (Domain name system) is system that maps the human readable domain(&lt;a href="http://www.google.com" rel="noopener noreferrer"&gt;www.google.com&lt;/a&gt;) to actuall server IP Address(8.8.8.8).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It is a process that our system perform to get the IP Address behind domain name. Without it, you’d need to remember long strings of numbers instead of simple names.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types of DNS loopup
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1) Forward DNS Lookup:
&lt;/h3&gt;

&lt;p&gt;It map the domain name to server IP Address.&lt;/p&gt;

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

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="http://www.google.com" rel="noopener noreferrer"&gt;www.google.com&lt;/a&gt; &lt;code&gt;//Domain&lt;/code&gt;&lt;br&gt;
8.8.8.8 &lt;code&gt;//Output&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is what happen when you open a website in your browser.&lt;/p&gt;

&lt;h3&gt;
  
  
  2) Reverse DNS Lookup
&lt;/h3&gt;

&lt;p&gt;It map the IP Address → domain name.&lt;/p&gt;

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

&lt;blockquote&gt;
&lt;p&gt;nslookup 8.8.8.8 &lt;code&gt;//Bash Command&lt;/code&gt;&lt;br&gt;
dns.google &lt;code&gt;//output&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Often used for spam filtering, logging, and security.&lt;/p&gt;

&lt;h2&gt;
  
  
  Process of DNS Lookup
&lt;/h2&gt;

&lt;p&gt;Whenever you type a web address in you browser you computer doesn't get the Server IP Address Magically Instead it follows some steps including:&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Browser Cache:
&lt;/h3&gt;

&lt;p&gt;When you visit a website, your browser temporarily stores its IP address. &lt;br&gt;
If you revisit the site within that time frame,&lt;/p&gt;

&lt;p&gt;the Browser says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hey, I already know this IP! No need to ask anyone.  &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and uses the stored IP to connect directly, skipping the next steps. Otherwise, it proceeds to check the OS Cache.&lt;/p&gt;
&lt;h3&gt;
  
  
  2) OS Cache:
&lt;/h3&gt;

&lt;p&gt;If browser doesn't know then it asks the Operating system (Windows, Mac or Linux).&lt;br&gt;
Your operating system keeps a small cache of domain to IP mappings.&lt;br&gt;
On windows you can check it using&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ipconfig /displaydns
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will display all the DNS entries currently stored in your OS cache.&lt;br&gt;
If the OS doesn’t have the answer either, the process moves to the next step.&lt;/p&gt;

&lt;h3&gt;
  
  
  3) Router / ISP Cache
&lt;/h3&gt;

&lt;p&gt;If the OS also doesn’t know, the query travels to your home router or ISP’s (Internet Service Provider) DNS cache.&lt;/p&gt;

&lt;p&gt;ISPs usually store a huge DNS cache because thousands of users often visit the same sites (Google, Facebook, etc.).&lt;/p&gt;

&lt;p&gt;If the Router / ISP also doesn't have answer, process moves to next step.&lt;/p&gt;

&lt;h3&gt;
  
  
  4) Recursive DNS Server
&lt;/h3&gt;

&lt;p&gt;If no cache has the answer, your ISP forwards the request to a recursive DNS server (sometimes also called a resolver).&lt;/p&gt;

&lt;p&gt;Think of it as a detective:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I don’t know the answer, but I’ll ask around until I find it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This server does the heavy lifting of contacting other DNS servers on your behalf.&lt;/p&gt;

&lt;h3&gt;
  
  
  5) Root DNS Servers
&lt;/h3&gt;

&lt;p&gt;The root servers don’t know the exact IP of a website.&lt;/p&gt;

&lt;p&gt;Instead, they act like directory assistants.&lt;/p&gt;

&lt;p&gt;They look at the last part of the domain (the extension, like .com, .org, .in, etc.).&lt;/p&gt;

&lt;p&gt;Based on this extension, they guide the query to the right TLD (Top-Level Domain) server.&lt;/p&gt;

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

&lt;p&gt;You search for example.com.&lt;br&gt;
The root server checks: “This ends with .com.”&lt;br&gt;
Then it says: “Go ask the .com TLD servers; they’ll know who manages example.com.”&lt;/p&gt;

&lt;h3&gt;
  
  
  6) TLD Servers
&lt;/h3&gt;

&lt;p&gt;Once the Root Server directs the query to the correct category (for example, .com), the TLD Servers take over.&lt;/p&gt;

&lt;p&gt;TLD (Top-Level Domain) Servers manage all the domains under that extension (.com, .org, .net, .in, etc.).&lt;/p&gt;

&lt;p&gt;But here’s the catch:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;They don’t know the exact IP address of the website you’re looking for.&lt;br&gt;
Instead, they know which Authoritative DNS Server is responsible for that specific domain.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  7) Authoritative DNS Server
&lt;/h3&gt;

&lt;p&gt;This is the final authority in the DNS lookup chain.&lt;/p&gt;

&lt;p&gt;It’s managed by the domain’s owner or hosting provider (for example, if you bought your domain from GoDaddy or host it on AWS, their DNS server usually acts as authoritative).&lt;/p&gt;

&lt;p&gt;The Authoritative DNS server knows the actual IP address of the website because it holds the domain’s DNS records (like A record, CNAME, MX, TXT, etc.).&lt;/p&gt;

&lt;p&gt;In simple words:&lt;/p&gt;

&lt;p&gt;They are the ones who say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Yes, this domain belongs to me, and here’s its exact IP address.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  8) Response &amp;amp; Caching
&lt;/h3&gt;

&lt;p&gt;Once the Authoritative DNS Server provides the IP address, that information travels back through the entire chain:&lt;br&gt;
Authoritative Server → TLD Server → Root Server → Recursive Resolver → ISP → OS → Browser.&lt;/p&gt;

&lt;p&gt;Finally, your browser has the IP address it needs and can connect directly to the website’s server.🎉&lt;/p&gt;

&lt;p&gt;To avoid repeating this long journey every time, the result is cached at multiple layers:&lt;/p&gt;

&lt;p&gt;Browser Cache → remembers the IP for a short while.&lt;/p&gt;

&lt;p&gt;OS Cache → stores DNS entries system-wide.&lt;/p&gt;

&lt;p&gt;ISP / Recursive Resolver Cache → keeps answers for many users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You search for example.com.&lt;/li&gt;
&lt;li&gt;The Root Server sends you to the .com TLD servers.&lt;/li&gt;
&lt;li&gt;The .com TLD servers say:
“The authoritative DNS server for example.com is at ns1.exampledns.com.”&lt;/li&gt;
&lt;li&gt;Finally, the Authoritative Server looks into its database and replies:
“example.com = 93.184.216.34.”&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Every time you open a website, your device quietly goes through a well-orchestrated journey — from checking its own cache to asking root, TLD, and authoritative servers — all just to find the correct IP address. This entire process, called DNS Lookup, usually happens in milliseconds, but without it, the internet would feel impossible to use.&lt;/p&gt;

&lt;p&gt;By understanding how DNS Lookup works, you can better appreciate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Why websites load faster after the first visit (thanks to caching).&lt;/li&gt;
&lt;li&gt;Why DNS errors sometimes occur (when servers can’t resolve the IP).&lt;/li&gt;
&lt;li&gt;Why TTL and DNS management matter for developers and businesses.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In short, DNS is the hidden backbone of the internet — making sure that the names we type are always translated into the machines’ language of numbers, so we can browse, connect, and explore without ever thinking twice.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>systemdesign</category>
      <category>discuss</category>
    </item>
    <item>
      <title>React Re-render Behind the scene.</title>
      <dc:creator>Vishal Rajput</dc:creator>
      <pubDate>Fri, 12 Sep 2025 04:28:07 +0000</pubDate>
      <link>https://dev.to/vishal_rajput_310e810159e/react-re-render-behind-the-scene-1fp4</link>
      <guid>https://dev.to/vishal_rajput_310e810159e/react-re-render-behind-the-scene-1fp4</guid>
      <description>&lt;p&gt;&lt;a href="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%2Fd4hutd5y5thmvkkrk7uh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="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%2Fd4hutd5y5thmvkkrk7uh.jpg" alt="React Re-rendering" width="800" height="800"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useState } from 'react'
const App = () =&amp;gt; {
  const [count, setCount] = useState(0);

  const handleClick = () =&amp;gt; {
    setCount(count + 1);
    console.log(count);
  }

  return(
    &amp;lt;button onClick={handleClick}&amp;gt;Click Me&amp;lt;/button&amp;gt;
  )
}

export default App
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When I first ran this code and clicked the button, I noticed that the console logged the previous value of count. I always wondered why this happened-because I was updating the state by incrementing it by 1. However, the console didn't show the latest value, only the old one.&lt;br&gt;
But that's not the case - it happens because of re-rendering. In React, re-rendering occurs whenever we update the state value. However, that doesn't mean React re-renders immediately with the new value. Instead, it follows a series of steps.&lt;/p&gt;

&lt;p&gt;Whenever React encounters setState(), it schedules a re-render. After all synchronous code has finished executing, React then carries out the re-rendering process. This includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Creating the Virtual DOM with the updated state.&lt;/li&gt;
&lt;li&gt;Comparing it with the previous Virtual DOM (diffing).&lt;/li&gt;
&lt;li&gt;Updating only the necessary parts of the actual DOM (reconciliation).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's just like a team leader telling a developer: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Do this task, but only after you finish your current pending work."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So as per our example code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [count, setCount] = useState(0);

const handleClick = () =&amp;gt; {
   setCount(count + 1);
   console.log(count);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we click the button, React encounters setState() and schedules a re-render. It then moves on to the next line: console.log(count). At this moment, the value of count is still 0, so React logs 0 in the console.&lt;/p&gt;

&lt;p&gt;After logging, there's no more code left to execute inside the function. Only then does React begin the re-rendering process, and the component is rendered again with the updated value of count.&lt;/p&gt;

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

&lt;p&gt;This is why you see the "previous" value in the console when updating state. React doesn't block execution and update the state immediately - it schedules the update, finishes the current synchronous work, and only then re-renders the component with the new state.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
