<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Tech Atlas - Your Guide to Tech Trends, AI Innovations, and SaaS Insights]]></title><description><![CDATA[Discover cutting-edge tech trends, AI breakthroughs, and actionable SaaS ideas with Tech Atlas. Empowering developers and entrepreneurs with insights and career tips for success.]]></description><link>https://blogs.anmolagrawal.dev</link><image><url>https://cdn.hashnode.com/res/hashnode/image/upload/v1755903212519/0f2442b7-48b2-4764-af47-a1f389bf3a37.png</url><title>Tech Atlas - Your Guide to Tech Trends, AI Innovations, and SaaS Insights</title><link>https://blogs.anmolagrawal.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 04:38:21 GMT</lastBuildDate><atom:link href="https://blogs.anmolagrawal.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Perplexity: The Answer Engine's Existential Challenge]]></title><description><![CDATA[As a developer and long-time observer of the AI space, I've watched the rise of Perplexity AI with a mix of admiration and professional skepticism. The platform is undeniably innovative, offering a clean, conversational interface that cuts through th...]]></description><link>https://blogs.anmolagrawal.dev/perplexity-the-answer-engines-existential-challenge</link><guid isPermaLink="true">https://blogs.anmolagrawal.dev/perplexity-the-answer-engines-existential-challenge</guid><category><![CDATA[#perplexity.ai]]></category><category><![CDATA[Search Engines]]></category><category><![CDATA[AI]]></category><category><![CDATA[generative ai]]></category><category><![CDATA[AI Search Engine]]></category><dc:creator><![CDATA[Anmol Agrawal]]></dc:creator><pubDate>Fri, 22 Aug 2025 21:03:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1755884863513/bd66b91f-b7ea-4312-a3f0-47e75f880976.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>As a developer and long-time observer of the AI space, I've watched the rise of Perplexity AI with a mix of admiration and professional skepticism. The platform is undeniably innovative, offering a clean, conversational interface that cuts through the clutter of traditional search results. It has demonstrated a clear demand for direct, AI-powered answers, securing a recent valuation of approximately <strong>$18 billion</strong> and boasting over 20 million users.</p>
<p>However, beneath its polished user interface and rapid growth lies a fundamental challenge that gets to the heart of what it takes to be a truly independent technology company.</p>
<h3 id="heading-the-core-dependency-problem">The Core Dependency Problem</h3>
<p>Perplexity's primary strength is providing direct, cited answers with real-time information, which is also its most significant vulnerability. The platform's ability to fetch up-to-the-minute web data relies heavily on accessing search APIs from major tech companies like Google and, most notably, Bing. This creates a critical layer of dependency that cannot be overstated.</p>
<p>While Perplexity has been transparent about its efforts to build its own infrastructure, including the PerplexityBot crawler and proprietary indexing systems, this in-house technology is still developing. At present, it complements rather than fully replaces the comprehensive data provided by external APIs. The reality is that Perplexity is not yet a search engine; it's an intelligent interface that sits on top of existing search infrastructure.</p>
<p><strong>The immediate risk:</strong> If external search APIs restrict or withdraw access, a move that would be rational in a competitive landscape, Perplexity would lose its core functionality, reducing it to a high-quality but data-limited chatbot.</p>
<h3 id="heading-the-technical-amp-financial-challenge-of-independence">The Technical &amp; Financial Challenge of Independence</h3>
<p>Building a truly independent search engine is not just an engineering challenge, it's an Everest-level undertaking.</p>
<p>Consider the scale: Google processes approximately 8.5 billion searches per day and maintains an index of trillions of pages. Replicating this requires:</p>
<ul>
<li><p><strong>Massive Capital:</strong> The operating costs for comprehensive crawling, indexing, and serving a global search engine can easily run into the hundreds of millions to billions of dollars annually. This cost far exceeds Perplexity's current annual revenue, estimated at under <strong>$150 million</strong> as of mid-2025.</p>
</li>
<li><p><strong>Years</strong> <strong>of Refinement:</strong> Google's ranking algorithms are the product of decades of optimization and massive computational resources, built by an army of world-class engineers. They are finely tuned to provide relevance at a scale that is almost impossible to imagine, let alone replicate from scratch. While modern AI approaches can shorten this timeline, achieving comparable quality and relevance is still enormously difficult.</p>
</li>
</ul>
<h3 id="heading-the-competition-is-closing-the-gap">The Competition is Closing the Gap</h3>
<p>Perplexity's early advantage was its ability to synthesize search results into a coherent, conversational answer with citations. Today, that advantage has been significantly eroded by the very companies it depends on.</p>
<ul>
<li><p><strong>OpenAI's Direct Challenge:</strong> As of late 2024, ChatGPT integrated direct web search with inline citations. This move eliminates a primary reason for many users to switch to Perplexity.</p>
</li>
<li><p><strong>Google's Integrated Approach:</strong> Google’s Gemini AI models now have deep integration with Google Search. This gives the company an almost insurmountable advantage, as it can ground its AI answers in its own decades-old, proprietary, and comprehensive web index.</p>
</li>
</ul>
<h3 id="heading-strategic-paths-forward">Strategic Paths Forward</h3>
<p>Perplexity's leadership is acutely aware of these challenges and is already executing on a multifaceted strategy to address them. The company's recent actions demonstrate a clear shift away from being a simple search interface to a more robust and specialized technology company.</p>
<ul>
<li><p><strong>Vertical Specialization:</strong> Perplexity is focusing on high-value, data-rich verticals where it can develop a competitive advantage. The launch of its <strong>Shopping Hub</strong> (November 2024) and <strong>Finance</strong> features (October 2024), along with partnerships with key data providers, are concrete examples.</p>
</li>
<li><p><strong>Controlling the Stack:</strong> In a bold move to reduce dependency on external browsers and search engines, Perplexity launched its <strong>Comet browser</strong> in July 2025. This is a direct attempt to own the user experience end to end, much like Google's strategy with Chrome.</p>
</li>
<li><p><strong>Strategic Marketing &amp; Partnerships:</strong> The company's high-profile, unsolicited <strong>$34.5 billion bid for Google Chrome</strong> was widely viewed as a brilliant PR stunt. It served two purposes: to generate massive media coverage and to loudly signal that Perplexity is a serious player that understands the importance of owning the user-facing technology stack. The partnerships with major telecom companies like <strong>Airtel</strong> and <strong>Xfinity</strong> to offer Pro subscriptions are also a savvy move to scale users and build a sustainable revenue base.</p>
</li>
</ul>
<h3 id="heading-conclusion">Conclusion</h3>
<p>Perplexity AI represents a genuine breakthrough in how we interact with information, but its long-term viability depends on whether it can transition from being an impressive but dependent layer on top of others' infrastructure to a truly independent technology company.</p>
<p>The next 12–18 months will be critical. Its future depends on whether specialization, partnerships, and aggressive moves to own the user experience can overcome the existential challenge of foundational dependency.</p>
<p>Perplexity’s next chapter hinges on proving whether it can transition from an impressive “intelligent layer” to a fully independent platform. If it succeeds, it may define the standard for AI-first information retrieval. If it fails, it risks being remembered as the pioneer that showed the way before bigger players with deeper infrastructure claimed the crown.</p>
<hr />
<h3 id="heading-references">References</h3>
<ul>
<li><p><a target="_blank" href="https://en.wikipedia.org/wiki/Perplexity_AI">Perplexity AI - Wikipedia</a></p>
</li>
<li><p><a target="_blank" href="https://www.bloomberg.com/news/articles/2025-07-17/ai-startup-perplexity-valued-at-18-billion-with-new-funding">AI Startup Perplexity Valued at $18 Billion With New Funding - Bloomberg</a></p>
</li>
<li><p><a target="_blank" href="https://openai.com/index/introducing-chatgpt-search/">Introducing ChatGPT search - OpenAI</a></p>
</li>
<li><p><a target="_blank" href="https://ai.google.dev/gemini-api/docs/google-search">Grounding with Google Search - Gemini API</a></p>
</li>
<li><p><a target="_blank" href="https://www.perplexity.ai/hub/blog/introducing-pplx-online-llms">Introducing PPLX Online LLMs - Perplexity</a></p>
</li>
<li><p><a target="_blank" href="https://andrewkchan.dev/posts/crawler.html">Crawling a billion web pages in just over 24 hours, in 2025</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Node.js Brief Board]]></title><description><![CDATA[Overview

Node.js: Open-source, cross-platform JavaScript runtime for server-side development.

Built on Chrome's V8 JavaScript engine.

Non-blocking, event-driven, and highly scalable.


Core Features

Asynchronous & Non-blocking: Efficiently handle...]]></description><link>https://blogs.anmolagrawal.dev/nodejs-brief-board</link><guid isPermaLink="true">https://blogs.anmolagrawal.dev/nodejs-brief-board</guid><category><![CDATA[brief-board]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[interview]]></category><dc:creator><![CDATA[Anmol Agrawal]]></dc:creator><pubDate>Tue, 14 Jan 2025 03:30:14 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1736431377315/5bcac270-1678-40f5-b420-d555d12ea340.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h4 id="heading-overview"><strong>Overview</strong></h4>
<ul>
<li><p><strong>Node.js</strong>: Open-source, cross-platform JavaScript runtime for server-side development.</p>
</li>
<li><p>Built on <strong>Chrome's V8</strong> JavaScript engine.</p>
</li>
<li><p>Non-blocking, event-driven, and highly scalable.</p>
</li>
</ul>
<h4 id="heading-core-features"><strong>Core Features</strong></h4>
<ol>
<li><p><strong>Asynchronous &amp; Non-blocking</strong>: Efficiently handles multiple requests.</p>
</li>
<li><p><strong>Event Loop</strong>: Single-threaded but manages concurrency effectively.</p>
</li>
<li><p><strong>Fast Execution</strong>: Powered by the V8 engine.</p>
</li>
<li><p><strong>Modular Architecture</strong>: Thousands of libraries are available via npm.</p>
</li>
</ol>
<hr />
<h4 id="heading-key-components"><strong>Key Components</strong></h4>
<ul>
<li><p><strong>Event Loop</strong>: Executes callbacks in phases.</p>
</li>
<li><p><strong>Libuv</strong>: Provides asynchronous I/O and thread pooling.</p>
</li>
<li><p><strong>Modules</strong>: Includes <code>fs</code>, <code>http</code>, <code>path</code>, and more.</p>
</li>
</ul>
<hr />
<h4 id="heading-common-use-cases"><strong>Common Use Cases</strong></h4>
<ul>
<li><p>RESTful APIs</p>
</li>
<li><p>Real-time applications (e.g., chat apps)</p>
</li>
<li><p>Microservices</p>
</li>
<li><p>Serverless architectures</p>
</li>
</ul>
<hr />
<h4 id="heading-coding-snippet-http-server"><strong>Coding Snippet: HTTP Server</strong></h4>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> http = <span class="hljs-built_in">require</span>(<span class="hljs-string">'http'</span>);
<span class="hljs-keyword">const</span> server = http.createServer(<span class="hljs-function">(<span class="hljs-params">req, res</span>) =&gt;</span> {
  res.statusCode = <span class="hljs-number">200</span>;
  res.setHeader(<span class="hljs-string">'Content-Type'</span>, <span class="hljs-string">'text/plain'</span>);
  res.end(<span class="hljs-string">'Hello, World!'</span>);
});
server.listen(<span class="hljs-number">3000</span>, <span class="hljs-function">() =&gt;</span> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Server running on port 3000'</span>));
</code></pre>
<hr />
<h4 id="heading-error-handling"><strong>Error Handling</strong></h4>
<ol>
<li><p><strong>Synchronous Code</strong>: Use <code>try-catch</code> blocks.</p>
</li>
<li><p><strong>Async Code</strong>:</p>
<ul>
<li><p>Promises: <code>.catch()</code> for error handling.</p>
</li>
<li><p>Async/Await: Wrap in <code>try-catch</code>.</p>
</li>
</ul>
</li>
<li><p><strong>Global Errors</strong>:</p>
<ul>
<li><p><code>uncaughtException</code> for unhandled exceptions.</p>
</li>
<li><p><code>unhandledRejection</code> for rejected Promises.</p>
</li>
</ul>
</li>
<li><p><strong>Example</strong>:</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">try</span> {
   <span class="hljs-keyword">const</span> data = <span class="hljs-keyword">await</span> fetchData();
 } <span class="hljs-keyword">catch</span> (err) {
   <span class="hljs-built_in">console</span>.error(<span class="hljs-string">'Error:'</span>, err.message);
 }
</code></pre>
</li>
</ol>
<hr />
<h4 id="heading-security"><strong>Security</strong></h4>
<ol>
<li><p><strong>Input Validation</strong>: Prevent injection attacks using libraries like <code>validator</code> or <code>Joi</code>.</p>
</li>
<li><p><strong>HTTPS</strong>: Always use encrypted connections.</p>
</li>
<li><p><strong>Environment Variables</strong>: Secure sensitive data using <code>dotenv</code>.</p>
</li>
<li><p><strong>Best Practices</strong>:</p>
<ul>
<li><p>Implement CORS to restrict access.</p>
</li>
<li><p>Use <code>helmet</code> to set HTTP headers.</p>
</li>
<li><p>Apply rate-limiting to prevent DDoS attacks.</p>
</li>
</ul>
</li>
</ol>
<hr />
<h4 id="heading-performance-optimization"><strong>Performance Optimization</strong></h4>
<ol>
<li><p><strong>Clustering</strong>: Utilize multiple CPU cores with the <code>cluster</code> module.</p>
</li>
<li><p><strong>Caching</strong>:</p>
<ul>
<li><p>Use tools like <strong>Redis</strong> to cache data.</p>
</li>
<li><p>Avoid repeated database queries.</p>
</li>
</ul>
</li>
<li><p><strong>Asynchronous Code</strong>: Replace the blocking code with an async operation.</p>
</li>
<li><p><strong>Example - Clustering</strong>:</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">const</span> cluster = <span class="hljs-built_in">require</span>(<span class="hljs-string">'cluster'</span>);
 <span class="hljs-keyword">const</span> os = <span class="hljs-built_in">require</span>(<span class="hljs-string">'os'</span>);

 <span class="hljs-keyword">if</span> (cluster.isMaster) {
   <span class="hljs-keyword">const</span> cpuCount = os.cpus().length;
   <span class="hljs-keyword">for</span> (<span class="hljs-keyword">let</span> i = <span class="hljs-number">0</span>; i &lt; cpuCount; i++) cluster.fork();
 } <span class="hljs-keyword">else</span> {
   <span class="hljs-comment">// Worker logic</span>
   <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Worker <span class="hljs-subst">${process.pid}</span> started`</span>);
 }
</code></pre>
</li>
</ol>
<hr />
<h4 id="heading-package-management"><strong>Package Management</strong></h4>
<ul>
<li><p><strong>npm</strong>: Manage dependencies and scripts.</p>
</li>
<li><p>Key commands: <code>npm install</code>, <code>npm run</code>, <code>npm update</code>.</p>
</li>
<li><p>Central file: <code>package.json</code> (metadata and dependencies).</p>
</li>
</ul>
<hr />
<h4 id="heading-advantages"><strong>Advantages</strong></h4>
<ul>
<li><p>High performance for I/O-bound tasks.</p>
</li>
<li><p>A huge ecosystem of libraries via npm.</p>
</li>
<li><p>Easy to learn for JavaScript developers.</p>
</li>
</ul>
<h4 id="heading-limitations"><strong>Limitations</strong></h4>
<ul>
<li><p>Not ideal for CPU-intensive tasks.</p>
</li>
<li><p>Callback hell (mitigated with Promises/async-await).</p>
</li>
</ul>
<hr />
<h4 id="heading-further-reading"><strong>Further Reading</strong></h4>
<ul>
<li><p><a target="_blank" href="https://nodejs.org">Official Node.js Documentation</a></p>
</li>
<li><p><a target="_blank" href="https://www.npmjs.com">npm Package Registry</a></p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Docker Brief Board]]></title><description><![CDATA[Overview

Docker: Open-source platform for containerization.
Container: Lightweight, portable unit for running applications with all dependencies.
Images: Read-only templates used to create containers.
Docker Engine: Core service running Docker.


Ke...]]></description><link>https://blogs.anmolagrawal.dev/docker</link><guid isPermaLink="true">https://blogs.anmolagrawal.dev/docker</guid><category><![CDATA[Docker]]></category><category><![CDATA[docker images]]></category><category><![CDATA[Docker compose]]></category><category><![CDATA[interview]]></category><dc:creator><![CDATA[Anmol Agrawal]]></dc:creator><pubDate>Fri, 10 Jan 2025 03:30:45 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1736368106747/ec4bb8fd-9173-4efe-bbfc-292ef682863c.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-overview">Overview</h2>
<ul>
<li><strong>Docker</strong>: Open-source platform for containerization.</li>
<li><strong>Container</strong>: Lightweight, portable unit for running applications with all dependencies.</li>
<li><strong>Images</strong>: Read-only templates used to create containers.</li>
<li><strong>Docker Engine</strong>: Core service running Docker.</li>
</ul>
<hr />
<h2 id="heading-key-concepts">Key Concepts</h2>
<h3 id="heading-images">Images</h3>
<ul>
<li>Built using <strong>Dockerfiles</strong>.</li>
<li>Pulled from <strong>Docker Hub</strong> or other registries.</li>
<li>Can be layered and cached.</li>
</ul>
<h3 id="heading-containers">Containers</h3>
<ul>
<li>Instances of Docker images.</li>
<li>Created, started, stopped, and removed as needed.</li>
<li>Stateless by default (use volumes for persistence).</li>
</ul>
<h3 id="heading-dockerfile">Dockerfile</h3>
<ul>
<li>Script to define how an image is built.</li>
<li>Key commands:<ul>
<li><code>FROM</code>: Base image.</li>
<li><code>RUN</code>: Execute commands during image build.</li>
<li><code>COPY</code>/<code>ADD</code>: Add files.</li>
<li><code>CMD</code>: Default container command.</li>
<li><code>EXPOSE</code>: Declare port.</li>
</ul>
</li>
</ul>
<h3 id="heading-volumes">Volumes</h3>
<ul>
<li>Used to persist data outside the container lifecycle.</li>
<li>Types:<ul>
<li><strong>Anonymous</strong>: No name, tied to container lifecycle.</li>
<li><strong>Named</strong>: Managed explicitly.</li>
<li><strong>Bind Mounts</strong>: Link host directory to container.</li>
</ul>
</li>
</ul>
<hr />
<h2 id="heading-docker-commands">Docker Commands</h2>
<p><strong>1. Images</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Command</strong></td><td><strong>Description</strong></td></tr>
</thead>
<tbody>
<tr>
<td><code>docker images</code></td><td>List images.</td></tr>
<tr>
<td><code>docker build -t &lt;tag&gt; .</code></td><td>Build an image from a <code>Dockerfile</code>.</td></tr>
<tr>
<td><code>docker rmi &lt;image&gt;</code></td><td>Remove an image.</td></tr>
</tbody>
</table>
</div><p><strong>2. Containers</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Command</strong></td><td><strong>Description</strong></td></tr>
</thead>
<tbody>
<tr>
<td><code>docker ps</code></td><td>List running containers.</td></tr>
<tr>
<td><code>docker ps -a</code></td><td>List all containers (including stopped).</td></tr>
<tr>
<td><code>docker run -d -p 8080:80 &lt;image&gt;</code></td><td>Run a container in detached mode, mapping ports.</td></tr>
<tr>
<td><code>docker exec -it &lt;container&gt; bash</code></td><td>Access a container's shell.</td></tr>
<tr>
<td><code>docker stop &lt;container&gt;</code></td><td>Stop a running container.</td></tr>
<tr>
<td><code>docker rm &lt;container&gt;</code></td><td>Remove a container.</td></tr>
</tbody>
</table>
</div><p><strong>3. Volumes</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Command</strong></td><td><strong>Description</strong></td></tr>
</thead>
<tbody>
<tr>
<td><code>docker volume create &lt;name&gt;</code></td><td>Create a volume.</td></tr>
<tr>
<td><code>docker run -v &lt;volume&gt;:/path &lt;image&gt;</code></td><td>Mount a volume to a container.</td></tr>
</tbody>
</table>
</div><p><strong>4. Networks</strong></p>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Command</strong></td><td><strong>Description</strong></td></tr>
</thead>
<tbody>
<tr>
<td><code>docker network ls</code></td><td>List networks.</td></tr>
<tr>
<td><code>docker network create &lt;name&gt;</code></td><td>Create a network.</td></tr>
<tr>
<td><code>docker run --network &lt;name&gt; &lt;image&gt;</code></td><td>Connect a container to a network.</td></tr>
</tbody>
</table>
</div><hr />
<h2 id="heading-networking">Networking</h2>
<ul>
<li><strong>Bridge</strong>: Default, isolates containers.</li>
<li><strong>Host</strong>: Shares host network stack.</li>
<li><strong>None</strong>: Disables networking.</li>
<li>Ports: Use <code>-p &lt;host&gt;:&lt;container&gt;</code> to map.</li>
</ul>
<hr />
<h2 id="heading-docker-compose">Docker Compose</h2>
<ul>
<li>Tool for defining and running multi-container applications using <code>docker-compose.yml</code>.</li>
<li>Common commands:<ul>
<li><code>docker-compose up</code>: Start services.</li>
<li><code>docker-compose down</code>: Stop services.</li>
</ul>
</li>
<li>Example <code>docker-compose.yml</code>:<pre><code class="lang-yaml"><span class="hljs-attr">version:</span> <span class="hljs-string">'3'</span>
<span class="hljs-attr">services:</span>
  <span class="hljs-attr">app:</span>
    <span class="hljs-attr">build:</span> <span class="hljs-string">.</span>
    <span class="hljs-attr">ports:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">"8080:80"</span>
    <span class="hljs-attr">volumes:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">.:/app</span>
    <span class="hljs-attr">networks:</span>
      <span class="hljs-bullet">-</span> <span class="hljs-string">app-network</span>
<span class="hljs-attr">networks:</span>
  <span class="hljs-attr">app-network:</span>
</code></pre>
</li>
</ul>
<hr />
<h2 id="heading-key-features">Key Features</h2>
<ul>
<li><strong>Portability</strong>: Run containers on any system with Docker installed.</li>
<li><strong>Isolation</strong>: Separate applications and their dependencies.</li>
<li><strong>Efficiency</strong>: Shares OS kernel, uses less memory compared to VMs.</li>
<li><strong>Scalability</strong>: Easily scale applications using orchestration tools like Kubernetes.</li>
</ul>
<hr />
<h2 id="heading-best-practices">Best Practices</h2>
<ul>
<li>Use lightweight base images (e.g., <code>alpine</code>).</li>
<li>Minimize layers in the <code>Dockerfile</code>.</li>
<li>Use <code>.dockerignore</code> to exclude unnecessary files.</li>
<li>Keep containers stateless; externalize state using volumes.</li>
<li>Tag images properly for version control.</li>
<li>Use volumes for persistent data storage.</li>
</ul>
<hr />
<h2 id="heading-debugging">Debugging</h2>
<div class="hn-table">
<table>
<thead>
<tr>
<td><strong>Command</strong></td><td><strong>Description</strong></td></tr>
</thead>
<tbody>
<tr>
<td><code>docker inspect &lt;container&gt;</code></td><td>Detailed info.</td></tr>
<tr>
<td><code>docker stats</code></td><td>Monitor resource usage.</td></tr>
<tr>
<td><code>docker system prune</code></td><td>Clean up unused data.</td></tr>
</tbody>
</table>
</div><hr />
<h2 id="heading-advanced">Advanced</h2>
<ul>
<li><strong>Docker Swarm</strong>: Native clustering and orchestration.</li>
<li><strong>Kubernetes</strong>: Advanced orchestration (Docker often used for runtime).</li>
<li><strong>Multi-stage Builds</strong>: Optimize images by separating build and runtime dependencies.</li>
</ul>
<hr />
<h2 id="heading-resources">Resources</h2>
<ul>
<li><a target="_blank" href="https://docs.docker.com/">Docker Documentation</a></li>
<li><a target="_blank" href="https://hub.docker.com/">Docker Hub</a></li>
</ul>
<hr />
]]></content:encoded></item><item><title><![CDATA[Apache Kafka Brief Board]]></title><description><![CDATA[Overview

Kafka: A distributed event-streaming platform designed for high-throughput and fault-tolerant data pipelines and real-time data processing.

Core Concepts:

Producer: Sends records to Kafka topics.

Consumer: Reads records from Kafka topics...]]></description><link>https://blogs.anmolagrawal.dev/kafka</link><guid isPermaLink="true">https://blogs.anmolagrawal.dev/kafka</guid><category><![CDATA[kafka]]></category><category><![CDATA[interview]]></category><category><![CDATA[streaming]]></category><dc:creator><![CDATA[Anmol Agrawal]]></dc:creator><pubDate>Wed, 08 Jan 2025 19:58:32 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1736365439208/b0c6b658-3dc6-4eb2-bfb1-897df8d12d28.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-overview"><strong>Overview</strong></h2>
<ul>
<li><p><strong>Kafka</strong>: A distributed event-streaming platform designed for high-throughput and fault-tolerant data pipelines and real-time data processing.</p>
</li>
<li><p><strong>Core Concepts</strong>:</p>
<ul>
<li><p><strong>Producer</strong>: Sends records to Kafka topics.</p>
</li>
<li><p><strong>Consumer</strong>: Reads records from Kafka topics.</p>
</li>
<li><p><strong>Broker</strong>: A Kafka server managing storage and distribution.</p>
</li>
<li><p><strong>Topic</strong>: Logical channels for organizing messages.</p>
</li>
<li><p><strong>Partition</strong>: A subdivision of a topic for parallelism.</p>
</li>
<li><p><strong>Offset</strong>: Unique identifier for messages in a partition.</p>
</li>
</ul>
</li>
</ul>
<hr />
<h2 id="heading-key-components"><strong>Key Components</strong></h2>
<ol>
<li><p><strong>Producer</strong>:</p>
<ul>
<li><p>Pushes messages to topics.</p>
</li>
<li><p>Can specify the partition (or let Kafka auto-assign).</p>
</li>
<li><p>Provides <strong>acknowledgment modes</strong>:</p>
<ul>
<li><p><code>acks=0</code> (no acknowledgment).</p>
</li>
<li><p><code>acks=1</code> (leader acknowledgment).</p>
</li>
<li><p><code>acks=all</code> (all replicas acknowledge).</p>
</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Consumer</strong>:</p>
<ul>
<li><p>Pulls messages from topics.</p>
</li>
<li><p>Tracks the <strong>offset</strong> for consumed messages (via Kafka or custom storage).</p>
</li>
<li><p>Belongs to a <strong>Consumer Group</strong>:</p>
<ul>
<li><p>Enables load balancing among consumers.</p>
</li>
<li><p>Each partition is consumed by only one consumer in a group.</p>
</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>Broker</strong>:</p>
<ul>
<li><p>Kafka server handling message storage and replication.</p>
</li>
<li><p>Distributes load and ensures durability.</p>
</li>
</ul>
</li>
<li><p><strong>Topic</strong>:</p>
<ul>
<li><p>Organizes messages logically.</p>
</li>
<li><p><strong>Replication Factor</strong>: Number of copies of the topic across brokers (fault-tolerance).</p>
</li>
<li><p><strong>Partitions</strong>:</p>
<ul>
<li><p>Enable parallelism.</p>
</li>
<li><p>Each partition is assigned to a broker.</p>
</li>
</ul>
</li>
</ul>
</li>
<li><p><strong>ZooKeeper</strong> (legacy):</p>
<ul>
<li><p>Manages metadata, leader election, and configuration.</p>
</li>
<li><p>Being replaced by <strong>Kafka Raft (KRaft)</strong> in newer versions.</p>
</li>
</ul>
</li>
</ol>
<hr />
<h2 id="heading-core-features"><strong>Core Features</strong></h2>
<ul>
<li><p><strong>High Throughput &amp; Scalability</strong>: Handles millions of messages per second.</p>
</li>
<li><p><strong>Durability</strong>: Messages are written to disk and replicated.</p>
</li>
<li><p><strong>Fault-Tolerance</strong>: Replication ensures data availability even if brokers fail.</p>
</li>
<li><p><strong>Log-Based Storage</strong>:</p>
<ul>
<li><p>Messages are appended to the end of a log.</p>
</li>
<li><p>Retention policies: time-based or size-based.</p>
</li>
</ul>
</li>
</ul>
<hr />
<h2 id="heading-key-apis"><strong>Key APIs</strong></h2>
<ol>
<li><p><strong>Producer API</strong>: Publishes messages to topics.</p>
</li>
<li><p><strong>Consumer API</strong>: Subscribes to topics and processes messages.</p>
</li>
<li><p><strong>Streams API</strong>: Builds stream-processing applications.</p>
</li>
<li><p><strong>Connect API</strong>: Connects Kafka to external systems (e.g., databases, file systems).</p>
</li>
</ol>
<hr />
<h2 id="heading-common-patterns"><strong>Common Patterns</strong></h2>
<ul>
<li><p><strong>Pub-Sub</strong>:</p>
<ul>
<li><p>Producers publish messages.</p>
</li>
<li><p>Multiple consumers can subscribe.</p>
</li>
</ul>
</li>
<li><p><strong>Message Queue</strong>:</p>
<ul>
<li>Each message is processed by one consumer in a group.</li>
</ul>
</li>
<li><p><strong>Event Sourcing</strong>:</p>
<ul>
<li>Log all state changes as events for replayability.</li>
</ul>
</li>
</ul>
<hr />
<h2 id="heading-important-configurations"><strong>Important Configurations</strong></h2>
<ul>
<li><p><strong>Producer</strong>:</p>
<ul>
<li><p><code>batch.size</code>: Controls batch size for improved throughput.</p>
</li>
<li><p><code>linger.ms</code>: Delays sending messages to increase batching.</p>
</li>
</ul>
</li>
<li><p><strong>Consumer</strong>:</p>
<ul>
<li><p><code>auto.offset.reset</code>: Behavior for unreadable offsets (<code>latest</code>/<code>earliest</code>).</p>
</li>
<li><p><code>enable.auto.commit</code>: Automatically commits offsets (default: true).</p>
</li>
</ul>
</li>
</ul>
<hr />
<h2 id="heading-monitoring-metrics"><strong>Monitoring Metrics</strong></h2>
<ul>
<li><p><strong>Lag</strong>: Difference between produced and consumed offsets.</p>
</li>
<li><p><strong>ISR (In-Sync Replicas)</strong>: Brokers with the latest partition data.</p>
</li>
<li><p><strong>Under-replicated Partitions</strong>: Partitions with fewer replicas than the replication factor.</p>
</li>
</ul>
<hr />
<h2 id="heading-common-commands"><strong>Common Commands</strong></h2>
<ul>
<li><p>List topics: <code>kafka-topics.sh --list --bootstrap-server &lt;broker&gt;</code></p>
</li>
<li><p>Create a topic:</p>
<pre><code class="lang-bash">  kafka-topics.sh --create --topic &lt;topic_name&gt; \
    --bootstrap-server &lt;broker&gt; \
    --partitions &lt;num&gt; --replication-factor &lt;num&gt;
</code></pre>
</li>
<li><p>Produce messages: <code>kafka-console-producer.sh --topic &lt;topic&gt; --bootstrap-server &lt;broker&gt;</code></p>
</li>
<li><p>Consume messages: <code>kafka-console-consumer.sh --topic &lt;topic&gt; --bootstrap-server &lt;broker&gt;</code></p>
</li>
</ul>
<hr />
<h2 id="heading-pros-amp-use-cases"><strong>Pros &amp; Use Cases</strong></h2>
<ul>
<li><p><strong>Pros</strong>:</p>
<ul>
<li><p>High performance and scalability.</p>
</li>
<li><p>Fault tolerance and durability.</p>
</li>
<li><p>Flexible APIs for multiple use cases.</p>
</li>
</ul>
</li>
<li><p><strong>Use Cases</strong>:</p>
<ul>
<li><p>Real-time analytics.</p>
</li>
<li><p>Event sourcing.</p>
</li>
<li><p>Log aggregation.</p>
</li>
<li><p>Data integration pipelines.</p>
</li>
</ul>
</li>
</ul>
<hr />
<h2 id="heading-gotchas"><strong>Gotchas</strong></h2>
<ul>
<li><p>Ensure proper replication for fault tolerance.</p>
</li>
<li><p>Monitor consumer lag to avoid data processing delays.</p>
</li>
<li><p>Balance partitioning for optimal resource utilization.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[React.js Conceptual Questions]]></title><description><![CDATA[1. What is React, and why is it used?
React is a JavaScript library created by Meta (formerly Facebook) for building user interfaces. It allows developers to create complex UIs by combining smaller, reusable components. React uses a virtual DOM to im...]]></description><link>https://blogs.anmolagrawal.dev/reactjs</link><guid isPermaLink="true">https://blogs.anmolagrawal.dev/reactjs</guid><category><![CDATA[React]]></category><category><![CDATA[interview]]></category><category><![CDATA[interview questions]]></category><dc:creator><![CDATA[Anmol Agrawal]]></dc:creator><pubDate>Wed, 08 Jan 2025 16:19:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1736367911006/e472d825-c5b2-45e1-96af-cacd087c727a.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-1-what-is-react-and-why-is-it-used">1. What is React, and why is it used?</h2>
<p>React is a JavaScript library created by <strong>Meta</strong> (formerly Facebook) for building user interfaces. It allows developers to create complex UIs by combining smaller, reusable components. React uses a <strong>virtual DOM</strong> to improve performance and provides a component-based architecture to manage state and props effectively.</p>
<hr />
<h2 id="heading-2-what-are-the-main-features-of-react">2. What are the main features of React?</h2>
<ul>
<li><p><strong>Virtual DOM</strong> for efficient updates.</p>
</li>
<li><p><strong>Component-based architecture</strong> for reusable and modular code.</p>
</li>
<li><p><strong>Unidirectional data flow</strong> to simplify data management.</p>
</li>
<li><p><strong>Hooks</strong> for state and lifecycle management in functional components.</p>
</li>
<li><p><strong>JSX</strong> for writing HTML-like syntax in JavaScript.</p>
</li>
</ul>
<hr />
<h2 id="heading-3-what-is-the-difference-between-functional-and-class-components">3. What is the difference between functional and class components?</h2>
<ul>
<li><p><strong>Functional Components</strong>:</p>
<ul>
<li><p>Written as simple JavaScript functions.</p>
</li>
<li><p>Use hooks like <code>useState()</code> and <code>useEffect()</code> for state and lifecycle management.</p>
</li>
<li><p>Easier to write and maintain.</p>
</li>
</ul>
</li>
<li><p><strong>Class Components</strong>:</p>
<ul>
<li><p>Written using ES6 class syntax.</p>
</li>
<li><p>Require lifecycle methods like <code>componentDidMount()</code> for managing state and side effects.</p>
</li>
<li><p>More verbose compared to functional components.</p>
</li>
</ul>
</li>
</ul>
<p><strong>Preferred</strong>: Functional components (due to simplicity and hooks introduced in React v16.8).</p>
<hr />
<h2 id="heading-4-what-are-props-and-state-in-react">4. What are Props and State in React?</h2>
<ul>
<li><p><strong>Props</strong>:</p>
<ul>
<li><p>Passed from parent to child components.</p>
</li>
<li><p>Immutable and used to pass data or functions.</p>
</li>
</ul>
</li>
<li><p><strong>State</strong>:</p>
<ul>
<li><p>Managed within a component.</p>
</li>
<li><p>Mutable and used to handle dynamic data.</p>
</li>
</ul>
</li>
</ul>
<hr />
<h2 id="heading-5-how-does-the-virtual-dom-work">5. How does the Virtual DOM work?</h2>
<p>React uses the virtual DOM to enhance performance. The process involves:</p>
<ol>
<li><p>Re-rendering the virtual DOM when state or props change.</p>
</li>
<li><p>Comparing the updated virtual DOM with the previous version (diffing).</p>
</li>
<li><p>Updating only the changed elements in the real DOM.</p>
</li>
</ol>
<hr />
<h2 id="heading-6-what-is-the-purpose-of-the-key-prop-in-lists">6. What is the purpose of the <code>key</code> prop in lists?</h2>
<p>The <code>key</code> prop helps React identify which items in a list have changed, been added, or removed. Keys should be unique and stable, typically using object IDs. Avoid using array indexes as keys unless necessary.</p>
<hr />
<h2 id="heading-7-what-are-react-hooks">7. What are React Hooks?</h2>
<p>Hooks are functions introduced in React v16.8 that allow functional components to use state and lifecycle features. Common hooks include:</p>
<ul>
<li><p><code>useState()</code>: For managing state.</p>
</li>
<li><p><code>useEffect()</code>: For handling side effects.</p>
</li>
<li><p><code>useContext()</code>: For accessing context values.</p>
</li>
</ul>
<hr />
<h2 id="heading-8-what-are-the-react-lifecycle-methods-and-when-are-they-used">8. What are the React lifecycle methods, and when are they used?</h2>
<p>React components go through three lifecycle phases:</p>
<ul>
<li><p><strong>Mounting</strong>:</p>
<ul>
<li><p><code>constructor()</code></p>
</li>
<li><p><code>getDerivedStateFromProps()</code></p>
</li>
<li><p><code>render()</code></p>
</li>
<li><p><code>componentDidMount()</code></p>
</li>
</ul>
</li>
<li><p><strong>Updating</strong>:</p>
<ul>
<li><p><code>shouldComponentUpdate()</code></p>
</li>
<li><p><code>render()</code></p>
</li>
<li><p><code>componentDidUpdate()</code></p>
</li>
</ul>
</li>
<li><p><strong>Unmounting</strong>:</p>
<ul>
<li><code>componentWillUnmount()</code></li>
</ul>
</li>
</ul>
<p>For functional components, hooks like <code>useEffect()</code> are used instead of lifecycle methods.</p>
<hr />
<h2 id="heading-9-when-would-you-use-useeffect">9. When would you use <code>useEffect</code>?</h2>
<ul>
<li><p>To fetch data from an API.</p>
</li>
<li><p>To set up subscriptions or timers.</p>
</li>
<li><p>To handle cleanup (like removing event listeners) using the return function in <code>useEffect</code>.</p>
</li>
</ul>
<hr />
<h2 id="heading-10-what-is-context-api-and-why-is-it-used">10. What is Context API, and why is it used?</h2>
<p>The <strong>Context API</strong> is used to manage the global state by avoiding prop drilling. It allows components to access shared data directly, such as themes, authentication status, or user settings.</p>
<hr />
<h2 id="heading-11-how-does-react-handle-state-management">11. How does React handle state management?</h2>
<p>React provides several ways to manage state:</p>
<ul>
<li><p><strong>Component-level state</strong> using <code>useState</code> or <code>useReducer</code>.</p>
</li>
<li><p><strong>Context API</strong> for global state shared across components.</p>
</li>
<li><p><strong>Third-party libraries</strong> like Redux or Zustand for complex state management.</p>
</li>
</ul>
<hr />
<h2 id="heading-12-what-is-redux-and-why-use-it">12. What is Redux, and why use it?</h2>
<p>Redux is a state management library that centralizes application state in a global store. It helps in managing shared state efficiently, especially when:</p>
<ul>
<li><p>Multiple components require access to the same data.</p>
</li>
<li><p>The application has complex state interactions.</p>
</li>
</ul>
<hr />
<h2 id="heading-13-what-are-the-building-blocks-of-redux">13. What are the building blocks of Redux?</h2>
<ul>
<li><p><strong>Store</strong>: Centralized state container.</p>
</li>
<li><p><strong>Actions</strong>: Plain JavaScript objects describing changes.</p>
</li>
<li><p><strong>Reducers</strong>: Pure functions that specify how the state changes in response to actions.</p>
</li>
</ul>
<hr />
<h2 id="heading-14-what-is-the-usereducer-hook-and-when-would-you-use-it">14. What is the <code>useReducer</code> hook, and when would you use it?</h2>
<p><code>useReducer</code> is a hook used for complex state logic. It provides a way to manage state using actions and reducers, similar to Redux but scoped to a component.</p>
<hr />
<h2 id="heading-15-how-do-you-optimize-performance-in-react">15. How do you optimize performance in React?</h2>
<ul>
<li><p>Use <strong>memoization</strong> with <code>React.memo</code> or <code>useMemo</code>.</p>
</li>
<li><p>Implement <strong>lazy loading</strong> for components using <code>React.lazy</code> and <code>Suspense</code>.</p>
</li>
<li><p>Avoid unnecessary re-renders by using <code>React.PureComponent</code> or <code>useCallback</code>.</p>
</li>
<li><p>Use <strong>keys</strong> efficiently in lists.</p>
</li>
</ul>
<hr />
<h2 id="heading-16-how-do-you-fetch-data-in-react-and-where-do-you-handle-api-calls">16. How do you fetch data in React, and where do you handle API calls?</h2>
<ul>
<li><p>Fetch data using <code>fetch</code> or libraries like Axios.</p>
</li>
<li><p>Handle API calls inside <code>useEffect()</code> for functional components or <code>componentDidMount()</code> for class components.</p>
</li>
</ul>
<hr />
<h2 id="heading-17-what-is-the-difference-between-useeffect-and-uselayouteffect">17. What is the difference between <code>useEffect</code> and <code>useLayoutEffect</code>?</h2>
<ul>
<li><p><strong>useEffect</strong>: Runs asynchronously after rendering, suitable for data fetching or subscriptions.</p>
</li>
<li><p><strong>useLayoutEffect</strong>: Runs synchronously after rendering but before the DOM is updated, suitable for layout adjustments.</p>
</li>
</ul>
<hr />
<h2 id="heading-18-what-is-the-importance-of-reacts-unidirectional-data-flow">18. What is the importance of React's unidirectional data flow?</h2>
<p>Unidirectional data flow ensures that data flows from parent to child components, making state management predictable and debugging easier.</p>
<hr />
<h2 id="heading-19-how-do-you-handle-error-boundaries-in-react">19. How do you handle error boundaries in React?</h2>
<p>Error boundaries are implemented using class components with lifecycle methods like <code>componentDidCatch()</code> and <code>getDerivedStateFromError()</code>. They catch JavaScript errors in the component tree and prevent the app from crashing.</p>
<hr />
<h2 id="heading-20-explain-the-difference-between-controlled-and-uncontrolled-components">20. Explain the difference between controlled and uncontrolled components.</h2>
<ul>
<li><p><strong>Controlled Components</strong>:</p>
<ul>
<li><p>Manage form data using state.</p>
</li>
<li><p>Data flows through React state.</p>
</li>
</ul>
</li>
<li><p><strong>Uncontrolled Components</strong>:</p>
<ul>
<li><p>Use refs to manage form data.</p>
</li>
<li><p>Data flows through the DOM.</p>
</li>
</ul>
</li>
</ul>
<hr />
]]></content:encoded></item></channel></rss>