<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rahul Beniwal  on Medium]]></title>
        <description><![CDATA[Stories by Rahul Beniwal  on Medium]]></description>
        <link>https://medium.com/@rahulbeniwal26119?source=rss-710fb647e959------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yoE7HB_8lfGGEaEavk4-Ow.jpeg</url>
            <title>Stories by Rahul Beniwal  on Medium</title>
            <link>https://medium.com/@rahulbeniwal26119?source=rss-710fb647e959------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 13 Nov 2026 16:13:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rahulbeniwal26119/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Dark Side of Concurrency]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://rahulbeniwal26119.medium.com/the-dark-side-of-concurrency-7cc76ac5286a?source=rss-710fb647e959------2"><img src="https://cdn-images-1.medium.com/max/1672/0*hbTDLC0HmvhqTp07.png" width="1672"></a></p><p class="medium-feed-snippet">Where timing turns correct code into chaos.</p><p class="medium-feed-link"><a href="https://rahulbeniwal26119.medium.com/the-dark-side-of-concurrency-7cc76ac5286a?source=rss-710fb647e959------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://rahulbeniwal26119.medium.com/the-dark-side-of-concurrency-7cc76ac5286a?source=rss-710fb647e959------2</link>
            <guid isPermaLink="false">https://medium.com/p/7cc76ac5286a</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[concurrency]]></category>
            <category><![CDATA[low-level-design]]></category>
            <dc:creator><![CDATA[Rahul Beniwal ]]></dc:creator>
            <pubDate>Sat, 29 Aug 2026 14:40:10 GMT</pubDate>
            <atom:updated>2026-08-29T14:40:10.306Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Why Gossip protocol is so much important for distributed systems ?]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://levelup.gitconnected.com/why-gossip-protocol-is-so-much-important-for-distributed-systems-12fb7781bd45?source=rss-710fb647e959------2"><img src="https://cdn-images-1.medium.com/max/800/0*vgULbURRtjgTwoBK" width="800"></a></p><p class="medium-feed-snippet">Let&#x2019;s decode how Gossip Protocols Became the Practical Multicast of Distributed Systems</p><p class="medium-feed-link"><a href="https://levelup.gitconnected.com/why-gossip-protocol-is-so-much-important-for-distributed-systems-12fb7781bd45?source=rss-710fb647e959------2">Continue reading on Level Up Coding »</a></p></div>]]></description>
            <link>https://levelup.gitconnected.com/why-gossip-protocol-is-so-much-important-for-distributed-systems-12fb7781bd45?source=rss-710fb647e959------2</link>
            <guid isPermaLink="false">https://medium.com/p/12fb7781bd45</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[systems-thinking]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Rahul Beniwal ]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 03:39:54 GMT</pubDate>
            <atom:updated>2026-06-15T04:16:29.165Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[From SET to Disk: Redis Event Loop, AOF, and Snapshots From Source Code]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://rahulbeniwal26119.medium.com/from-set-to-disk-redis-event-loop-aof-and-snapshots-from-source-code-72c90ee08448?source=rss-710fb647e959------2"><img src="https://cdn-images-1.medium.com/max/1000/0*Fkf-XU-B43NuHCYG.png" width="1000"></a></p><p class="medium-feed-snippet">Let&#x2019;s understand how things actually work inside Redis instead of guessing. This explanation comes directly from reading the Redis source&#x2026;</p><p class="medium-feed-link"><a href="https://rahulbeniwal26119.medium.com/from-set-to-disk-redis-event-loop-aof-and-snapshots-from-source-code-72c90ee08448?source=rss-710fb647e959------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://rahulbeniwal26119.medium.com/from-set-to-disk-redis-event-loop-aof-and-snapshots-from-source-code-72c90ee08448?source=rss-710fb647e959------2</link>
            <guid isPermaLink="false">https://medium.com/p/72c90ee08448</guid>
            <category><![CDATA[system-design-interview]]></category>
            <category><![CDATA[systems-thinking]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <dc:creator><![CDATA[Rahul Beniwal ]]></dc:creator>
            <pubDate>Fri, 12 Jun 2026 05:39:25 GMT</pubDate>
            <atom:updated>2026-06-12T05:39:25.637Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How I Built My Own Kindle: Code, Architecture, and System Design Lessons]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://levelup.gitconnected.com/how-i-built-my-own-kindle-code-architecture-and-system-design-lessons-18fb28a8c1b8?source=rss-710fb647e959------2"><img src="https://cdn-images-1.medium.com/max/2600/1*Fk8ck9pDTXlLRWD0zSFOWA.png" width="2862"></a></p><p class="medium-feed-snippet">A code-level system design walkthrough of a private EPUB reader with S3 uploads, IndexedDB caching, CFI progress sync, annotations, and an&#x2026;</p><p class="medium-feed-link"><a href="https://levelup.gitconnected.com/how-i-built-my-own-kindle-code-architecture-and-system-design-lessons-18fb28a8c1b8?source=rss-710fb647e959------2">Continue reading on Level Up Coding »</a></p></div>]]></description>
            <link>https://levelup.gitconnected.com/how-i-built-my-own-kindle-code-architecture-and-system-design-lessons-18fb28a8c1b8?source=rss-710fb647e959------2</link>
            <guid isPermaLink="false">https://medium.com/p/18fb28a8c1b8</guid>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[database-design]]></category>
            <category><![CDATA[interview-questions]]></category>
            <dc:creator><![CDATA[Rahul Beniwal ]]></dc:creator>
            <pubDate>Mon, 08 Jun 2026 04:19:34 GMT</pubDate>
            <atom:updated>2026-06-08T04:19:34.698Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Why Your Python Encapsulation is Broken (And How Seniors Fix It)]]></title>
            <link>https://rahulbeniwal26119.medium.com/why-your-python-encapsulation-is-broken-and-how-seniors-fix-it-7c1f28f4e00b?source=rss-710fb647e959------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c1f28f4e00b</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[python-interview-question]]></category>
            <dc:creator><![CDATA[Rahul Beniwal ]]></dc:creator>
            <pubDate>Sun, 15 Feb 2026 04:33:04 GMT</pubDate>
            <atom:updated>2026-02-15T04:33:04.302Z</atom:updated>
            <content:encoded><![CDATA[<h4>Stop treating Python like Java. Learn the senior-level mental model of Python encapsulation, including how to prevent mutable reference leaks, use the property decorator effectively, and manage object state ownership.</h4><p>Encapsulation is one of the most misunderstood concepts in Python, especially by developers coming from Java, C++, or C#.</p><p>Python <strong>does not</strong> implement encapsulation through access modifiers. And that’s not a weakness, it’s a <strong>design choice</strong>.</p><p>This article explains encapsulation in Python the way <strong>senior engineers actually reason about it</strong>:<br>through <strong>state ownership</strong>, <strong>mutation control</strong>, and <strong>reference safety</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3e6Xt8yAl1omKo6a" /></figure><h4>Why Python Doesn’t Have Private Members (And Why That’s Good)</h4><p><strong><em>Python does NOT have:</em></strong></p><ul><li>private, protected, public</li><li>compiler-enforced access control</li><li>true private fields</li></ul><p><strong><em>Python does have:</em></strong></p><ul><li>name binding</li><li>attribute lookup rules</li><li>conventions (PEP 8)</li><li>descriptors and properties</li><li>composition over restriction</li></ul><blockquote>Encapsulation in Python is social, not technical.</blockquote><p>This philosophy is intentional. Python assumes developers are <strong>responsible adults</strong>, not adversaries.</p><h3>How Instance State Actually Works in Python</h3><p>Consider this simple class:</p><pre>class User:<br>    def __init__(self, name):<br>        self.name = name<br><br>u = User(&quot;Rahul&quot;)<br>print(u.__dict__)</pre><ul><li>Instance attributes live in obj.__dict__</li><li>There is <strong>no protective barrier</strong></li><li>Any code can mutate them</li></ul><pre>u.__dict__[&quot;name&quot;] = &quot;Hello&quot;<br>assert u.name == &quot;Hello&quot;</pre><p>The language <strong>does not enforce encapsulation</strong>.</p><h3>The Convention: _single_underscore vs __double_underscore</h3><h4><strong><em>_single_underscore (PEP 8 Convention)</em></strong></h4><pre>class A:<br>    def __init__(self):<br>        self._x = 100</pre><ul><li>Means: <em>internal use</em></li><li>Defined by <strong>PEP 8</strong></li><li>Zero enforcement</li></ul><p>This is <strong>documentation for humans</strong>, not protection from code.</p><h4><strong><em>__double_underscore (Name Mangling)</em></strong></h4><pre>class A:<br>    def __init__(self):<br>        self.__x = 10</pre><p>internally becomes</p><ul><li><em>A</em>_x</li></ul><pre>class A:<br>    def __init__(self):<br>        self.__x = 10<br>a = A()<br>print(a._A__x == getattr(a, f&quot;_{a.__class__.__name__}__x&quot;))<br>print(a.__x)</pre><pre>True<br>Traceback (most recent call last):<br>  File &quot;/dev/shm/7b53ddd9-8a73-43bb-b844-7eb8ad350351/main.py&quot;, line 6, in &lt;module&gt;<br>    print(a.__x)<br>          ^^^^^<br>AttributeError: &#39;A&#39; object has no attribute &#39;__x&#39;</pre><h3>Why Name Mangling Exists</h3><ul><li>Prevents <strong>accidental overrides in subclasses</strong></li><li>Helps with <strong>MRO safety</strong></li><li>NOT about privacy or security</li></ul><blockquote><em>If you know the class name, you can always access the attribute.</em></blockquote><h3>The Real Encapsulation Problem: Shared Mutable References</h3><p>Encapsulation in Python does <strong>NOT</strong> break because attributes are public. It breaks when <strong>mutable state escapes</strong>.</p><blockquote><strong>The “Reference Leak” Trap (Critical Concept)</strong></blockquote><pre>class Bag:<br>    def __init__(self):<br>        self.items = []<br><br>b = Bag()<br>x = b.items<br>x.append(1)<br><br>print(b.items)<br># [1]</pre><p><strong><em>What Went Wrong?</em></strong></p><ul><li>b.items and x reference the <strong>same list</strong></li><li>The mutation happened <strong>outside</strong> the object</li><li>No method was called</li><li>No validation occurred</li></ul><blockquote>Encapsulation breaks when an object loses exclusive control over its mutable state.</blockquote><h4>Defensive Copy: Restoring Encapsulation</h4><pre>from copy import deepcopy<br><br>class Bag:<br>    def __init__(self, items):<br>        self.__items = deepcopy(items)<br><br>    def get_items(self):<br>      # we will update it when using properties<br>      return self.__items<br><br>bag = [1, 2, 3]<br>b = Bag(items=bag)<br>bag.append(100)<br>assert bag != b.get_items()</pre><ul><li>Ownership is explicit</li><li>External mutation does not leak</li><li>Object controls its state again</li></ul><h3>@property: Controlled Access (True Encapsulation)</h3><pre>class User:<br>    def __init__(self, age):<br>        self._age = age<br><br>    @property<br>    def age(self):<br>        return self._age<br><br>u = User(10)<br>print(u.age)</pre><p>Looks like attribute access. Behaves like a method.</p><p>This is actually a descriptor magic which we are going to talk about in next article.</p><h4>Adding Validation with a Setter</h4><pre>class User:<br>    def __init__(self, age):<br>        self.age = age<br><br>    @property<br>    def age(self):<br>        return self._age<br><br>    @age.setter<br>    def age(self, value):<br>        if value &lt; 0:<br>            raise ValueError(&quot;Age cannot be negative&quot;)<br>        self._age = value<br><br>u = User(10)<br>try:<br>  u.age = -19<br>except ValueError as e:<br>  print(e)<br><br>try:<br>  u2 = User(-10)<br>except ValueError as e:<br>  print(e)<br><br>print(u.age)</pre><pre>Age cannot be negative<br>Age cannot be negative<br>10</pre><p>This is <strong>real encapsulation</strong> in Python.</p><h3>Encapsulation with @dataclass(frozen=True)</h3><p>Python encourages <strong>immutability</strong>.</p><pre>from dataclasses import dataclass<br><br>@dataclass(frozen=True)<br>class Config:<br>    host: str<br>    port: int<br><br>config = Config(&#39;localhost&#39;, &#39;80&#39;)<br>print(config)<br>config.host = &#39;127.0.0.1&#39;</pre><pre>Config(host=&#39;localhost&#39;, port=&#39;80&#39;)<br>Traceback (most recent call last):<br>  File &quot;/dev/shm/bae3641b-e0a1-403d-8565-19b31fd1d9da/main.py&quot;, line 10, in &lt;module&gt;<br>    config.host = &#39;127.0.0.1&#39;<br>    ^^^^^^^^^^^<br>  File &quot;&lt;string&gt;&quot;, line 16, in __setattr__<br>dataclasses.FrozenInstanceError: cannot assign to field &#39;host&#39;</pre><p>But it doesn’t use deepcopy, so for reading, it is thread-safe until you want to break your own design, as i did in this example.</p><pre>from dataclasses import dataclass<br><br>@dataclass(frozen=True)<br>class Config:<br>    host: str<br>    port: int<br>    di: dict<br><br>di = {&#39;a&#39;: &#39;b&#39;}<br>config = Config(&#39;localhost&#39;, &#39;80&#39;, di=di)<br>print(config)<br>di.update({&quot;b&quot;: &quot;c&quot;})<br>print(config)<br><br># Config(host=&#39;localhost&#39;, port=&#39;80&#39;, di={&#39;a&#39;: &#39;b&#39;})<br># Config(host=&#39;localhost&#39;, port=&#39;80&#39;, di={&#39;a&#39;: &#39;b&#39;, &#39;b&#39;: &#39;c&#39;})</pre><p>Feeling bored while reading this article? I would suggest to visit source at</p><p><a href="https://takovibe.com/blog/python-encapsulation-best-practices/">Why Your Python Encapsulation is Broken (And How Seniors Fix It)</a></p><p>and experiment with the code in the code editor side by side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oheDmr7O-v7_JqEPloBBpQ.png" /></figure><h3>Class vs Instance Attributes (Encapsulation Trap)</h3><pre>class A:<br>    x = []<br><br>a1 = A()<br>a2 = A()<br><br>a1.x.append(1)<br>assert a2.x == A.x == a1.x == [1]</pre><blockquote>Why This Happens</blockquote><ul><li>x is a <strong>class attribute</strong></li><li>Shared across all instances</li></ul><blockquote>Correct Pattern</blockquote><pre>class A:<br>    def __init__(self):<br>        self.x = []</pre><h3>__slots__: Advanced Encapsulation &amp; Memory Control</h3><p>Normally, Python objects use a <strong>dictionary</strong> (__dict__) to store attributes. Dictionaries are flexible but &quot;fat&quot;—they consume a lot of RAM because they use a hash table to allow you to add new attributes at runtime.</p><p>By defining __slots__, You tell Python: <em>&quot;Don&#39;t create a dictionary. Only reserve space for these specific attributes.&quot;</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*TQY1su5cGk_oWdsFk3gXzg.png" /></figure><pre>class User:<br>    __slots__ = (&quot;name&quot;, &quot;age&quot;)<br><br>    def __init__(self, name, age):<br>        self.name = name<br>        self.age = age<br><br>u = User(name=&quot;A&quot;, age=50)<br>print(u.name, u.age)<br>assert hasattr(u, &#39;__dict__&#39;) is False<br><br>try:<br>  u.new_attr = 100<br>except Exception as e:<br>  print(e)</pre><pre>A 50<br>&#39;User&#39; object has no attribute &#39;new_attr&#39; and no __dict__ for setting new attributes</pre><h4>A Few “Authority” Gotchas to Remember</h4><blockquote>1. Inheritance Breakage (The “Hidden Dict” Trap)</blockquote><p>If a parent class is a “standard” Python class, it creates a __dict__. Even if the child uses __slots__, it inherits that dictionary from the parent, defeating the memory-saving purpose.</p><pre>class Parent:<br>    def __init__(self):<br>        self.a = 1  # This goes into a __dict__<br><br>class Child(Parent):<br>    __slots__ = (&quot;b&quot;,)<br>    def __init__(self):<br>        super().__init__()<br>        self.b = 2<br><br>obj = Child()<br>print(hasattr(obj, &quot;__dict__&quot;))<br>obj.random_attr = &quot;I shouldn&#39;t be here!&quot; # Works! (Slots failed to restrict)<br>print(obj.__dict__)<br>print(obj.__slots__)</pre><pre>True<br>{&#39;a&#39;: 1, &#39;random_attr&#39;: &quot;I shouldn&#39;t be here!&quot;}<br>(&#39;b&#39;,)</pre><blockquote>2. No Weak References</blockquote><p>A “Weak Reference” allows the garbage collector to reclaim an object even if a weakref exists. Standard objects support this by default. Slotted objects do not.</p><pre>import weakref<br><br>class SlottedUser:<br>    __slots__ = (&quot;name&quot;,)<br><br>u = SlottedUser()<br>try:<br>    r = weakref.ref(u)<br>except TypeError as e:<br>    print(f&quot;Error: {e}&quot;)<br><br><br>class NormalUser:<br>   pass<br><br>u = NormalUser()<br>try:<br>    r = weakref.ref(u)<br>    print(&quot;worked&quot;)<br>except TypeError as e:<br>    print(f&quot;Error: {e}&quot;)</pre><pre>Error: cannot create weak reference to &#39;SlottedUser&#39; object<br>worked</pre><p><strong>The Fix:</strong> You must explicitly reserve space for the weak reference machinery.</p><pre>import weakref<br><br>class SlottedUser:<br>    __slots__ = (&quot;name&quot;, &quot;__weakref__&quot;)<br><br>u = SlottedUser()<br>try:<br>    r = weakref.ref(u)<br>    print(&quot;worked&quot;)<br>except TypeError as e:<br>    print(f&quot;Error: {e}&quot;)</pre><p>We are going to cover WeakRef and why they are useful in our upcoming articles. It is one of the concepts that is related to Python&#39;s garbage collector, so I will highly recommand to read this article this article.</p><p><a href="https://takovibe.com/blog/python-object-model-identity-memory/">Python&#39;s Memory DNA: A Senior Guide to Identity, Interning, and GC</a></p><h3>Encapsulation Is About Ownership</h3><p>Ask these questions:</p><ul><li>Who owns this state?</li><li>Who is allowed to mutate it?</li><li>Can a mutation happen without the object knowing?</li><li>Is immutability possible?</li></ul><p>If mutation leaks -&gt; encapsulation is broken.</p><p>If you’re looking to level up your architecture, I’d highly recommend checking out the <strong>SOLID principles</strong>. They’re basically the gold standard for writing clean, maintainable code. This series is a great place to start.</p><p><a href="https://takovibe.com/series/solid-principles/">SOLID Principles Series - All Articles</a></p><h3>Final Takeaways</h3><ul><li>Python does not enforce encapsulation via access modifiers</li><li>_ and __ are conventions and collision-avoidance tools</li><li><strong>Mutable reference leaks are the real enemy</strong></li><li>@property, immutability, and defensive copying are core tools</li><li>dataclass(frozen=True) and __slots__ signal senior-level design</li><li>Encapsulation is about <strong>control</strong>, not <strong>visibility</strong></li></ul><h3>References</h3><ul><li><a href="https://docs.python.org/3/reference/datamodel.html"><strong>Python Language Reference — Data Model</strong></a></li><li><a href="https://docs.python.org/3/library/functions.html#property"><strong>Python Documentation — property()</strong></a></li><li><a href="https://peps.python.org/pep-0008/"><strong>PEP 8 — Style Guide for Python Code</strong></a></li><li><a href="https://peps.python.org/pep-0557/"><strong>PEP 557 — Data Classes</strong></a></li><li><a href="https://docs.python.org/3/reference/datamodel.html#slots"><strong>Python Documentation slots</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c1f28f4e00b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mutability vs Immutability in Python (Senior Guide)]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://rahulbeniwal26119.medium.com/mutability-vs-immutability-in-python-senior-guide-1ee215671909?source=rss-710fb647e959------2"><img src="https://cdn-images-1.medium.com/max/1536/0*KSBZ0Mr1Oe-XAcuy" width="1536"></a></p><p class="medium-feed-snippet">Learn mutability vs immutability in Python using object identity, default arguments, shallow vs deep copy, and real interview-style&#x2026;</p><p class="medium-feed-link"><a href="https://rahulbeniwal26119.medium.com/mutability-vs-immutability-in-python-senior-guide-1ee215671909?source=rss-710fb647e959------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://rahulbeniwal26119.medium.com/mutability-vs-immutability-in-python-senior-guide-1ee215671909?source=rss-710fb647e959------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ee215671909</guid>
            <category><![CDATA[python-fundamentals]]></category>
            <category><![CDATA[core-python]]></category>
            <category><![CDATA[python-interview]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rahul Beniwal ]]></dc:creator>
            <pubDate>Sun, 25 Jan 2026 02:21:26 GMT</pubDate>
            <atom:updated>2026-01-25T02:21:26.659Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Python Object Model: Identity, Memory & References (Senior Guide)]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://python.plainenglish.io/python-object-model-identity-memory-references-senior-guide-03dd7512101f?source=rss-710fb647e959------2"><img src="https://cdn-images-1.medium.com/max/1536/0*r2s-f9pqwTwW0MDJ" width="1536"></a></p><p class="medium-feed-snippet">Deep dive into Python&#x2019;s object model: identity vs equality, reference counting, garbage collection, memory size traps, and argument&#x2026;</p><p class="medium-feed-link"><a href="https://python.plainenglish.io/python-object-model-identity-memory-references-senior-guide-03dd7512101f?source=rss-710fb647e959------2">Continue reading on Python in Plain English »</a></p></div>]]></description>
            <link>https://python.plainenglish.io/python-object-model-identity-memory-references-senior-guide-03dd7512101f?source=rss-710fb647e959------2</link>
            <guid isPermaLink="false">https://medium.com/p/03dd7512101f</guid>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[core-python]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rahul Beniwal ]]></dc:creator>
            <pubDate>Sun, 18 Jan 2026 19:59:55 GMT</pubDate>
            <atom:updated>2026-01-18T19:59:55.301Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[ReAct Agents Are Much Simpler Than You Think]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://rahulbeniwal26119.medium.com/react-agents-are-much-simpler-than-you-think-ffc0dd7579f8?source=rss-710fb647e959------2"><img src="https://cdn-images-1.medium.com/max/1024/1*borYM-crfhh61yY-tVx3qQ.png" width="1024"></a></p><p class="medium-feed-snippet">A practical, no-magic introduction to building tool-using AI agents with LangChain 1.x</p><p class="medium-feed-link"><a href="https://rahulbeniwal26119.medium.com/react-agents-are-much-simpler-than-you-think-ffc0dd7579f8?source=rss-710fb647e959------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://rahulbeniwal26119.medium.com/react-agents-are-much-simpler-than-you-think-ffc0dd7579f8?source=rss-710fb647e959------2</link>
            <guid isPermaLink="false">https://medium.com/p/ffc0dd7579f8</guid>
            <category><![CDATA[langchain-agents]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[langchain]]></category>
            <dc:creator><![CDATA[Rahul Beniwal ]]></dc:creator>
            <pubDate>Sat, 10 Jan 2026 03:32:10 GMT</pubDate>
            <atom:updated>2026-01-10T03:32:10.857Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[More CPU Cores, Worse Performance: The VPS Buying Mistake Most Developers Make]]></title>
            <link>https://levelup.gitconnected.com/more-cpu-cores-worse-performance-the-vps-buying-mistake-most-developers-make-f5b6563a69dd?source=rss-710fb647e959------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5b6563a69dd</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Rahul Beniwal ]]></dc:creator>
            <pubDate>Fri, 19 Dec 2025 03:39:14 GMT</pubDate>
            <atom:updated>2025-12-19T03:39:14.418Z</atom:updated>
            <content:encoded><![CDATA[<h4>Let’s decode why bigger VPS plans feel slower in real life</h4><p>Hello everyone — it’s been a while since I last wrote on Medium.</p><p>I’ve been heads-down building <a href="https://takovibe.com/"><strong>TakoVibe</strong></a>, a modern writing platform for developers, and that journey has taught me far more than I expected. From experimenting with new frontend frameworks to designing the UI, handling deployments, setting up automation, and making real infrastructure decisions — it’s been a hands-on learning experience in every sense.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W4YJtC0rUnKt_85NezEMPg.png" /></figure><p>While building TakoVibe, one decision kept coming back to bite me: <strong>choosing the right VPS</strong>.</p><p>Like many developers, I assumed bigger specs meant better performance. More cores, more RAM, a seemingly great deal — what could go wrong? As it turns out, quite a lot.</p><p>In this post, I want to share the lessons I learned the hard way — especially around <strong>CPU cores, latency, oversubscription, and why “bigger” VPS plans often feel slower in real life</strong>. If you’re hosting a blog, a platform, or any developer-facing product, this might save you both money and frustration.</p><h3>Choosing A VPS</h3><p>When choosing a VPS, most developers fall into a simple mental model:</p><blockquote><strong>More cores + more RAM = better performance</strong></blockquote><p>On paper, it makes sense. In reality, it’s often <strong>wrong</strong>.</p><p>I recently moved from a “bigger” VPS (8 Core, 24 GB RAM, France) to a smaller one (6 Cores, 12 GB RAM, Mumbai).</p><p>Same Workload but lower cost, and yet — <strong>everything felt faster</strong>.</p><h4>The illusion of “more cores.”</h4><p>A VPS does not give you <em>physical</em> CPU cores. It gives you <strong>vCPUs</strong>, which are slices of shared hardware.</p><p>Providers routinely <strong>oversubscribe</strong> CPUs:</p><pre>Oversubscription = virtual CPUs sold / physical CPU cores</pre><p><strong><em>Typical ratios:</em></strong></p><ul><li>Cheap VPS: <strong>8:1–16:1</strong></li><li>Mid-tier VPS: <strong>4:1–8:1</strong></li><li>High-quality VPS: <strong>2:1–4:1</strong></li><li>Dedicated servers: <strong>1:1</strong></li></ul><p>So that “12-core VPS” may actually be competing with dozens of other tenants on the same host.</p><blockquote>That’s why providers love selling big-RAM plans on weak CPUs.</blockquote><h4>CPU generation matters more than core count</h4><p>Here’s the uncomfortable truth:</p><blockquote><strong>Six modern cores can outperform ten old ones.</strong></blockquote><p>Older VPS plans often run on CPUs like:</p><ul><li>Intel Haswell (2013-era, Mine one)</li><li>Early Xeons with heavy security mitigations</li></ul><p>Modern VPS plans run on:</p><ul><li>AMD EPYC Milan (Mine one)/ Genoa (Zen 3 / Zen 4)</li><li>Intel Ice Lake / Sapphire Rapids</li></ul><p><strong><em>What changed?</em></strong></p><ul><li>Much higher <strong>IPC</strong> (instructions per cycle)</li><li>Better branch prediction</li><li>Better memory subsystems</li><li>Fewer performance-killing security penalties</li></ul><blockquote>In real workloads (Node, Python, databases, builds), <strong>single-core speed dominates</strong>.</blockquote><h3>Why I Chose a Bigger VPS — and Why I Left It</h3><p>When I first chose my VPS, I went for the bigger one.</p><p>It was my first time seeing a machine with 12 cores and 24 GB RAM for around $18, and it felt like a steal. I also liked the idea that it was a full-fledged Linux server — something I could use not just for hosting my blog, but also for development and even learning a bit of machine learning.</p><p>On paper, it looked perfect. But very quickly, the cracks started to show.</p><p><strong>The first issue was latency</strong>. I was using VS Code Server on the VPS, and every interaction had a noticeable delay. It wasn’t unusable, but it constantly reminded me that I wasn’t working locally — and that discomfort adds up fast when you code every day.</p><p><strong>The second realization was more subtle. Even though I knew it before buying, I was never going to use the full specs.</strong> I tried hosting multiple services on the VPS, including a VPN, but none of that justified the hardware. The machine was powerful, yet my experience felt slower.</p><blockquote>Latency turned out to be the real deal breaker.</blockquote><p>That’s when I decided to switch to a smaller VPS — $9, located in Mumbai (India).</p><p>This time, I optimized for two things: region and CPU architecture.</p><p>The difference was immediate. Latency dropped drastically. My hosted VS Code Server started feeling almost like it was running locally. That alone made the switch worth it.</p><p>I also noticed that my frontend builds felt slightly faster. I can’t prove it with benchmarks, but given the newer CPU architecture, it wouldn’t be surprising.</p><p>Ironically, the “smaller” server felt more capable — because it was better aligned with how I actually work.</p><h3>Why the “bigger” VPS still exists</h3><p>So if smaller modern CPUs are better, why do providers still sell huge plans on old hardware?</p><p>Because:</p><ul><li><strong>Hardware is already paid for: </strong>Old servers are cheap to operate and highly profitable.</li><li><strong>Most buyers compare numbers, not generations: </strong>“24 GB RAM” sounds safer than “12 GB RAM”.</li><li><strong>Many workloads need memory, not speed:</strong> JVMs, caches, batch jobs, legacy systems.</li></ul><blockquote>Those plans aren’t scams — they’re just optimized for a <strong>different audience</strong>.</blockquote><h3>Oversubscription + throttling = inconsistent performance</h3><p>Two more concepts complete the picture:</p><ul><li><strong>Oversubscription</strong>: too many vCPUs share the same physical core pool</li><li><strong>Throttling</strong>: the provider intentionally limits sustained usage</li></ul><p>Symptoms you’ve probably seen:</p><ul><li>Builds start fast, then slow down</li><li>CPU usage never reaches 100%</li><li>Random latency spikes</li></ul><h3>Latency beats raw specs</h3><p>Region choice often matters more than hardware.</p><p>For my Indian users:</p><ul><li>Europe → ~120–180 ms RTT</li><li>Mumbai → ~15–30 ms RTT</li></ul><p>If the platform continues to grow, I plan to expand by adding servers in other regions to better serve users globally.</p><p>That difference is <strong>immediately noticeable</strong> in:</p><ul><li>TTFB (Time to First Byte, a core web performance metric)</li><li>API calls</li><li>SSR pages</li><li>Database round-trip</li></ul><blockquote>You can’t fix latency with more RAM.</blockquote><h3>The rule that actually works</h3><p>After going through this firsthand, here’s the rule I now follow:</p><blockquote><strong>Fewer modern cores &gt; many old cores</strong></blockquote><blockquote><strong>Closer region &gt; bigger machine</strong></blockquote><blockquote><strong>CPU quality &gt; CPU quantity</strong></blockquote><p>For most web workloads:</p><ul><li>Blogs</li><li>APIs</li><li>Dashboards</li><li>CI/CD</li><li>Small–medium SaaS</li></ul><h3>When “more cores” really <em>does</em> make sense</h3><p>To be fair, bigger VPS plans are still the right choice for:</p><ul><li>In-memory databases ( Like Redis)</li><li>Heavy background workers</li><li>Batch processing</li><li>Data pipelines</li></ul><p>But if your workload is request-driven and latency-sensitive, raw core count is the wrong metric.</p><h3>Myth: “More CPU Cores Means I Can Run an LLM for Free”</h3><p>A common misconception is that <strong>having more CPU cores means you can host an LLM for free</strong> and serve responses to users without the need for GPUs.</p><p>On paper, it sounds reasonable. In practice, it quickly falls apart.</p><h4>Why this idea breaks down</h4><p>When an LLM runs inference on a CPU, it does <strong>not use one or two cores politely</strong>. Token generation is compute-heavy and typically <strong>fans out across all available cores</strong> to reduce latency.</p><p>The result?</p><ul><li>Your entire CPU gets saturated</li><li>Other workloads (SSR, APIs, background jobs) get stalled</li><li>Your server becomes effectively single-purpose</li></ul><p>At that point, your “multi-core” server behaves like a <strong>single-request machine</strong>.</p><h4>Concurrency becomes a nightmare</h4><p>With CPU-based LLM inference:</p><ul><li>One request can easily consume <strong>100% of the available CPU</strong></li><li>Multiple concurrent requests do <strong>not scale linearly</strong></li><li>Requests start queueing instead of running in parallel</li></ul><p>Now imagine:</p><ul><li>50–100 users hit “Generate” at the same time</li><li>Your server tries to satisfy all of them</li><li>Latency explodes, or the process gets OOM (Out of Memory) killed</li></ul><p>That’s not a scaling problem — that’s a <strong>catastrophe waiting to happen</strong>.</p><h4>When CPU inference does make sense</h4><p>To be fair, CPU inference is reasonable for:</p><ul><li>Local experimentation</li><li>Offline batch processing</li><li>Low-QPS internal tools</li><li>Very small models (≤3B parameters)</li></ul><h3>Final takeaway</h3><p>The VPS market sells <strong>comfort</strong>, not performance.</p><blockquote>Big numbers feel safe.Modern CPUs feel fast.</blockquote><p>Thank you for reading till the end. Don’t forget to follow <a href="https://medium.com/u/710fb647e959">Rahul Beniwal</a> for more real experiences.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5b6563a69dd" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/more-cpu-cores-worse-performance-the-vps-buying-mistake-most-developers-make-f5b6563a69dd">More CPU Cores, Worse Performance: The VPS Buying Mistake Most Developers Make</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Vibe-Coding Secrets Every Developer Wishes They Knew Earlier]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://rahulbeniwal26119.medium.com/3-vibe-coding-secrets-every-developer-wishes-they-knew-earlier-f04d19a09539?source=rss-710fb647e959------2"><img src="https://cdn-images-1.medium.com/max/1024/1*VB10Em1E3vnz30lbpoKwGA.png" width="1024"></a></p><p class="medium-feed-snippet">Make LLMs your coding partner.</p><p class="medium-feed-link"><a href="https://rahulbeniwal26119.medium.com/3-vibe-coding-secrets-every-developer-wishes-they-knew-earlier-f04d19a09539?source=rss-710fb647e959------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://rahulbeniwal26119.medium.com/3-vibe-coding-secrets-every-developer-wishes-they-knew-earlier-f04d19a09539?source=rss-710fb647e959------2</link>
            <guid isPermaLink="false">https://medium.com/p/f04d19a09539</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Rahul Beniwal ]]></dc:creator>
            <pubDate>Thu, 04 Dec 2025 14:39:57 GMT</pubDate>
            <atom:updated>2025-12-04T15:03:13.443Z</atom:updated>
        </item>
    </channel>
</rss>