<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>dhilipsiva - Musings</title>
      <link>https://dhilipsiva.dev/musings/</link>
      <description>Software architect and open-source builder — Rust, Python, distributed systems, WebAssembly, symbolic reasoning.</description>
      <generator>Zola</generator>
      <language>en</language>
      <atom:link href="https://dhilipsiva.dev/musings/rss.xml" rel="self" type="application/rss+xml"/>
      <lastBuildDate>Thu, 28 May 2026 00:00:00 +0000</lastBuildDate>
      <item>
          <title>On building things that outlive their meaning</title>
          <pubDate>Thu, 28 May 2026 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/outlive-their-meaning/</link>
          <guid>https://dhilipsiva.dev/musings/outlive-their-meaning/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/outlive-their-meaning/">&lt;p&gt;The universe does not owe your software a reason to exist. It does not owe your cluster a quorum, your proof a model, or your name a legacy. This is usually delivered as bad news. I have come to read it as the most freeing license a builder can be handed.&lt;&#x2F;p&gt;
&lt;p&gt;If nothing is owed, then nothing is wasted either. You are free to build the thing precisely because it does not &lt;em&gt;have&lt;&#x2F;em&gt; to matter. The meaning is not discovered in the artifact; it is &lt;strong&gt;authored&lt;&#x2F;strong&gt; into it, by you, at the moment you decide to begin.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;A quine is a program that, run, prints its own source. It needs no input from the world to justify its output. It is its own reason.
&lt;cite&gt;— from the margins of an old notebook&lt;&#x2F;cite&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;the-fixed-point-as-a-way-of-life&quot;&gt;The fixed point as a way of life&lt;&#x2F;h2&gt;
&lt;p&gt;In mathematics, a &lt;strong&gt;fixed point&lt;&#x2F;strong&gt; of a function &lt;code&gt;f&lt;&#x2F;code&gt; is a value &lt;code&gt;x&lt;&#x2F;code&gt; where &lt;code&gt;f(x) = x&lt;&#x2F;code&gt; — apply the function and nothing moves. Consensus is a fixed point. A quine is a fixed point. A self-consistent worldview is a fixed point. The trick of building systems that last is to find the place where the system stops needing the world to hold it up, and instead holds itself.&lt;&#x2F;p&gt;
&lt;p&gt;Here is the smallest honest version of the idea, in Rust:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code&gt;&lt;span class=&quot;c-com&quot;&gt;&#x2F;&#x2F; the network&#x27;s opinion of itself, iterated to a fixed point&lt;&#x2F;span&gt;
&lt;span class=&quot;c-key&quot;&gt;fn&lt;&#x2F;span&gt; &lt;span class=&quot;c-fn&quot;&gt;settle&lt;&#x2F;span&gt;&lt;span class=&quot;c-pun&quot;&gt;&amp;lt;&lt;&#x2F;span&gt;&lt;span class=&quot;c-type&quot;&gt;T&lt;&#x2F;span&gt;&lt;span class=&quot;c-pun&quot;&gt;:&lt;&#x2F;span&gt; &lt;span class=&quot;c-type&quot;&gt;Eq&lt;&#x2F;span&gt; + &lt;span class=&quot;c-type&quot;&gt;Clone&lt;&#x2F;span&gt;&lt;span class=&quot;c-pun&quot;&gt;&amp;gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;c-key&quot;&gt;mut&lt;&#x2F;span&gt; x&lt;span class=&quot;c-pun&quot;&gt;:&lt;&#x2F;span&gt; &lt;span class=&quot;c-type&quot;&gt;T&lt;&#x2F;span&gt;&lt;span class=&quot;c-pun&quot;&gt;,&lt;&#x2F;span&gt; f&lt;span class=&quot;c-pun&quot;&gt;:&lt;&#x2F;span&gt; &lt;span class=&quot;c-key&quot;&gt;impl&lt;&#x2F;span&gt; &lt;span class=&quot;c-type&quot;&gt;Fn&lt;&#x2F;span&gt;&lt;span class=&quot;c-pun&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;c-type&quot;&gt;T&lt;&#x2F;span&gt;&lt;span class=&quot;c-pun&quot;&gt;)&lt;&#x2F;span&gt; -&amp;gt; &lt;span class=&quot;c-type&quot;&gt;T&lt;&#x2F;span&gt;&lt;span class=&quot;c-pun&quot;&gt;)&lt;&#x2F;span&gt; -&amp;gt; &lt;span class=&quot;c-type&quot;&gt;T&lt;&#x2F;span&gt; &lt;span class=&quot;c-pun&quot;&gt;{&lt;&#x2F;span&gt;
    &lt;span class=&quot;c-key&quot;&gt;loop&lt;&#x2F;span&gt; &lt;span class=&quot;c-pun&quot;&gt;{&lt;&#x2F;span&gt;
        &lt;span class=&quot;c-key&quot;&gt;let&lt;&#x2F;span&gt; next = &lt;span class=&quot;c-fn&quot;&gt;f&lt;&#x2F;span&gt;&lt;span class=&quot;c-pun&quot;&gt;(&amp;amp;&lt;&#x2F;span&gt;x&lt;span class=&quot;c-pun&quot;&gt;);&lt;&#x2F;span&gt;
        &lt;span class=&quot;c-key&quot;&gt;if&lt;&#x2F;span&gt; next == x &lt;span class=&quot;c-pun&quot;&gt;{&lt;&#x2F;span&gt; &lt;span class=&quot;c-key&quot;&gt;return&lt;&#x2F;span&gt; x&lt;span class=&quot;c-pun&quot;&gt;; }&lt;&#x2F;span&gt;  &lt;span class=&quot;c-com&quot;&gt;&#x2F;&#x2F; ∴ eval(x) = x&lt;&#x2F;span&gt;
        x = next&lt;span class=&quot;c-pun&quot;&gt;;&lt;&#x2F;span&gt;
    &lt;span class=&quot;c-pun&quot;&gt;}&lt;&#x2F;span&gt;
&lt;span class=&quot;c-pun&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;You can call &lt;code&gt;settle&lt;&#x2F;code&gt; on anything that knows how to compare itself to a previous version of itself. Nodes in &lt;code&gt;nibli&lt;&#x2F;code&gt;&#x27;s federated gossip do exactly this: they exchange knowledge until no opinion changes, and then they call that agreement. The optimism is not that agreement is guaranteed — it isn&#x27;t. The optimism is that it is &lt;em&gt;worth iterating toward anyway&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;three-properties-of-things-that-last&quot;&gt;Three properties of things that last&lt;&#x2F;h3&gt;
&lt;p&gt;When I look at the systems that have outlived their original purpose, they tend to share a few traits:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;They are deterministic.&lt;&#x2F;strong&gt; Same inputs, same history, every time. A future maintainer can replay the past instead of guessing at it.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;They are small.&lt;&#x2F;strong&gt; A 12kB core can be understood, ported, and resurrected. A 12MB one becomes a fossil the moment its authors leave.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;They are honest about limits.&lt;&#x2F;strong&gt; They say what they cannot do, in writing, near the code that cannot do it.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h4 id=&quot;an-aside-on-undecidability&quot;&gt;An aside on undecidability&lt;&#x2F;h4&gt;
&lt;p&gt;There are questions our systems provably cannot answer — whether an arbitrary program halts, chief among them. This is not a flaw to engineer around so much as a horizon to build up to.&lt;a class=&quot;fn-ref&quot; href=&quot;#fn1&quot; id=&quot;fnref1&quot;&gt;1&lt;&#x2F;a&gt; Knowing the horizon exists is what lets you stop pretending you can see past it.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;writing-across-two-scripts&quot;&gt;Writing across two scripts&lt;&#x2F;h2&gt;
&lt;p&gt;I think in English and in Tamil, and the two scripts disagree about how a sentence should breathe. Long-form type has to hold both without one looking like an afterthought. Here is the same idea in both — the line-height has room for Tamil&#x27;s tall vowel signs:&lt;&#x2F;p&gt;
&lt;p lang=&quot;ta&quot; class=&quot;tamil&quot;&gt;ஒரு நிரல் தன்னைத்தானே எழுதிக்கொள்ளும்போது, அதற்கு வெளியே இருந்து எந்த அர்த்தமும் தேவையில்லை. அதுவே அதன் காரணம். &lt;span lang=&quot;en&quot;&gt;(A program that writes itself needs no meaning from outside; it is its own reason.)&lt;&#x2F;span&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Naming things well is the same act in either language: you are choosing the fixed point a future reader will resolve the symbol to. Choose generously.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;நம்பிக்கையோடு கட்டு. ஒன்றும் கடன் இல்லை. &lt;cite&gt;— build with hope; nothing is owed&lt;&#x2F;cite&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;so-build-anyway&quot;&gt;So: build anyway&lt;&#x2F;h2&gt;
&lt;p&gt;The nihilism is the premise, not the conclusion. The conclusion is a working system, committed to disk, that did not have to exist and does. That is the whole optimistic move — to look at an indifferent universe and add one more fixed point to it, on purpose.&lt;&#x2F;p&gt;
&lt;p&gt;One must imagine the compiler happy.&lt;&#x2F;p&gt;
&lt;div class=&quot;footnotes&quot;&gt;&lt;ol&gt;&lt;li id=&quot;fn1&quot;&gt;The halting problem: there is no general algorithm that decides, for every program-input pair, whether the program eventually halts. Turing, 1936. &lt;a class=&quot;fn-ref&quot; href=&quot;#fnref1&quot; aria-label=&quot;Back to content&quot;&gt;↩&lt;&#x2F;a&gt;&lt;&#x2F;li&gt;&lt;&#x2F;ol&gt;&lt;&#x2F;div&gt;
</description>
      </item>
      <item>
          <title>How I Annoyed My Way to Clash Royale&#x27;s Legendary Arena</title>
          <pubDate>Wed, 11 Jun 2025 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/clash-royale-legendary/</link>
          <guid>https://dhilipsiva.dev/musings/clash-royale-legendary/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/clash-royale-legendary/">&lt;p&gt;After months of grinding, defending, and annoying a lot of opponents, I&#x27;ve finally done it. I&#x27;ve reached the Legendary Arena at 9000 trophies. And I did it not with Golem or Hog Rider, but with my own weird, super-defensive deck that many people would say is crazy.&lt;&#x2F;p&gt;
&lt;p&gt;Today, I want to celebrate by sharing my full strategy with you all. No secrets held back. If you love to play smart, control the game, and drive your opponent mad with patience, then this post is for you.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;my-tools-of-trade-the-deck&quot;&gt;My Tools of Trade: The Deck&lt;&#x2F;h2&gt;
&lt;p&gt;First things first, here&#x27;s the deck list. All my cards are at Elite Level, which makes a big difference.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Buildings:&lt;&#x2F;strong&gt; Cannon, Tesla Tower, Mortar — The twin pillars of my defense.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Troops:&lt;&#x2F;strong&gt; Valkyrie, Knight, Dart Goblin, Ice Wizard — My ground control crew.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Special Card:&lt;&#x2F;strong&gt; Suspicious Bush — The sneaky little troublemaker.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Princess Tower Support:&lt;&#x2F;strong&gt; Cannoneer — For that extra punch against heavy troops.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;my-main-funda-the-susanoo-defense&quot;&gt;My Main Funda: The &quot;Susanoo&quot; Defense&lt;&#x2F;h2&gt;
&lt;p&gt;My main playstyle is pure defense. I like to think of it as activating &quot;Susanoo&quot; from Naruto — a perfect, almost unbreakable defense.&lt;&#x2F;p&gt;
&lt;p&gt;From the start of the game, I place my buildings right in the middle. This central fortress pulls any building-targeting troop (like Hog Rider or Golem) into a kill zone. A great trick against Hog Riders or Balloons is to place a building in a way that &lt;strong&gt;drags them to the middle, ensuring your King Tower gets activated early&lt;&#x2F;strong&gt;. An active King Tower is a massive defensive advantage for the rest of the game!&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-secret-sauce-play-mind-games-not-just-cards&quot;&gt;The Secret Sauce: Play Mind Games, Not Just Cards&lt;&#x2F;h2&gt;
&lt;p&gt;This deck is all about psychological warfare. My goal is to annoy the opponent so much that they start making mistakes.&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Forcing Bad Choices:&lt;&#x2F;strong&gt; If the enemy has a Fireball, I deliberately place my buildings and troops separately. They can&#x27;t get value by hitting both my tower and my building. They have to choose, and it frustrates them like anything.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Conditioning Your Opponent:&lt;&#x2F;strong&gt; This is a top-level secret. For the first few minutes, I use the same defensive patterns. The opponent gets comfortable. They think, &quot;Okay, I know what this guy is going to do.&quot; They become predictable. And then, at a crucial moment, I break the pattern — a slightly different placement, an unexpected push — and it completely throws them off their game.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The &lt;strong&gt;Suspicious Bush&lt;&#x2F;strong&gt; is my ultimate mind-game tool. I drop it at the back. It moves slowly, it&#x27;s invisible to troops, and the opponent &lt;em&gt;has&lt;&#x2F;em&gt; to deal with it. It&#x27;s a brilliant way to force them to spend elixir and distract them while I prepare my real plan.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-aha-moment-the-surprise-attack&quot;&gt;The &quot;Aha!&quot; Moment: The Surprise Attack&lt;&#x2F;h2&gt;
&lt;p&gt;After defending and defending, I&#x27;m constantly tracking the opponent&#x27;s cards and elixir. There are moments in a game, usually in 2x elixir, where I know for a fact that the opponent is low on elixir and their main defensive card is out of their hand.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;BAM!&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;I immediately drop my &lt;strong&gt;Mortar right at the bridge&lt;&#x2F;strong&gt; or in the center. After seeing my mortar being used for defense throughout the game, I surprise them with a offensive placement when they are at their weakest. They panic. They drop cards frantically near the Mortar to kill it.&lt;&#x2F;p&gt;
&lt;p&gt;But it&#x27;s too late. I&#x27;ve already anticipated their move and dropped a Tesla or a Knight to protect my Mortar. Once the panic starts, I push it further by spamming whatever I have at the bridge to keep them overwhelmed.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-real-magic-skills-you-need-to-master&quot;&gt;The Real Magic: Skills You Need to Master&lt;&#x2F;h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;1. Become a Master Counter (Elixir &amp;amp; Cards):&lt;&#x2F;strong&gt; Don&#x27;t just guess when the opponent is low. Know it. Watch every card they play and do the maths. More importantly, track their 4-card cycle. The best time to attack isn&#x27;t just when they are low on elixir, but when their best counter to your Mortar is not in their hand.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;2. Master Your Placements:&lt;&#x2F;strong&gt; Learn the exact tile to place your buildings to pull every type of troop and to activate your King Tower. A one-tile difference is the difference between winning and losing.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;3. Control Your Card Cycle:&lt;&#x2F;strong&gt; This is key. When the pressure is low, quickly play your cheap cards like Dart Goblin or Suspicious Bush (even at the back). This ensures your most important defensive cards, like Tesla or Valkyrie, are always in your hand right when you need them most.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;4. Know When to Switch (Defense to Attack):&lt;&#x2F;strong&gt; You are a defender 90% of the time. But you need to have the guts to switch to a full-on attacker in that 10% window of opportunity. Be patient, then be aggressive, then immediately be patient again if your push fails.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;the-one-big-weakness-and-how-to-fix-it&quot;&gt;The One Big Weakness (And How to Fix It)&lt;&#x2F;h2&gt;
&lt;p&gt;I&#x27;ll be honest, the deck struggles against heavy air decks like Lava Hound with Balloon. It&#x27;s tough. If you are facing a lot of air decks, here&#x27;s the one change I sometimes make:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Swap Cannon for Fireball or Poison.&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Losing a building hurts my core defense, but having a big spell lets me damage support troops like Wizards hiding behind a tank, and it can help me chip down a tower to win the game.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;final-thoughts&quot;&gt;Final Thoughts&lt;&#x2F;h2&gt;
&lt;p&gt;Reaching Legendary Arena wasn&#x27;t about raw power. It was about patient defense, clever psychological play, meticulous elixir management, and strategic surprise. This deck is my proof.&lt;&#x2F;p&gt;
&lt;p&gt;Try this approach yourself, be patient, and watch your opponents crumble under the pressure of a true defensive master!&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Black Holes, True Vacuum, and Cosmic Fabric: An Enthusiast&#x27;s Ramblings</title>
          <pubDate>Tue, 20 Aug 2024 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/black-holes-true-vacuum/</link>
          <guid>https://dhilipsiva.dev/musings/black-holes-true-vacuum/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/black-holes-true-vacuum/">&lt;h2 id=&quot;disclaimer-i-am-an-idiot&quot;&gt;&lt;strong&gt;Disclaimer: I am an Idiot&lt;&#x2F;strong&gt;&lt;&#x2F;h2&gt;
&lt;p&gt;First things first, let me make something absolutely clear — I am not a physicist. In fact, I am very far from one. I&#x27;m just an idiot who is extremely enthusiastic about science in general and a fanboy of theoretical physics in particular. I&#x27;ve read a bit, watched a lot of YouTube videos, and done my share of daydreaming about the mysteries of the universe. So, please take everything I say with a grain of salt because I mostly don&#x27;t have a clue about what I&#x27;m talking about. This blog post is more of a thought experiment (not to mention factually wrong), a wild idea that popped into my head, and I&#x27;m putting it out here in the hope that maybe someone would just indulge my mediocrity.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;What if We Were Wrong About Vacuum Decay Expanding at the Speed of Light?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Before diving into my hypothesis (Well, not really a hypothesis — just an imagination of mine), let&#x27;s entertain the possibility that the widely accepted theory about vacuum decay expanding at nearly the speed of light might be incorrect (I know. I know it is ridiculous, we might as well assume that one could fit an entire, fully-grown elephant inside a tennis ball). What if, instead, the expansion happened at a slower or different speed, altering our entire understanding of how this catastrophic event would unfold? This seemingly small change could have profound implications for our theories about the universe, particularly when we consider phenomena like black holes.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;the-hypothesis-black-holes-as-regions-of-true-er-vacuum&quot;&gt;The Hypothesis: Black Holes as Regions of True(er) Vacuum&lt;&#x2F;h1&gt;
&lt;p&gt;So, here&#x27;s the idea I&#x27;ve been toying with: What if black holes are regions of space-time where the quantum fields have undergone a phase transition to a true (or truer) vacuum? Essentially, this means that black holes could be areas where vacuum decay, something that theoretical physicists speculate about, has already happened.&lt;&#x2F;p&gt;
&lt;p&gt;If vacuum decay didn&#x27;t necessarily expand at almost the speed of light, then perhaps the extreme conditions surrounding a collapsing star could trigger this phase transition locally, leading to the formation of a black hole as we observe it today. This would mean that what we think of as a black hole could actually be a region of space where a more stable vacuum has replaced the original false vacuum.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;the-role-of-a-collapsing-star&quot;&gt;The Role of a Collapsing Star&lt;&#x2F;h1&gt;
&lt;p&gt;Let&#x27;s add another layer to this daydream. Imagine a massive star reaching the end of its life. As it collapses under its own gravity, the conditions become so extreme — high energy densities, intense gravitational forces — that this collapse could trigger a vacuum decay. In this scenario, the collapse of the star doesn&#x27;t just create a black hole as we traditionally understand it; it catalyzes a phase transition, turning the region inside the event horizon into a true vacuum or something closer to it. This new vacuum state, being more stable or energetically favorable, would replace the old one, and the result would be what we observe as a black hole.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;event-horizon-as-a-fabric-of-cosmic-strings&quot;&gt;Event Horizon as a Fabric of Cosmic Strings&lt;&#x2F;h1&gt;
&lt;p&gt;Now, extending this idea further: What if the event horizon — the boundary of a black hole beyond which nothing can escape — isn&#x27;t just a simple boundary? What if it&#x27;s actually a &quot;fabric of cosmic strings,&quot; a sort of mesh made up of these one-dimensional defects in space-time that separates different vacuum states inside and outside the event horizon? These cosmic strings could represent a gradient between regions of false vacuum outside the event horizon and regions that have undergone or are undergoing a phase transition to a truer vacuum inside.&lt;&#x2F;p&gt;
&lt;p&gt;Hawking radiation, the process by which black holes are thought to slowly lose mass, could be a byproduct of the interaction between these vacuum states across this fabric of cosmic strings. The radiation we observe might be the result of the quantum states outside the fabric gradually aligning with those inside it.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;potential-resolutions-what-could-this-hypothesis-explain&quot;&gt;Potential Resolutions: What Could This Hypothesis Explain?&lt;&#x2F;h1&gt;
&lt;p&gt;Let&#x27;s start with what this hypothesis might resolve or explain:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Event Horizon as a Dynamic Interface:&lt;&#x2F;strong&gt; The idea of the event horizon as a fabric of cosmic strings separating different quantum states could give us a more intuitive understanding of why this boundary exists and how it operates. Instead of just being a point of no return, it could be an active interface between two distinct regions of space-time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Hawking Radiation as a Quantum Process:&lt;&#x2F;strong&gt; If Hawking radiation is the result of quantum states aligning across the fabric of cosmic strings, it might offer a deeper explanation for why this radiation occurs in the first place. This could potentially tie in more closely with the fluctuations in quantum fields that are known to happen near the event horizon.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Black Hole Thermodynamics:&lt;&#x2F;strong&gt; The relationship between a black hole&#x27;s entropy and the area of its event horizon is well understood in the current framework of black hole thermodynamics. This hypothesis might offer a new perspective by suggesting that the entropy is related not just to the event horizon area, but also to the interaction between different vacuum states across this fabric. The fabric of cosmic strings could be seen as a mediator of thermodynamic processes, linking the internal and external states of the black hole in a more fundamental way.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;No-Hair Theorem:&lt;&#x2F;strong&gt; The no-hair theorem states that black holes can be completely described by just three properties: mass, charge, and angular momentum. They do not retain any other information about the matter that formed them. If the event horizon is a fabric of cosmic strings, it might suggest that additional information (related to the nature of the vacuum states) could be encoded in this boundary. This could potentially refine our understanding of black hole properties, allowing for a more nuanced view that still respects the theorem but adds depth to what those &quot;hairs&quot; might represent in terms of quantum states.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;potential-conflicts-where-this-hypothesis-might-fall-apart&quot;&gt;Potential Conflicts: Where This Hypothesis Might Fall Apart&lt;&#x2F;h1&gt;
&lt;p&gt;Now, let&#x27;s tackle the elephant in the room — the potential problems that this hypothesis might run into:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Spacetime Geometry and General Relativity:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Conflict:&lt;&#x2F;strong&gt; This hypothesis might conflict with the established geometry of space-time around black holes, as predicted by general relativity. The current solutions to Einstein&#x27;s field equations, like the Schwarzschild or Kerr metrics, work well in explaining what we observe. Any new model would need to either fit within these existing solutions or replace them entirely.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Potential Reconciliation:&lt;&#x2F;strong&gt; If the fabric of cosmic strings is a more detailed description of what we currently understand as the event horizon, it might be possible to reconcile this idea with general relativity. Perhaps the fabric is a manifestation of the extreme warping of space-time predicted by Einstein&#x27;s equations, with the vacuum state transition being a quantum phenomenon that occurs within this warped space-time.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Black Hole Thermodynamics:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Conflict:&lt;&#x2F;strong&gt; The relationship between a black hole&#x27;s entropy and the area of its event horizon is deeply entrenched in our current understanding of black hole thermodynamics. If we introduce the idea of a fabric of cosmic strings, we must ensure that this new interpretation aligns with the well-established principles of thermodynamics. We would need to explore whether the fabric introduces new variables or modifies the existing entropy-area relationship in a consistent manner.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Potential Reconciliation:&lt;&#x2F;strong&gt; The fabric of cosmic strings could be seen as an additional layer that complements our understanding of black hole entropy. It might provide a more fundamental explanation for why entropy scales with the event horizon area, potentially tying it to quantum field interactions across different vacuum states. If this can be mathematically formalized, it could enhance our understanding rather than contradict it.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Observational Evidence:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Conflict:&lt;&#x2F;strong&gt; The hypothesis would also need to account for all the observations we have of black holes, such as gravitational waves from black hole mergers, the shadow of M87* captured by the Event Horizon Telescope, and the behavior of light and matter near black holes. These phenomena are well explained by our current understanding, so any new hypothesis must be able to explain these too.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Potential Reconciliation:&lt;&#x2F;strong&gt; If the fabric hypothesis can predict similar observational outcomes to current theories, it might not conflict with existing evidence. For instance, if the fabric&#x27;s properties lead to the same gravitational effects as predicted by general relativity, we could still explain gravitational waves and the behavior of light. The key would be ensuring that the fabric&#x27;s influence is consistent with what we observe.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;No-Hair Theorem:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Conflict:&lt;&#x2F;strong&gt; The simplicity of the no-hair theorem is one of its strengths. If we add the idea of a fabric with additional quantum information, we risk complicating the theorem. Any additional characteristics or information encoded in the event horizon must be consistent with the observation that black holes appear remarkably simple and must not lead to observable contradictions, such as unexpected radiation or particles that haven&#x27;t been observed.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Potential Reconciliation:&lt;&#x2F;strong&gt; The fabric of cosmic strings might encode information in a way that doesn&#x27;t violate the no-hair theorem but rather adds a layer of depth to it. For example, this additional information could be inherently inaccessible to outside observers, meaning it doesn&#x27;t manifest in observable properties that would contradict the theorem. It could be analogous to quantum entanglement, where information exists but isn&#x27;t directly observable in a way that violates established principles.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Cosmological Implications:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Conflict:&lt;&#x2F;strong&gt; If black holes are regions where a vacuum decay has already occurred, why don&#x27;t we see similar effects elsewhere in the universe? The hypothesis would need to explain why this phase transition is confined to black holes and how it impacts the broader cosmos. Moreover, if vacuum decay can be triggered by collapsing stars, this might have broader implications for our understanding of the universe&#x27;s stability.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Potential Reconciliation:&lt;&#x2F;strong&gt; It&#x27;s possible that the conditions required to trigger this vacuum transition are so extreme that they only occur in the cores of collapsing stars or other similarly intense environments. This would confine vacuum decay to black holes and prevent it from spreading across&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;Why Am I Writing This?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Honestly, I&#x27;m writing this because I hope someone, just as lunatic as I am, out there might find it interesting to talk about fringe ideas like this. Maybe they&#x27;ll laugh it off, or maybe they&#x27;ll take it as an opportunity to dive into some interesting physics and give me a clearer understanding of how black holes and vacuum decay actually work.&lt;&#x2F;p&gt;
&lt;p&gt;Also, I can&#x27;t take full credit for putting these ideas together. I had a lot of help from ChatGPT, my trusty AI assistant, who helped me organize my thoughts and flesh out this post.&lt;&#x2F;p&gt;
&lt;p&gt;So, there it is — a wild idea from a science enthusiast who is more clueless than not.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Harnessing Solar Power for Sustainable Water Desalination</title>
          <pubDate>Mon, 06 May 2024 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/solar-desalination/</link>
          <guid>https://dhilipsiva.dev/musings/solar-desalination/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/solar-desalination/">&lt;p&gt;Hello, everyone!&lt;&#x2F;p&gt;
&lt;p&gt;I&#x27;m exploring an innovative approach to convert saltwater into drinkable freshwater using solar energy, and I&#x27;m eager to gather insights and feedback from experts and enthusiasts alike.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;the-idea&quot;&gt;The Idea&lt;&#x2F;h1&gt;
&lt;p&gt;The concept is simple yet potentially transformative. It involves using a massive magnifying lens to concentrate solar energy onto a large container of seawater. The goal is to boil the water at its center, reducing salt deposition on the container walls and instead allowing it to settle at the bottom as sediment. This sediment can then be periodically removed, ensuring efficient operation.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;why-this-approach&quot;&gt;Why This Approach?&lt;&#x2F;h1&gt;
&lt;p&gt;Traditional methods of desalination, like boiling or reverse osmosis, require a lot of energy and can be expensive. They also tend to leave behind salt deposits that can degrade equipment over time. By using solar power, we aim to minimize energy costs and reduce the environmental footprint of desalination.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;location-and-setup&quot;&gt;Location and Setup&lt;&#x2F;h1&gt;
&lt;p&gt;I believe the best location for this setup would be near coastal areas where sunlight is abundant throughout the year. The use of a high-grade optical lens to focus sunlight precisely could potentially bring water to a boil without the need for external energy sources.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;challenges-ahead&quot;&gt;Challenges Ahead&lt;&#x2F;h1&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Convection Currents&lt;&#x2F;strong&gt;: Heating water in the center might lead to convection currents that could distribute salts throughout the container. We need to think about how to manage this to prevent salt from depositing on the container walls.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Materials&lt;&#x2F;strong&gt;: The choice of materials for the container and the lens is crucial. They need to withstand high temperatures and corrosive saltwater. Options like stainless steel or titanium for the container and high-grade optical glass for the lens are on the table.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Scaling&lt;&#x2F;strong&gt;: How do we scale this setup to make it practical for large-scale water production? Modular setups might be the answer, allowing for easier maintenance and adaptability.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h1 id=&quot;economic-and-environmental-considerations&quot;&gt;Economic and Environmental Considerations&lt;&#x2F;h1&gt;
&lt;p&gt;The initial costs, including the lens, structural setup, and land, could be significant. However, the use of local resources and materials could help in reducing these expenses. Environmentally, using solar power reduces carbon emissions dramatically, but we must also consider the lifecycle of the materials used.&lt;&#x2F;p&gt;
&lt;h1 id=&quot;seeking-your-thoughts&quot;&gt;Seeking Your Thoughts&lt;&#x2F;h1&gt;
&lt;p&gt;I&#x27;m looking for feedback on:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Potential design and material suggestions.&lt;&#x2F;li&gt;
&lt;li&gt;Insights on solar energy concentration and heat management.&lt;&#x2F;li&gt;
&lt;li&gt;Ideas for scaling and possibly automating the process.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Your expert opinions, thoughts, and critiques would be incredibly valuable as I refine this idea further. Let&#x27;s discuss the potential of solar-powered desalination and how we can overcome the associated challenges together!&lt;&#x2F;p&gt;
&lt;p&gt;Thank you for reading, and I look forward to your insights!&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Analyzing Python Compression Libraries: zlib, LZ4, Brotli, and Zstandard</title>
          <pubDate>Mon, 29 Apr 2024 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/python-compression/</link>
          <guid>https://dhilipsiva.dev/musings/python-compression/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/python-compression/">&lt;p&gt;GitHub: &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;dhilipsiva&#x2F;py-compress-compare&quot;&gt;https:&#x2F;&#x2F;github.com&#x2F;dhilipsiva&#x2F;py-compress-compare&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;When dealing with large volumes of data, compression can be a critical factor in enhancing performance, reducing storage costs, and speeding up network transfers. In this blog post, we will dive into a comparison of four popular Python compression libraries—zlib, LZ4, Brotli, and Zstandard—using a real-world dataset to evaluate their performance in terms of compression ratio and time efficiency.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-experiment-setup&quot;&gt;The Experiment Setup&lt;&#x2F;h2&gt;
&lt;p&gt;Our test involved a dataset roughly 581 KB in size, named sample_data.json. We executed compression and decompression using each library as follows:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Compression was performed 1000 times.&lt;&#x2F;li&gt;
&lt;li&gt;Decompression was repeated 10,000 times.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;This rigorous testing framework ensures that we obtain a solid understanding of each library&#x27;s performance under heavy load.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;compression-ratio&quot;&gt;Compression Ratio&lt;&#x2F;h2&gt;
&lt;p&gt;The compression ratio is a key metric that represents how effectively a compression algorithm can reduce the size of the input data. Here&#x27;s how each library scored:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Zlib achieved a compression ratio of 27.84,&lt;&#x2F;li&gt;
&lt;li&gt;LZ4 came in at 18.23,&lt;&#x2F;li&gt;
&lt;li&gt;Brotli impressed with a ratio of 64.78,&lt;&#x2F;li&gt;
&lt;li&gt;Zstandard offered a ratio of 43.42.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;From these results, Brotli leads with the highest compression ratio, indicating its superior efficiency in data size reduction. Zstandard also shows strong performance, while LZ4, though lower, still provides a reasonable reduction.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;compression-time&quot;&gt;Compression Time&lt;&#x2F;h2&gt;
&lt;p&gt;Efficiency isn&#x27;t just about space savings; time is equally crucial. Here&#x27;s how long each library took to compress the data:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Zlib: 7.34 seconds,&lt;&#x2F;li&gt;
&lt;li&gt;LZ4: 0.13 seconds,&lt;&#x2F;li&gt;
&lt;li&gt;Brotli: 204.18 seconds,&lt;&#x2F;li&gt;
&lt;li&gt;Zstandard: 0.15 seconds.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;LZ4 and Zstandard excel in speed, with LZ4 being slightly faster. Zlib offers a middle ground, but Brotli, despite its high compression efficiency, takes significantly longer, which could be a drawback for real-time applications.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;decompression-time&quot;&gt;Decompression Time&lt;&#x2F;h2&gt;
&lt;p&gt;Decompression time is vital for applications where data needs to be rapidly restored to its original state:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Zlib: 11.99 seconds,&lt;&#x2F;li&gt;
&lt;li&gt;LZ4: 0.46 seconds,&lt;&#x2F;li&gt;
&lt;li&gt;Brotli: 0.99 seconds,&lt;&#x2F;li&gt;
&lt;li&gt;Zstandard: 0.46 seconds.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Again, LZ4 and Zstandard show excellent performance, both under half a second. Brotli presents a decent time despite its lengthy compression time, while zlib lags behind in this aspect.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;&#x2F;h2&gt;
&lt;p&gt;Each library has its strengths and weaknesses:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;Brotli is your go-to for maximum compression but at the cost of time, making it suitable for applications where compression time is less critical.&lt;&#x2F;li&gt;
&lt;li&gt;Zstandard offers a great balance between compression ratio and speed, recommended for a wide range of applications.&lt;&#x2F;li&gt;
&lt;li&gt;LZ4 shines in speed, ideal for scenarios requiring rapid data processing.&lt;&#x2F;li&gt;
&lt;li&gt;Zlib provides moderate performance across the board.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Choosing the right library depends on your specific needs, whether it&#x27;s speed, space, or a balance of both. This experiment provides a clear picture of what to expect from these libraries, helping you make an informed decision based on your application&#x27;s requirements.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Building an Efficient WebSocket Server with Actix Actors and Protobuf</title>
          <pubDate>Thu, 29 Feb 2024 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/actix-websocket-protobuf/</link>
          <guid>https://dhilipsiva.dev/musings/actix-websocket-protobuf/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/actix-websocket-protobuf/">&lt;p&gt;In the modern era of real-time web applications, WebSocket has emerged as a cornerstone technology enabling interactive communication sessions between a user&#x27;s browser and a server. With the need for high performance, reliability, and scalability in these applications, choosing the right technology stack is paramount. In this context, Rust&#x27;s Actix framework, combined with the efficiency of Protobuf for message serialization, offers a compelling choice over other popular technologies like Python, Node.js, and Go. Let&#x27;s delve into how to implement a WebSocket server using Actix actors and why this combination might just be the superior choice for your next project.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;why-choose-rust-s-actix&quot;&gt;Why Choose Rust&#x27;s Actix?&lt;&#x2F;h2&gt;
&lt;p&gt;Before we jump into the implementation details, let&#x27;s understand why Rust, particularly with its Actix framework, stands out:&lt;&#x2F;p&gt;
&lt;h2 id=&quot;performance&quot;&gt;Performance&lt;&#x2F;h2&gt;
&lt;p&gt;Rust&#x27;s zero-cost abstractions and ownership model ensure memory safety without the need for a garbage collector, leading to blazing-fast performance. Actix further leverages Rust&#x27;s async capabilities, making it incredibly efficient for IO-bound tasks common in WebSocket communication.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;reliability&quot;&gt;Reliability&lt;&#x2F;h2&gt;
&lt;p&gt;Rust&#x27;s compile-time checks eliminate a whole class of runtime errors, making your WebSocket server more reliable. Actix actors encapsulate state and behavior, reducing shared state and side effects, which are often sources of bugs in concurrent systems.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;scalability&quot;&gt;Scalability&lt;&#x2F;h2&gt;
&lt;p&gt;Actix&#x27;s actor model provides a natural way to build concurrent and distributed systems. Each actor runs independently, allowing for easy scaling across threads or even network boundaries.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;implementing-websocket-server-with-actix&quot;&gt;Implementing WebSocket Server with Actix&lt;&#x2F;h2&gt;
&lt;p&gt;Setting up a WebSocket server in Actix is straightforward. Here&#x27;s a simplified version to get us started:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;rust&quot;&gt;use actix::prelude::*;
use actix_web::{web, App, HttpServer, HttpRequest, HttpResponse};
use actix_web_actors::ws;

struct MyWs;

impl Actor for MyWs {
    type Context = ws::WebsocketContext&amp;lt;Self&amp;gt;;
}

impl StreamHandler&amp;lt;Result&amp;lt;ws::Message, ws::ProtocolError&amp;gt;&amp;gt; for MyWs {
    fn handle(&amp;amp;mut self, msg: Result&amp;lt;ws::Message, ws::ProtocolError&amp;gt;, ctx: &amp;amp;mut Self::Context) {
        if let Ok(ws::Message::Binary(bin)) = msg {
            &#x2F;&#x2F; handle binary (Protobuf) messages here
        }
    }
}

async fn ws_index(r: HttpRequest, stream: web::Payload) -&amp;gt; Result&amp;lt;HttpResponse, actix_web::Error&amp;gt; {
    ws::start(MyWs {}, &amp;amp;r, stream)
}

#[actix_web::main]
async fn main() -&amp;gt; std::io::Result&amp;lt;()&amp;gt; {
    HttpServer::new(|| {
        App::new().route(&amp;quot;&#x2F;ws&#x2F;&amp;quot;, web::get().to(ws_index))
    })
    .bind(&amp;quot;127.0.0.1:8080&amp;quot;)?
    .run()
    .await
}
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;efficient-message-parsing-with-protobuf&quot;&gt;Efficient Message Parsing with Protobuf&lt;&#x2F;h2&gt;
&lt;p&gt;For fast and efficient parsing of message events, we integrate Protobuf. Protobuf not only reduces the payload size significantly compared to JSON but also offers a structured way to define and parse your data.&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Define your Protobuf messages&lt;&#x2F;strong&gt;: First, you&#x27;ll need &lt;code&gt;.proto&lt;&#x2F;code&gt; files that define the structure of your messages.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Generate Rust code&lt;&#x2F;strong&gt;: Use &lt;code&gt;prost-build&lt;&#x2F;code&gt; in your &lt;code&gt;build.rs&lt;&#x2F;code&gt; to generate Rust code from your &lt;code&gt;.proto&lt;&#x2F;code&gt; files.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Serialize&#x2F;Deserialize with Protobuf&lt;&#x2F;strong&gt;: Modify the WebSocket message handling in &lt;code&gt;MyWs&lt;&#x2F;code&gt; to serialize and deserialize messages using the generated Protobuf code.&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h2 id=&quot;comparing-with-python-node-js-and-go&quot;&gt;Comparing with Python, Node.js, and Go&lt;&#x2F;h2&gt;
&lt;p&gt;While Python and Node.js are immensely popular for their rapid development capabilities, their performance, particularly in CPU-bound tasks and highly concurrent environments, doesn&#x27;t match Rust&#x27;s. Python&#x27;s dynamic nature and Node.js&#x27;s single-threaded event loop can be limiting for real-time, high-throughput applications.&lt;&#x2F;p&gt;
&lt;p&gt;Go, on the other hand, offers excellent concurrency support through goroutines and a performance profile that&#x27;s generally better than Python or Node.js. However, Rust&#x27;s zero-cost abstractions and lack of a garbage collector can lead to more predictable performance under load, making it a strong competitor, especially in scenarios where latency and throughput are critical.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;&#x2F;h2&gt;
&lt;p&gt;By leveraging Actix and Protobuf, you can build a WebSocket server that stands out in terms of performance, reliability, and scalability. This powerful combination not only ensures efficient message parsing with minimal overhead but also benefits from Rust&#x27;s safety and concurrency model, making it an excellent choice over Python, Node.js, and Go for your next real-time application.&lt;&#x2F;p&gt;
&lt;p&gt;The journey doesn&#x27;t stop here, though. Experimenting with Actix&#x27;s full potential, exploring Protobuf&#x27;s capabilities, and benchmarking your server against other technologies will provide deeper insights and help tailor your application to your specific needs. Happy coding!&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>The Feathered Bond: Insights from Raising Birds of All Sizes</title>
          <pubDate>Sat, 24 Feb 2024 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/the-feathered-bond/</link>
          <guid>https://dhilipsiva.dev/musings/the-feathered-bond/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/the-feathered-bond/">&lt;p&gt;In the gentle flutter of wings and the soft chirping at dawn, my journey with birds began — not as an expert avian enthusiast but as a curious soul drawn to these vibrant creatures. Over the years, my aviary have been a sanctuary to Sun Conures, Green Cheek Conures, parakeets, lovebirds, and pigeons. Each bird, with its unique chirp and character, has taught me the profound intricacies of avian bonding. The most striking lesson? The pivotal role of hand-raising and the surprising impact of a bird&#x27;s size on its ability to bond with humans.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;hand-raised-hearts&quot;&gt;Hand-Raised Hearts&lt;&#x2F;h2&gt;
&lt;p&gt;Half of my feathered friends came to me as babies, their tiny hearts beating fast, their eyes wide with the innocence of youth. These hand-raised birds grew up with human touch as a cornerstone of their existence. The comfort they find in human presence, the way they seek warmth from my hands, speaks volumes of the bond formed during those early days. The process wasn&#x27;t merely about feeding; it was about building trust, a bridge between species, one gentle interaction at a time.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-adult-adoption-challenge&quot;&gt;The Adult Adoption Challenge&lt;&#x2F;h2&gt;
&lt;p&gt;The other half of my avian family came as adults, each with a history I could only guess at. These birds, despite my best efforts, maintained a cautious distance. Most would fly away as I entered the aviary, an invisible barrier between us, save for my adult-purchased Sun Conures, who, in their own time, chose to bridge that gap. This stark difference in bonding led me to ponder the nuances of avian trust and the potential hurdles in bonding with birds that have not been hand-raised.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;size-matters-in-avian-bonds&quot;&gt;Size Matters in Avian Bonds&lt;&#x2F;h2&gt;
&lt;p&gt;An unexpected pattern emerged over time — the larger the bird, the more likely it was to bond well with humans. My smaller birds, like the parakeets and lovebirds, remained distant, their trust harder to earn. In contrast, my Sun Conures, despite their later introduction to human interaction, showed remarkable openness. This observation led me down a path of inquiry and speculation: Does the size of a bird inherently influence its capacity for human connection, or are other factors at play?&lt;&#x2F;p&gt;
&lt;h2 id=&quot;the-sun-conure-exception&quot;&gt;The Sun-Conure Exception&lt;&#x2F;h2&gt;
&lt;p&gt;My Sun Conures, adopted as adults, defy the norm. Unlike their smaller counterparts, they exhibit a curiosity and warmth towards me that belies their later start in human interaction. This exception to the rule has been a source of both joy and curiosity. It prompts questions about the roles of species traits, individual personalities, and perhaps the nuances of my approach to their care.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;fostering-feathers-of-trust&quot;&gt;Fostering Feathers of Trust&lt;&#x2F;h2&gt;
&lt;p&gt;Bonding with both hand-raised and adult birds has been a journey of patience, understanding, and adaptation. For those looking to forge a bond with their feathered friends, here are a few tips:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Patience is Key&lt;&#x2F;strong&gt;: Bonding takes time, especially with adult-adopted birds. Respect their pace.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Consistency in Care&lt;&#x2F;strong&gt;: Regular, gentle interactions can build trust, even if progress seems slow.&lt;&#x2F;li&gt;
&lt;li&gt;&lt;strong&gt;Understanding Individual Needs&lt;&#x2F;strong&gt;: Each bird is unique. Tailor your approach to their personality and comfort level.&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;reflecting-on-the-avian-connection&quot;&gt;Reflecting on the Avian Connection&lt;&#x2F;h2&gt;
&lt;p&gt;My experiences have taught me that the essence of bonding with birds lies in understanding and respecting their individuality. Whether hand-raised or adopted as adults, small or large, each bird offers a unique window into the world of avian-human relationships. The journey of bonding with these magnificent creatures is a testament to the power of patience, empathy, and love.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;join-the-flock&quot;&gt;Join the Flock&lt;&#x2F;h2&gt;
&lt;p&gt;I invite you to share your own stories of avian companionship. Have you noticed a correlation between a bird&#x27;s size and its ability to bond with humans? What has been your experience in fostering a connection with hand-raised versus adult-adopted birds? Let&#x27;s continue the conversation in the comments below.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Looking for a new Role</title>
          <pubDate>Fri, 09 Sep 2022 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/looking-for-a-new-role/</link>
          <guid>https://dhilipsiva.dev/musings/looking-for-a-new-role/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/looking-for-a-new-role/">&lt;p&gt;After 3.8 years of working at Reckonsys as VP of Engneering, I am looking for a new role now. My notice period at Reckonsys ended on August 31, 2022. One of the main problems I am facing has to do with carrying the title &quot;VPE&quot;. People assume that I have taken up managerial position. But this if from from the truth. Despite being a VPE, 70% of my time has been invested in hands-on coding. To be honest, title &quot;VPE&quot; is wildly inaccurate for what I have been doing at Reckonsys. I would say only about 20% of time was spent doing what and Actual VPE would do. A &lt;strong&gt;glorified Tech Lead that took on part-time VPE&lt;&#x2F;strong&gt; role would be more accurate :P.&lt;&#x2F;p&gt;
&lt;p&gt;All that being said, I am currently looking for &lt;strong&gt;Python&#x2F;Rust roles where I can be hands-on at least 70%&lt;&#x2F;strong&gt; of my time. More precisely, I love building &lt;strong&gt;micro-services&lt;&#x2F;strong&gt;, Setting up &lt;strong&gt;CI&#x2F;CD&lt;&#x2F;strong&gt; or &lt;strong&gt;DevOps&lt;&#x2F;strong&gt; pipelines, &lt;strong&gt;scale&lt;&#x2F;strong&gt; said service and doing a bit of &lt;strong&gt;SRE&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;I usually spend most of my time building python (micro)services. But I also have built production services with JavaScript (Browser + Node), C, Go, PHP, Ruby, Objective-C, C# &amp;amp; Java. I have worked on all levels of a typical web application stack. I architect, code, deploy, (auto)scale, and maintain server-side (.py, .rs), browser-side (.js, .ts, .wasm) &amp;amp; infra (terraform, pulumi, CDK) code. Here is a non-exhaustive list of things that I built in the past:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;GraphQL, RPC &amp;amp; RESTful microservices with Python&lt;&#x2F;li&gt;
&lt;li&gt;JavaScript frontends with Ember &amp;amp; React&lt;&#x2F;li&gt;
&lt;li&gt;DevOps pipelines&lt;&#x2F;li&gt;
&lt;li&gt;E2E Test Automation Framework (Horizontal &amp;amp; Vertical) with RobotFramework&lt;&#x2F;li&gt;
&lt;li&gt;Native iOS apps&lt;&#x2F;li&gt;
&lt;li&gt;Android and iOS device farms&lt;&#x2F;li&gt;
&lt;li&gt;RaspberryPi bitcoin mining farm with custom ASIC chips&lt;&#x2F;li&gt;
&lt;li&gt;Scaled a couple of high-traffic web applications&lt;&#x2F;li&gt;
&lt;li&gt;Deploy services on AWS, Azure, and Google Cloud (Fabric, docker, AWS copilot, Kubernetes, etc.)&lt;&#x2F;li&gt;
&lt;li&gt;Small tech teams (5–15 engineers)&lt;&#x2F;li&gt;
&lt;li&gt;Setting up E2E engineering processes for the entire organization&lt;&#x2F;li&gt;
&lt;li&gt;Can design and develop resource-efficient, reliable, maintainable, secure &amp;amp; scalable products&lt;&#x2F;li&gt;
&lt;li&gt;A bunch of open-source tools that are useful for web development.&lt;&#x2F;li&gt;
&lt;li&gt;Contributed to a bunch of 3rd party open-source projects&lt;&#x2F;li&gt;
&lt;li&gt;Reverse Engineered and &quot;hacked&quot; a bunch of mobile applications for fun&lt;&#x2F;li&gt;
&lt;li&gt;Hobby IoT &amp;amp; robotic projects (very basic stuff)&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Lately, I have developed a keen interest in Rust programming language, WebAssembly &amp;amp; Distributed software.&lt;&#x2F;p&gt;
&lt;p&gt;I would appreciate your support. Thank you in advance for any connections, advice, or opportunities you can offer.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Hi, I&#x27;m dhilipsiva</title>
          <pubDate>Mon, 19 Jun 2017 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/hi-im-dhilipsiva/</link>
          <guid>https://dhilipsiva.dev/musings/hi-im-dhilipsiva/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/hi-im-dhilipsiva/">&lt;p&gt;I have been coding for 10 years.&lt;&#x2F;p&gt;
&lt;p&gt;You can find me on GitHub as &lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;github.com&#x2F;dhilipsiva&quot;&gt;dhilipsiva&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;I live in Bangalore.&lt;&#x2F;p&gt;
&lt;p&gt;I work for Appknox&lt;&#x2F;p&gt;
&lt;p&gt;I mostly program in these languages: Python, JavaScript, Objective-C.&lt;&#x2F;p&gt;
&lt;p&gt;I am currently learning more about Machine Learning.&lt;&#x2F;p&gt;
&lt;p&gt;Nice to meet you.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Architecture at AppKnox</title>
          <pubDate>Thu, 10 Dec 2015 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/architecture-at-appknox/</link>
          <guid>https://dhilipsiva.dev/musings/architecture-at-appknox/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/architecture-at-appknox/">&lt;h3 id=&quot;what-does-appknox-do&quot;&gt;What does Appknox do?&lt;&#x2F;h3&gt;
&lt;p&gt;Appknox helps developers and enterprises to uncover and fix security loopholes in mobile applications.&lt;&#x2F;p&gt;
&lt;p&gt;Securing your app is as simple as submitting your store link &#x2F; uploading your app. We scan for security vulnerabilities and report back to you with vulnerabilities.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;primary-languages&quot;&gt;Primary Languages&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Python &amp;amp; Shell for the Back-end&lt;&#x2F;li&gt;
&lt;li&gt;CoffeeScript and LESS for Front-end&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;our-stack&quot;&gt;Our Stack&lt;&#x2F;h3&gt;
&lt;ol&gt;
&lt;li&gt;Django&lt;&#x2F;li&gt;
&lt;li&gt;Postgres (Migrated from MySQL)&lt;&#x2F;li&gt;
&lt;li&gt;RabbitMQ&lt;&#x2F;li&gt;
&lt;li&gt;Celery&lt;&#x2F;li&gt;
&lt;li&gt;Redis&lt;&#x2F;li&gt;
&lt;li&gt;Memcached&lt;&#x2F;li&gt;
&lt;li&gt;Varnish&lt;&#x2F;li&gt;
&lt;li&gt;Nginx&lt;&#x2F;li&gt;
&lt;li&gt;Ember&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;p&gt;&lt;em&gt;(The original post included an architecture diagram; it didn&#x27;t survive the archive.)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-it-works&quot;&gt;How it works?&lt;&#x2F;h3&gt;
&lt;p&gt;Our back-end architecture consists of 3 subsystems: Client, Data and Workers.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;client-subsystem&quot;&gt;Client Subsystem&lt;&#x2F;h4&gt;
&lt;p&gt;The client subsystem consists of two different load-balanced, auto-scaling App &amp;amp; Socket Servers. This is where all user-interactions takes place. We took much care not to have any blocking calls here to ensure lowest possible latency.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;App Server&lt;&#x2F;strong&gt;: Each App server is a single Compute unit loaded with Nginx and Django-gunicorn server, managed by supervisord. User requests are served here. When a user submits the url their app, we submit it to the RabbitMQ download queue and immediately let user know that the URL has been submitted. In case of uploading any app, a signed-url is fetched from server. The browser uploads data directly to the S3 with this signed-url and notifies the app server when it is done.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Socket server&lt;&#x2F;strong&gt;: Each socket server is a single compute unit loaded with Nginx and a node (socket-io) server. This server uses Redis as its adapter. And yes, of course, this is used for real-time updates.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;data-subsystem&quot;&gt;Data subsystem&lt;&#x2F;h4&gt;
&lt;p&gt;This system is used for data storage, queuing and pub&#x2F;sub. Which is also responsible for a decoupled architecture.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Database Cluster&lt;&#x2F;strong&gt;: We use Postgres. It goes without saying that it consists of a Write-Heavy master and few Read-Heavy replicas.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;RabbitMQ&lt;&#x2F;strong&gt;: A broker to our celery workers. We have different queues for different workers. Mainly download, validate, upload, analyse, report, mail and bot. The web server puts data into queue, the celery workers pick it up and run it.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Redis&lt;&#x2F;strong&gt;: This acts a adapters to socket-io servers. When ever we want to notify user an update from any of our workers, we publish it to Redis, which in turn will notify all users trough Socket.IO.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;worker-subsystem&quot;&gt;Worker Subsystem&lt;&#x2F;h4&gt;
&lt;p&gt;This is where all the heavy lifting works are done. All the workers gets tasks from RabbitMQ and Published updates to users thorough Redis.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Static Scanners&lt;&#x2F;strong&gt;: This is an auto-scaling Compute unit group. Each unit consists of 4–5 celery workers. Each celery worker scans single app at a time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Other tasks&lt;&#x2F;strong&gt;: This is an auto-scaling Compute unit group. Each unit consists of 4–5 celery workers which does various tasks like download apps from stores, generating report pdf, uploading report pdf, sending emails, etc.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;Dynamic Scanning&lt;&#x2F;strong&gt;: This is platform-specific. Each Android dynamic scanner is a On-Demand Compute instance that has android emulator (With SDKs) and a script that captures data. This emulator is shown on a canvas in the browser for user to interact. Each iOS scanner is in a managed Mac-Mini farm that has scripts and simulators supporting the iOS platform.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;reasons-for-choosing-the-stack&quot;&gt;Reasons for choosing the stack&lt;&#x2F;h3&gt;
&lt;p&gt;We chose Python because the primary libraries that we use to scan applications is in python. Also, we love python more than any other languages that we know.&lt;&#x2F;p&gt;
&lt;p&gt;We chose Django because it embraces modularity.&lt;&#x2F;p&gt;
&lt;p&gt;Ember — We think that this is the most awesome Front-end framework that is out there. Yes, the learning curve is too steep than any-other, but once you climb that steep mountain, you will absolutely love ember. It is very opinionated. So as long as you stick to its conventions, you write less to do more.&lt;&#x2F;p&gt;
&lt;p&gt;Postgres — Originally, we chose MySQL because it was de-facto. After Oracle purchased Sun Microsystems (Parent company of MySQL), MySQL became stagnant. I guess we all expected it. So we dided to use MariaDB [A fork of MySQL] maintained by community. Later, we required persistent key-value stores a bit, which is offered out of the box by Postgres. It plays really well with Python. We use UUIDs as primary keys which is a native data type in Postgres. Also, the uuis-ossp module provided functions to generate and manipulate UUIDs at the Database level, rather than creating them at application level, which was costlier. So we switched to Postgres.&lt;&#x2F;p&gt;
&lt;p&gt;And the rest are de-facto. RabbitMQ for Task Queues. Celery for Task Management. Redis for Pub&#x2F;Sub. Memcached &amp;amp; Varnish for caching.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;things-that-didn-t-go-as-expected&quot;&gt;Things that didn&#x27;t go as expected&lt;&#x2F;h3&gt;
&lt;p&gt;One of the things that didn&#x27;t go as expected is scaling sockets. We were using Django-socket.io initially. We realized that this couldn&#x27;t be scaled to multiple servers. So we wrote that as a separate node module. We used node&#x27;s socket-io library that supported Redis-adapter. Clients are connected to the node&#x27;s socket server. So we now publish to Redis from our python code. Node will just push the notifications to clients. This can be scaled independently of the app-server that acts as a JSON endpoint to the clients.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;notable-stuff-about-our-stack&quot;&gt;Notable stuff about our stack&lt;&#x2F;h3&gt;
&lt;p&gt;We love modular design. We went to modularize stuff so far that we de-coupled our front-end from our back-end. Yes, you read it right. All the HTML, CoffeeScript and LESS code is developed independently of the back-end. Front-end development does not require server to be running. We rely on front-end fixtures for fake data during development.&lt;&#x2F;p&gt;
&lt;p&gt;Our back-end is named Sherlock. We detect security vulnerabilities in mobile applications. So the name seemed apt. Sherlock is smart.&lt;&#x2F;p&gt;
&lt;p&gt;And our Front-end is named Irene. Remember Irene Adler? She is beautiful, colorful and tells our user&#x27;s whats wrong.&lt;&#x2F;p&gt;
&lt;p&gt;And our Admin is named Hudson. Remember Mrs.Hudson? Sherlock&#x27;s land-lady? Thinking of which we should have probably given a role to poor Dr.Watson. Maybe we will.&lt;&#x2F;p&gt;
&lt;p&gt;So Sherlock does not serve any HTML&#x2F;CSS&#x2F;JS files. I repeat, It does not serve ANY single static file &#x2F; HTML file. Both sherlock and Irene are developed independently. Both have separate deployment process. Both have their own test-cases. We deploy sherlock to Compute instances and we deploy Irene to Google Cloud Storage.&lt;&#x2F;p&gt;
&lt;p&gt;The advantage of such architecture is that:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;The Front End team can work independent of the back-end without stepping on each other toes.&lt;&#x2F;li&gt;
&lt;li&gt;The heavy lifting work like rendering pages on the server is taken off of server.&lt;&#x2F;li&gt;
&lt;li&gt;We can open-source the front-end code. Making it easy to hire front-end guys. Just ask them to fix a bug in the repo and they are hired. After all, front-end code can be read by anyone even if you don&#x27;t open-source it right?&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;h3 id=&quot;our-deployment-process&quot;&gt;Our deployment process&lt;&#x2F;h3&gt;
&lt;p&gt;The code is auto-deployed from the master branch. We follow &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;nvie.com&#x2F;posts&#x2F;a-successful-git-branching-model&#x2F;&quot;&gt;Vincent Driessen&lt;&#x2F;a&gt;&#x27;s Git branching model. Jenkins build commits to develop branch. If it succeeds we do another manual testing, just to be sure and merge it with master branch and it gets auto deployed.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Appropriate Number of Gunicorn Workers</title>
          <pubDate>Thu, 22 Oct 2015 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/gunicorn-workers/</link>
          <guid>https://dhilipsiva.dev/musings/gunicorn-workers/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/gunicorn-workers/">&lt;p&gt;To quote &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;docs.gunicorn.org&#x2F;en&#x2F;19.3&#x2F;design.html#how-many-workers&quot;&gt;Gunicorn documentation&lt;&#x2F;a&gt;:&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Generally we recommend (2 x $num_cores) + 1 as the number of workers to start off with. While not overly scientific, the formula is based on the assumption that for a given core, one worker will be reading or writing from the socket while the other worker is processing a request. Obviously, your particular hardware and application are going to affect the optimal number of workers. Our recommendation is to start with the above guess and tune using TTIN and TTOU signals while the application is under load.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;Gunicorn docs suggests that 2n+1 (&lt;code&gt;gunicorn -w &amp;lt;2n+1&amp;gt; myapp:wsgi&lt;&#x2F;code&gt;) is a good guess for number of workers (Yes, n = number of cores). I came up with a tiny shell script to apply this formula. All you need to do is this:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;gunicorn -w $(( 2 * `cat &#x2F;proc&#x2F;cpuinfo | grep &amp;#39;core id&amp;#39; | wc -l` + 1 )) myapp:wsgi
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Where the command&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;cat &#x2F;proc&#x2F;cpuinfo | grep &amp;#39;core id&amp;#39; | wc -l
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;will return the total number of actual CPU cores (n). So,&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;bash&quot;&gt;$(( 2 * `cat &#x2F;proc&#x2F;cpuinfo | grep &amp;#39;core id&amp;#39; | wc -l` + 1 ))
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;equates to 2n+1 formula.&lt;&#x2F;p&gt;
&lt;p&gt;This will apply 2n+1 formula to all the linux-based machines.&lt;&#x2F;p&gt;
&lt;p&gt;You can also achieve this with &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;docs.gunicorn.org&#x2F;en&#x2F;19.3&#x2F;configure.html#configuration-file&quot;&gt;Gunicorn Configuration File&lt;&#x2F;a&gt; gunicorn.conf.py as follows:&lt;&#x2F;p&gt;
&lt;pre&gt;&lt;code data-lang=&quot;python&quot;&gt;import multiprocessing

bind = &amp;quot;127.0.0.1:8000&amp;quot;
workers = multiprocessing.cpu_count() * 2 + 1
&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;This was an &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;15979428&#x2F;what-is-the-appropriate-number-of-gunicorn-workers-for-each-amazon-instance-type&#x2F;27664071#27664071&quot;&gt;answer that I posted on StackOverflow&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
</description>
      </item>
      <item>
          <title>Python Libraries — Django, Twisted, Tornado, Flask, Cyclone and Pyramid</title>
          <pubDate>Sun, 19 May 2013 00:00:00 +0000</pubDate>
          <author>Unknown</author>
          <link>https://dhilipsiva.dev/musings/python-libraries/</link>
          <guid>https://dhilipsiva.dev/musings/python-libraries/</guid>
          <description xml:base="https://dhilipsiva.dev/musings/python-libraries/">&lt;p&gt;&lt;em&gt;&quot;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;www.djangoproject.com&#x2F;&quot;&gt;&lt;strong&gt;Django&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; is a high-level Python Web framework that encourages rapid development and clean, pragmatic design&quot;&lt;&#x2F;em&gt;. If you are building something that is similar to a e-commerce site, then you should probably go with &lt;code&gt;Django&lt;&#x2F;code&gt;. It will get your work done quick. You don&#x27;t have to worry about too many technology choices. It provides everything thing you need from template engine to &lt;code&gt;ORM&lt;&#x2F;code&gt;. It will be slightly opinionated about the way you structure your app, which is good If you ask me. And it has the strongest community of all the other libraries, which means easy help is available.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&quot;&lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;flask.pocoo.org&#x2F;&quot;&gt;&lt;strong&gt;Flask&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; is a microframework for Python based on Werkzeug, Jinja 2 and good intentions&quot;&lt;&#x2F;em&gt;. Beware - &quot;microframework&quot; may be misleading. This does not mean that &lt;code&gt;Flask&lt;&#x2F;code&gt; is a half-baked library. This mean the core of &lt;code&gt;Flask&lt;&#x2F;code&gt; is very, very simple. Unlike &lt;code&gt;Django&lt;&#x2F;code&gt;, It will not make any Technology decisions for you. You are free to choose any template engine or &lt;code&gt;ORM&lt;&#x2F;code&gt; that pleases you. Even though it comes with &lt;code&gt;Jinja&lt;&#x2F;code&gt; template engine by default, you are always free to choose our own. As far as I know &lt;code&gt;Flask&lt;&#x2F;code&gt; comes in handy for writing APIs endpoints (&lt;code&gt;RESTful rervices&lt;&#x2F;code&gt;).&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&quot;&lt;a rel=&quot;external&quot; href=&quot;https:&#x2F;&#x2F;twistedmatrix.com&#x2F;trac&#x2F;&quot;&gt;&lt;strong&gt;Twisted&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; is an event-driven networking engine written in python&quot;&lt;&#x2F;em&gt;. This is a high-performance engine. The main reason for its speed is something called as deferred. &lt;code&gt;Twisted&lt;&#x2F;code&gt; is built on top of &lt;code&gt;deferred&lt;&#x2F;code&gt;. For those of you who don&#x27;t know about deferred, it is the mechanism through with asynchronous architecture is achieved. &lt;code&gt;Twisted&lt;&#x2F;code&gt; is very fast. But is not suitable for writing conventional WebApps. If you want to do something low-level networking stuff, &lt;code&gt;Twisted&lt;&#x2F;code&gt; is your friend.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&quot;&lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;www.tornadoweb.org&#x2F;en&#x2F;stable&#x2F;&quot;&gt;&lt;strong&gt;Tornado&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; is a Python web framework and asynchronous networking library, originally developed at &lt;code&gt;FriendFeed&lt;&#x2F;code&gt;. By using non-blocking network I&#x2F;O, &lt;code&gt;Tornado&lt;&#x2F;code&gt; can scale to tens of thousands of open connections, making it ideal for long polling, &lt;code&gt;WebSockets&lt;&#x2F;code&gt;, and other applications that require a long-lived connection to each user&quot;&lt;&#x2F;em&gt;. &lt;code&gt;Tornado&lt;&#x2F;code&gt; stands some where between &lt;code&gt;Django&lt;&#x2F;code&gt; and &lt;code&gt;Flask&lt;&#x2F;code&gt;. If you want to write something with &lt;code&gt;Django&lt;&#x2F;code&gt; or &lt;code&gt;Flask&lt;&#x2F;code&gt;, but if you need a better performance, you can opt for &lt;code&gt;Tornado&lt;&#x2F;code&gt;. It can handle C10k problem very well if it is architected right.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&quot;&lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;cyclone.io&#x2F;&quot;&gt;&lt;strong&gt;Cyclone&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; is a web server framework for Python that implements the &lt;code&gt;Tornado&lt;&#x2F;code&gt; API as a Twisted protocol&quot;&lt;&#x2F;em&gt;. Now, what if you want something with &lt;code&gt;Twisted&lt;&#x2F;code&gt;&#x27;s performance and easy to write conventional webapps? Say hello to &lt;code&gt;Cyclone&lt;&#x2F;code&gt;. I would prefer &lt;code&gt;Cyclone&lt;&#x2F;code&gt; over &lt;code&gt;Tornado&lt;&#x2F;code&gt;. It has an API that is very similar to &lt;code&gt;Tornado&lt;&#x2F;code&gt;. As a matter of fact, this is a fork of &lt;code&gt;Tornado&lt;&#x2F;code&gt;. But the problem is it has relatively small community. Alexandre Fiori is the only main commiter to the repo.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;&quot;&lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;docs.pylonsproject.org&#x2F;en&#x2F;latest&#x2F;docs&#x2F;pyramid.html&quot;&gt;&lt;strong&gt;Pyramid&lt;&#x2F;strong&gt;&lt;&#x2F;a&gt; is a general, open source, Python web application development framework. Its primary goal is to make it easier for a Python developer to create web applications&quot;&lt;&#x2F;em&gt;. I haven&#x27;t really used &lt;code&gt;Pyramid&lt;&#x2F;code&gt;, but I went through the documentation. From what I understand, &lt;code&gt;Pyramid&lt;&#x2F;code&gt; is very similar to &lt;code&gt;Flask&lt;&#x2F;code&gt; and I think you can use &lt;code&gt;Pyramid&lt;&#x2F;code&gt; wherever &lt;code&gt;Flask&lt;&#x2F;code&gt; seems appropriate and vice-versa.&lt;&#x2F;p&gt;
&lt;p&gt;Want me to review any other library? Please leave a comment below.&lt;&#x2F;p&gt;
&lt;p&gt;Comments &#x2F; Suggestions &#x2F; Edits welcomed.&lt;&#x2F;p&gt;
&lt;p&gt;I answered a question on StackOverflow &lt;a rel=&quot;external&quot; href=&quot;http:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;13941903&#x2F;when-to-use-tornado-when-to-use-twisted-cyclone-gevent-other&#x2F;16630916#16630916&quot;&gt;here&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
</description>
      </item>
    </channel>
</rss>
