<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://atul-atul.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://atul-atul.github.io/" rel="alternate" type="text/html" /><updated>2026-09-25T08:12:25+05:30</updated><id>https://atul-atul.github.io/feed.xml</id><title type="html">Atul</title><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><entry><title type="html">LSM Trees, SSTables and MemTables</title><link href="https://atul-atul.github.io/LSM-SSTables-MemTables/" rel="alternate" type="text/html" title="LSM Trees, SSTables and MemTables" /><published>2026-09-08T00:00:00+05:30</published><updated>2026-09-08T05:30:01+05:30</updated><id>https://atul-atul.github.io/LSM-SSTables-MemTables</id><content type="html" xml:base="https://atul-atul.github.io/LSM-SSTables-MemTables/"><![CDATA[<p>We will discuss LSM Trees.
But first a few basic components:</p>

<p><img src="/images/writing_to_a_bigtable.png" alt="Writing To A LSM Tree" title="Writing To A LSM Tree" /></p>

<h2 id="redo-log-write-ahead-log-commit-log">Redo-Log/ Write-Ahead-Log/ Commit-Log</h2>
<p>Any data/ command operation coming into our system is first persisted in a durable way. We write that data into an append only log file (and its backup(s) via a background thread/kernel copy because, after all, the hard-disk itself can crash). This is generally known as write-ahead-log, redo-log, commit-log, etc. This generally serves as the entry point (apart from cross cutting concerns like rate-limiting, access-control, etc.). This is where data first enters into our system. If any subsequent processing goes wrong we have a single point from where we can restart.</p>

<h2 id="memtable">Memtable</h2>
<p>Google’s BigTable paper coined this term. It is a structure (for example, a red-black tree- TODO revisit trees and balancing) that holds data in memory in a sorted order of keys. After it grows to some pre-set limit, it is flushed from memory into a more durable SSTable file. Memtable data will be lost in case of a crash and we may need to begin again with the re-do log. Why hold it in memory then? For faster access, of course, as in case of <a href="/reading-googles-bigtable-paper/">BigTable</a>. Also, by holding the data in memory, and flushing it into file after it reaches some size we write bulk data at once into a file. And thus avoid OpenFileHandle, AppendToFile, CloseFile, Cleanup, etc. cycle for each data record.</p>

<h2 id="sstable">SSTable</h2>
<p>An SSTable (Sorted String Table) is an immutable, ordered data file on disk. It’s sorted based on key. It’s generally formed after a MemTable is flushed from memory to the file system. We can also get a new SSTable file when merging (and compacting) existing SSTables. Of course flushing MemTable is simple as the MemTable is also sorted. And when merging two SSTables, it is a simple merge operation like that in merge sort. SSTables may be compacted (thus reclaiming the space) if we (and this is not necessarily always the case) decide that we don’t need old data for a key- for example, in an update operation.</p>

<h2 id="lsm-tree">LSM tree</h2>
<p>A Log-Structured-Merge-tree uses the above components.
For example, at level 0 in the diagram below (image from wikipedia), there are MemTables. At level 1 SSTables, at level 2 merged and compacted SSTables, etc.</p>

<p><img src="/images/LSM_Tree.png" alt="LSM Tree" title="LSM Tree" /></p>

<h2 id="system-performance">System Performance</h2>
<p>Performs well when writing data into the system. No random I/O, writes are appends, sequential and efficient. Also, MemTable flush writes into SSTables are also efficient.</p>

<p>While reading, the data is first searched in MemTable based on key; if not found there it is searched in the newest SSTable file, then a SSTable older than that, etc. Of course, in the worst case (data not found in the system) reading may not be a very efficient operation. (TODO read/ write about bloom filters, etc.). Also, if the rate of incoming data is far more than the rate at which SSTables are merged and compacted, space utilization can suffer.</p>

<p>LSM-trees are better suited for write-heavy applications.</p>

<p>They can suffer from Write-Amplification: a value is first written to the log for durability, then again when the MemTable is written to disk, and again every time the key-value pair is part of a compaction. But if the values are significantly larger than the keys, this overhead can be reduced by storing values separately from keys and performing compaction only on SSTables containing keys and references to values.</p>

<p>Are LSM trees good for range queries? If the query is based on the key.</p>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><category term="Distributed-Systems" /><category term="Tech" /><summary type="html"><![CDATA[We will discuss LSM Trees. But first a few basic components:]]></summary></entry><entry><title type="html">Consistent Hashing</title><link href="https://atul-atul.github.io/Consistent-Hashing/" rel="alternate" type="text/html" title="Consistent Hashing" /><published>2026-08-25T00:00:00+05:30</published><updated>2026-09-08T05:30:01+05:30</updated><id>https://atul-atul.github.io/Consistent-Hashing</id><content type="html" xml:base="https://atul-atul.github.io/Consistent-Hashing/"><![CDATA[<p><a href="https://en.wikipedia.org/wiki/Consistent_hashing">Consistent hashing</a> is a hashing technique used in distributed systems. It is also a somewhat optimized re-hashing/ remapping technique. While the idea is old (in CS timelines), I think it became popular after the Akamai article and the dynamo paper.</p>

<h2 id="what">What</h2>
<p>Consistent hashing distributes keys evenly across a few servers (shards, nodes, etc.). The data could be the data in a partitioned DBMS**, distributed cache or requests in a distributed system, etc. And when those items need to be remapped (because say a shard becomes full, goes down, gets added), the technique reduces the number of items which need to be remapped and redistributed, and avoids the remapping/ re-hashing of the whole data.</p>

<h2 id="how">How</h2>
<p>For ease of understanding the servers/ partitions are considered to be on a ring. The data key is hashed. The hash value may fall within a range of values (in simplest way, the hash-value % number of servers) and is allocated to the clockwise next server on the ring.</p>

<p>This is very similar to slot/ bucket allocation in traditional hashing. When a server gets added (due to a higher load) or goes down, in traditional techniques the whole data will be rehashed and remapped again.</p>

<p>Consistent hashing avoids this by hashing not just requests (data) but servers (generally, IPs or UUIDs of servers) as well. When servers are placed on the ring, or later when a new server is added on the ring, it’s done in a deterministic manner with the use of a hash function. The server hash function need not be same hash function as used in hashing data keys. It could be much simpler as number of servers « number of data items. But like all hash functions the function has to be deterministic- if you pass same value multiple times to the function, it should map to the same output hash. A server with smaller hash value is placed before- on the hash ring going clockwise- another server with bigger hash value. It is easy to visualize a ring and going clockwise, but generally BST is used in practice. Think about it, what is needed is basically an ability to tell which server is to be placed before another server and later easily finding a server to allocate the data to and later if a new server gets added finding the right spot for it. Thus a binary search tree works well with O(log(n)) complexity.</p>

<p><img src="/images/Hashring.png" alt="Hashring" title="Hashring" /></p>

<h2 id="an-example">An Example</h2>
<p>For ease of understanding let’s say that your system is a distributed cache. You are caching biography webpages of Greek mythological characters. And you chose a hash function such that the hashes turn out to be the characters’ Greek names. The above image shows the current in progress state of your system. ServerA contains cached pages of characters A thr’ E; ServerF from F to J, etc. Now if you know a bit of Greek mythology, you would naturally see that ServerA is already bleeding- there’s a lot of bad blood between the characters. How would it accommodate Athena, Aphrodite, Apollo? Ideally, you should question your hash function if it lets you add Apollo and Achilles in the same bucket. But just to take it easy for now, you decide to add a new server say ServerC and let the mythological characters take their own fateful course. You may consider yourself a duct tape programmer but I am telling you, you should be a statesman. Now if you add any new page of a character whose name begins with A or B, it goes to ServerA. C, D, E go to ServerC. But what about existing pages cached in ServerA like Cassandra, Clytemnestra? When ServerC gets added you could aggressively move these from ServerA to ServerC. That way when you look up a page for Cassandra, you could directly go to ServerC. Alternatively, you could let the irrelevant pages in ServerA be evicted; and when a request for Cassandra lookup comes in you take a cache-miss and fetch the page from main server and this time you cache it on ServerC. Depends on trade-offs you choose. Important point is that you had to re-arrange/ remap only the data that was hosted on the ServerA. The rest of the data on other servers did not have to move. A somewhat similar arrangement takes place when a server goes out. Suppose ServerF from above image crashes, data from which server will move to which server?</p>

<h2 id="no-silver-bullet">No Silver Bullet</h2>
<p>Consistent hashing has some limitations like celebrity effect (hotkey) where a few keys receive massive traffic (for example, the page for Zeus and respective server in the Greek Mythology example above may receive disproportionately- well, maybe proportionately because he’s quite a character- high traffic). Also one server crashing can send a wave of cascading failure down the ring. And, physical limitations like <a href="https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing">Fallacies of distributed computing</a> play a part.</p>

<h2 id="improvements">Improvements</h2>
<p>There are some improvements over this basic idea. First of all a better hash function which distributes data evenly is far better than anything else. But you could also add a level of indirection and have virtual nodes. And there are trade-offs dictated by usage pattern, etc. For example, you could replicate data and use quorum (<a href="/learnings-from-dynamo-paper/">Amazon’s Dynamo paper</a> mentioned sloppy quorum based on their service requirements).</p>

<hr />
<p>** DDIA book first edition says about consistent hashing in data partitioning chapter: <em>this particular approach actually doesn’t work very well for databases, so it is rarely used in practice (the documentation of some databases still refers to consistent hashing, but it is often inaccurate)…</em></p>

<p>I haven’t yet read the second edition which came out recently, but the author has updated the the description. Here’s what it says now: <em>The sharding algorithm used by Cassandra and ScyllaDB is similar to the original definition of consistent hashing, but several other consistent hashing algorithms have also been proposed, such as highest random weight, also known as rendezvous hashing, and jump consistent hashing. With these approaches, rather than a small number of existing shards being split into subranges to create new shards for a node that is added, the new node is instead assigned individual keys that were previously scattered across all the other nodes. Which is preferable depends on the application.</em></p>

<p>So I think we are good.</p>

<hr />
<p>My Greek mythology knowledge is quite limited. I have read a book or two before. Recently listened to Stephen Fry’s audiobooks Mythos and Troy again. I will recommend those. Somehow I did not like Madeline Miller’s Song Of Achilles in the past even though it’s quite popular. Now started Stephen Fry’s audiobook Odyssey. He’s talked about the Greek mythology a number of times on youtube and I recently watched his appearance on Anita Anand and William Dalrymple’s Empire podcast. But if you are ok with a bit of off-colored humor (and why shouldn’t you be) here’s <a href="https://www.youtube.com/watch?v=zx5RNDrKLls">a joke he told</a> on QI.</p>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><category term="Distributed-Systems" /><category term="Tech" /><summary type="html"><![CDATA[Consistent hashing is a hashing technique used in distributed systems. It is also a somewhat optimized re-hashing/ remapping technique. While the idea is old (in CS timelines), I think it became popular after the Akamai article and the dynamo paper.]]></summary></entry><entry><title type="html">Notes Triggered by Protests</title><link href="https://atul-atul.github.io/Notes-Triggered-by-Protests/" rel="alternate" type="text/html" title="Notes Triggered by Protests" /><published>2026-07-26T00:00:00+05:30</published><updated>2026-07-26T05:30:01+05:30</updated><id>https://atul-atul.github.io/Notes-Triggered-by-Protests</id><content type="html" xml:base="https://atul-atul.github.io/Notes-Triggered-by-Protests/"><![CDATA[<p>While I won’t like to read too much into the effects of <a href="https://en.wikipedia.org/wiki/2026_Delhi_Jantar_Mantar_protests">recent protests in India</a> here are some observations, thoughts, quotes, etc. While the trigger for this post was the recent protests, notes here are more than just about recent protests. But maybe having a concrete example in mind while discussing theory helps. The goal is to understand and make sense of things rather than sensational political statements, opinions, etc. Separating it out here rather than <a href="/Short-Takes-3/#india-will-go-on">a related short take</a> because it seemed to get quite lengthy. Also, somewhere in the background must be the idea that we are <a href="https://www.youtube.com/watch?v=4E3xfR6IBII">not just code monkeys</a>. I haven’t watched that talk in last 4-5 years, so its reference here is just based on memory. Maybe I will watch it again soon. Lastly, as I mentioned in the previous <a href="/Thinking-In-Systems/">post on the book Thinking in Systems</a>, to some extent the book helped me reason about a system (protest dynamics) that I was not familiar with.</p>

<ol>
  <li>While I cannot picture myself chanting the slogans and carrying the placards which the GenZ protesters did, there is no denying that they looked comfortable in their skin even if they appeared unhinged at times. A lady student said: ‘This govt is worse at communicating than my ex!’ How do you react to a statement like that? As someone said, there’s no filter for this instagram generation. These people were serious (maybe sincere is a better word) and yet unserious the whole time. Their language and ways of expression are not mine. But they made me chuckle, laugh, and think, as well. And they are alright. But looking beyond that, many of them were very articulate. From few second bites to 5 minute or longer rants.</li>
  <li>The leaders (students’ bodies) were also articulate. But some terminologies and toolkits may need to evolve. I don’t think anybody beyond their respective groups cares for left wing words like ‘comrades’, ‘laal salaam’ or right wing abuses like ‘liberaandus’.</li>
  <li>This was not the first time such protests happened. It won’t be the last. Why do we see history repeating? Why do similar patterns recur? As I said in <a href="/Short-Takes-3/#india-will-go-on">a previous note</a> I would like to know more. But even with my limited understanding I can see some similarities. For example, I came across the term ‘ivory towers’ first in relation to the French revolution. And it’s applicable elsewhere, as well. You see ‘haves-vs-have-nots’, ‘power corrupts; absolute power corrupts absolutely’, ‘the state having monopoly on violence’, ‘systemic problems’, ‘brutal use of force’, ‘oppressed masses’, ‘social divide’, ‘pent-up anger’, ‘rage’, ‘damage control’, ‘empire strikes back’, ‘ego clashes’, etc. Of course, some of these maybe innate patterns of human behavior, social structure, groups. Yet it’s painful to see these patterns repeating. Why can’t we avoid some of them? For example, why can’t we keep egos aside and avoid coercive use of force?</li>
  <li>Some things are fickle. Well cultivated image of a leader, popularity, victory against govt, etc. are continuously challenged by system dynamics and <a href="/Short-Takes-1/#entropy">entropy</a>. Some ideas are <a href="/Short-Takes-3/#imagined-order">imagined orders</a> and may crumble with domino effect. People can become aware of other imagined orders and create new ones which suit them.</li>
  <li>‘We do not fear those whom we despise.’ This’s what Jeeves told Gussie who was then afraid of Spode. Later Gussie asks Bertie, ‘Have you ever seen Spode eat asparagus?’ ‘No.’ ‘Revolting. It alters one’s whole conception of Man as Nature’s last word.’ Cartoonists, comedians make fun of leaders all the time but widespread ridicule generalizes/ normalizes/ rationalizes that. For example, a small number of people start ridiculing a particular leader as dim witted (Pappu), this perception soon becomes widespread, a lot of people start thinking it’s ok to call the leader a village idiot, and then start believing that the person is an idiot of the first order. And most of this is more or less independent of whether the person is an idiot or not. In either case damage control then becomes progressively difficult. (In some scenarios as a Hindi proverb goes ‘Jo haud se gayi, woh boond se nahi aati’. Let’s say, I coined the proverb.) One of the reasons the govt compromised in recent protests was that it was caught at the uncomfortable side (let’s call it the Pappu end) of ridicule.</li>
  <li>I am sure that these protests won’t bring about any major systemic changes. Naipaul’s Wounded Civilization would prevent me from wearing such rosy glasses of high expectations. But some changes will take place.</li>
  <li>After French/ Russian revolutions the oppressed had become oppressors (from my very superficial reading about those topics).</li>
  <li>You must be the change you wish to see in the world.- Gandhi is great, isn’t he?</li>
  <li>A mob’s always made up of people, no matter what. Harper Lee in To Kill A Mockingbird.</li>
  <li>Cry about the simple hell people give other people– without even thinking. Cry about the hell white people give coloured folks, without even stopping to think that they’re people, too. Harper Lee in To Kill A Mockingbird.</li>
  <li>Atticus told me to delete the adjectives and I’d have the facts. Harper Lee in To Kill A Mockingbird.</li>
  <li>I wanted you to see what real courage is, instead of getting the idea that courage is a man with a gun in his hand. It’s when you know you’re licked before you begin but you begin anyway and you see it through no matter what. You rarely win, but sometimes you do. Harper Lee in To Kill A Mockingbird.</li>
  <li>Scholars know of no large society that has been able to dispense with discrimination altogether. Yuval Noah Harari in Sapiens</li>
  <li>Of all human collective activities, the one most difficult to organise is violence. Yuval Noah Harari in Sapiens</li>
  <li>Every culture has its typical beliefs, norms and values, but these are in constant flux. The culture may transform itself in response to changes in its environment or through interaction with neighbouring cultures. But cultures also undergo transitions due to their own internal dynamics. Even a completely isolated culture existing in an ecologically stable environment cannot avoid change. Unlike the laws of physics, which are free of inconsistencies, every man-made order is packed with internal contradictions. Cultures are constantly trying to reconcile these contradictions, and this process fuels change. Yuval Noah Harari in Sapiens</li>
  <li>The better you know a particular historical period, the harder it becomes to explain why things happened one way and not another. Yuval Noah Harari in Sapiens</li>
  <li>Revolutions are, by definition, unpredictable. A predictable revolution never erupts. Yuval Noah Harari in Sapiens</li>
  <li>Once you start to see the events of the day as parts of trends, and those trends as symptoms of underlying system structure, you will be able to consider new ways to manage and new ways to live in a world of complex systems. Donella Meadows in Thinking in Systems</li>
  <li>Once we see the relationship between structure and behavior, we can begin to understand how systems work, what makes them produce poor results, and how to shift them into better behavior patterns. Donella Meadows in Thinking in Systems</li>
  <li>The best way to deduce the system’s purpose is to watch for a while to see how the system behaves… Purposes are deduced from behavior, not from rhetoric or stated goals. Donella Meadows in Thinking in Systems</li>
  <li>Shifting dominance of feedback loops… Dominance is an important concept in systems thinking. When one loop dominates another, it has a stronger impact on behavior. Because systems often have several competing feedback loops operating simultaneously, those loops that dominate the system will determine the behavior. Donella Meadows in Thinking in Systems</li>
  <li>Large organizations of all kinds, from corporations to governments, lose their resilience simply because the feedback mechanisms by which they sense and respond to their environment have to travel through too many layers of delay and distortion. Donella Meadows in Thinking in Systems</li>
  <li>You can’t navigate well in an interconnected, feedback-dominated world unless you take your eyes off short-term events and look for long-term behavior and structure; unless you are aware of false boundaries and <a href="/Short-Takes-3/#bounded-rationality">bounded rationality</a>; unless you take into account <a href="/Short-Takes-3/#law-of-the-minimum">limiting factors</a>, nonlinearities and delays. You are likely to mistreat, misdesign, or misread systems if you don’t respect their properties of resilience, self-organization, and hierarchy. Donella Meadows in Thinking in Systems</li>
  <li>It’s endlessly engrossing to take in the world as a series of events, and constantly surprising, because that way of seeing the world has almost no predictive or explanatory value. Like the tip of an iceberg rising above the water, events are the most visible aspect of a larger complex- but not always the most important. Donella Meadows in Thinking in Systems</li>
  <li>If the news did a better job of putting events into historical context, we would have better behavior-level understanding, which is deeper than event-level understanding. When a systems thinker encounters a problem, the first thing he or she does is look for data, time graphs, the history of the system. That’s because long-term behavior provides clues to the underlying system structure. And structure is the key to understanding not just what is happening, but why. Donella Meadows in Thinking in Systems</li>
  <li>Everything, as they say, is connected to everything else, and not neatly… The greatest complexities arise exactly at boundaries. There is no single, legitimate boundary to draw around a system. We have to invent boundaries for clarity and sanity <em>(for example, in the case of recent protests, students’ organizations separated by a boundary from the government)</em>; and boundaries can produce problems when we forget that we’ve artificially created them. Ideally, we would have the mental flexibility to find the appropriate boundary for thinking about each new problem. We are rarely that flexible. We get attached to the boundaries our minds happen to be accustomed to. Donella Meadows in Thinking in Systems</li>
  <li>Understanding archetypal problem-generating structures is not enough. Putting up with them is impossible. They need to be changed. The destruction they cause is often blamed on particular actors or events, although it is actually a consequence of system structure… Policy resistance comes from the bounded rationalities of the actors in a system, each with his or her (or “its” in the case of an institution) own goals… One way to deal with policy resistance is to try to overpower it. If you wield enough power and can keep wielding it, the power approach can work, at the cost of monumental resentment and the possibility of explosive consequences if the power is ever let up… The most effective way of dealing with policy resistance is to find a way of aligning the various goals of the subsystems, usually by providing an overarching goal that allows all actors to break out of their bounded rationality. Donella Meadows in Thinking in Systems</li>
  <li>Some systems not only resist policy and stay in a normal bad state, they keep getting worse… There are two antidotes to eroding goals. One is to keep standards absolute, regardless of performance. Another is to make goals sensitive to the best performances of the past, instead of the worst. Donella Meadows in Thinking in Systems</li>
  <li>Escalation comes from a reinforcing loop set up by competing actors trying to get ahead of each other… Escalation, being a reinforcing feedback loop, builds exponentially. Therefore, it can carry a competition to extremes faster than anyone would believe possible. If nothing is done to break the loop, the process usually ends with one or both of the competitors breaking down… The best way out of this trap is to avoid getting in it. If caught in an escalating system, one can refuse to compete (unilaterally disarm), thereby interrupting the reinforcing loop. Or one can negotiate a new system with balancing loops to control the escalation. Donella Meadows in Thinking in Systems</li>
  <li>Not everyone recognizes that addiction can appear in larger systems and in other guises- such as the dependence of industry on government subsidy, the reliance of farmers on fertilizers… The trouble is that the states created by interventions don’t last. The intoxication wears off. The subsidy is spent… the intervention can become a system trap. Donella Meadows in Thinking in Systems. (Other points above are quite simple to relate to many protests. But if this last one was a little difficult to relate to then think about addiction to the intervention by courts, parliament, elections.)</li>
</ol>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><category term="Thoughts" /><category term="Concepts" /><summary type="html"><![CDATA[While I won’t like to read too much into the effects of recent protests in India here are some observations, thoughts, quotes, etc. While the trigger for this post was the recent protests, notes here are more than just about recent protests. But maybe having a concrete example in mind while discussing theory helps. The goal is to understand and make sense of things rather than sensational political statements, opinions, etc. Separating it out here rather than a related short take because it seemed to get quite lengthy. Also, somewhere in the background must be the idea that we are not just code monkeys. I haven’t watched that talk in last 4-5 years, so its reference here is just based on memory. Maybe I will watch it again soon. Lastly, as I mentioned in the previous post on the book Thinking in Systems, to some extent the book helped me reason about a system (protest dynamics) that I was not familiar with.]]></summary></entry><entry><title type="html">Thinking In Systems</title><link href="https://atul-atul.github.io/Thinking-In-Systems/" rel="alternate" type="text/html" title="Thinking In Systems" /><published>2026-05-07T00:00:00+05:30</published><updated>2026-05-07T05:30:01+05:30</updated><id>https://atul-atul.github.io/Thinking-In-Systems</id><content type="html" xml:base="https://atul-atul.github.io/Thinking-In-Systems/"><![CDATA[<p>After writing a short take about <a href="/Short-Takes-2/#system-dynamics">system dynamics</a> I recently picked up the book <a href="https://en.wikipedia.org/wiki/Thinking_In_Systems:_A_Primer">Thinking In Systems</a> again. And this time I finished it.</p>

<p>The book talks about systems, flows, stock, balancing and reinforcing feedback loops, traps, leverages, etc.</p>

<p>I won’t add my notes/ highlights here. Instead, you can take a look at the very good <a href="https://www.youtube.com/playlist?list=PLL6RiAl2WHXEU04zFYyWrUGV_fqGG4TuR&amp;ref=atul-atul.github.io/Thinking-In-Systems/">chapter wise summary of the book</a>. A note: The chapter 5 video talks about <em>inventor</em>. That should be <em>intervenor</em>.</p>

<p>The book is written in a simple style. Mentions concepts, terminologies, ideas, etc. Not too technical. And that makes it somewhat easier to read. To the author’s credit, she has deliberately made it even simpler. If you watch some videos on youtube related to the topic, you can see that the simplicity of the book must have been a choice.</p>

<p>There are systems everywhere. And if you pay attention, you can see those systems. From the solar system to your body to the world economy. Almost all are dynamic. If you are familiar with a system under consideration (say your work area, your body, your city, etc.) then it is likely that you know what factors come into play. I think the book will help you reason about a system you are not very familiar with. It, of course, does not make you an expert but it gives you terminology, ideas, etc. to know about and deal with a system.</p>

<p>While reading the book you can immediately relate some ideas to your familiar systems and they are likely to make sense. For example, the author says- ‘it’s easier to learn about a system’s elements than about its interconnections’. It immediately reminded me of Michael Nygard’s observation in Release It: ‘Every architecture diagram ever drawn has boxes and arrows… A new architect will focus on the boxes; an experienced one is more interested in the arrows.’</p>

<p>Then there are other ideas which may take some time to make sense: ‘Structure determines what behaviors are latent in the system.’ Or ‘Systems fool us by presenting themselves- or we fool ourselves by seeing the world- as a series of events… We are less likely to be surprised if we can see how events accumulate into dynamic patterns of behavior… If the news did a better job of putting events into historical context, we would have better behavior-level understanding, which is deeper than event-level understanding. When a systems thinker encounters a problem, the first thing he or she does is look for data, time graphs, the history of the system. That’s because long-term behavior provides clues to the underlying system structure. And structure is the key to understanding not just what is happening, but why.’ Now these sentences may make more sense when we know that ‘the structure of a system is its interlocking stocks, flows, and feedback loops’. Then for example, we can make sense of why every year mango sellers tell you ‘mangoes are in short supply this year’ or why there have been multiple conflicts between say India and Pak or Iran and the US. (While we are on the topic of conflicts between nations here’s a book recommendation: Prisoners Of Geography by Tim Marshall.)</p>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><category term="Reading" /><category term="Tech" /><summary type="html"><![CDATA[After writing a short take about system dynamics I recently picked up the book Thinking In Systems again. And this time I finished it.]]></summary></entry><entry><title type="html">Short Takes 3</title><link href="https://atul-atul.github.io/Short-Takes-3/" rel="alternate" type="text/html" title="Short Takes 3" /><published>2026-04-23T00:00:00+05:30</published><updated>2026-07-26T05:30:01+05:30</updated><id>https://atul-atul.github.io/Short-Takes-3</id><content type="html" xml:base="https://atul-atul.github.io/Short-Takes-3/"><![CDATA[<p>In the <a href="/tags/#short-takes">short-takes</a> posts I write about some concepts, phrases, models, ideas, whatever related to my work and life. As these are likely to be known to many, the idea is to just document these together, rather than go into details of these. Will keep updating.</p>

<ol>
  <li>
    <h2 id="law-of-the-minimum">Law of the minimum</h2>
    <p><a href="https://en.wikipedia.org/wiki/Liebig's_law_of_the_minimum">Liebig’s law of the minimum</a> states that growth is dictated not by total resources available, but by the scarcest resource (limiting factor). If a farm has ample nitrogen and phosphorus but low potassium, the yield will remain low, limited by the potassium levels. Adding more of a non-limiting nutrient (e.g., more phosphorus) does not improve growth; only adding the limiting nutrient (potassium) will increase the yield. This is <a href="https://en.wikipedia.org/wiki/Liebig's_law_of_the_minimum#See_also">related to</a> Theory Of Constraints (The Goal, Phoenix Project), Critical Path Method, etc.</p>
  </li>
  <li>
    <h2 id="bounded-rationality">Bounded Rationality</h2>
    <p>(Came across the idea in the book Thinking In Systems)</p>

    <p>Adam Smith says that every individual by pursuing his own interest frequently promotes that of society more effectually than when he really intends to promote it.</p>

    <p>Unfortunately, we see multiple examples of people acting rationally in their short-term best interests and producing aggregate results that no one likes. Tourists flock to places and then complain that those places have been ruined by all the tourists. Farmers produce surpluses and prices plummet. Fishermen overfish and destroy their own livelihood.</p>

    <p><a href="https://en.wikipedia.org/wiki/Bounded_rationality">Bounded rationality</a> means that people make quite reasonable decisions based on the information they have. But they don’t have perfect information, especially about more distant parts of the system. Fishermen don’t know how many fish there are, much less how many fish will be caught by other fishermen that same day. Human decision-making is limited by cognitive capacity, time constraints, and imperfect information, leading people to settle for “satisficing” (satisfactory) decisions rather than optimal ones. Satisficing: Instead of maximizing utility by analyzing all options, individuals choose the first option that meets their minimum requirements, combining “satisfy” and “suffice”.</p>
  </li>
  <li>
    <h2 id="framing-effect">Framing effect</h2>
    <p>(Was reminded of this bias when reading the above mentioned wikipedia entry about bounded rationality.)</p>

    <p><a href="https://en.wikipedia.org/wiki/Framing_effect_(psychology)">Framing effect</a> is a cognitive bias where people’s decisions change depending on how options or statements are framed, even when they are logically identical. A fortune teller predicts that the king’s grandchildren will die before him whereas another says that the king will outlive his grandchildren.</p>
  </li>
  <li>
    <h2 id="learning-mechanisms">Learning mechanisms</h2>
    <p>One of the long term not-too-keen-but-not-just-superficial interests of mine is how people learn. Not just technology but things in general- ideas, thoughts, etc. I generally learn something new and learn about something new by reading, discussing, and to some extent by doing. Since last few years audiobooks, videos, courses, research-papers have been some other ways. But most of these are- in a way of looking at them- really extensions of same mechanism of learning: books. And, for me books will not be replaced by any other mechanism as primary for some foreseeable future. Of course, learning does not always happen formally. Sometimes things percolate and you learn by osmosis. I am sure you picked up bits and pieces of say anecdotal history of a foreign country, geography of a continent, socialism, method acting- if these topics are not your bread and butter- while listening to some casual conversations happening in your group- possibly in hostels/ dorms, yoga classes, improv group or in some other such ‘third places’. But have you found/ adapted a totally different way/ mechanism of learning than your primary/ usual one? For example, a junior once told me that he watched trending github repos and looked for ideas. This’s so foreign to my constitution that I haven’t adapted it even after a few tries.</p>

    <p>I am also curious about whether the mechanisms involved influence people’s thought process dramatically. For me learning via books is more in depth than by watching videos, and learning by doing stuff and teaching a topic give you further insights and mastery. But apart from depth, scope, etc. do mechanisms influence underlying thought process itself? I guess that would be the case because certainly the thought process is influenced by various factors like your upbringing, gender, financial background, the society, friends, etc. But other things being somewhat comparable if two people have different ways (media, mechanisms whatever you want to call it) of learning or taking new things in, do these ways themselves impact not just what but how these people will think about some totally foreign idea? Any suggestions to know more about this?</p>
  </li>
  <li>
    <h2 id="power-distance-index">Power Distance Index</h2>
    <p>I first read about <a href="https://en.wikipedia.org/wiki/Power_distance#Power_Distance_Index_(PDI)">power distance index</a> in Outliers. Recently during students’ protests in India, I was reminded of the concepts of power distance and index.</p>
  </li>
  <li>
    <h2 id="imagined-order">Imagined Order</h2>
    <p>A few points about the concept of Imagined Order from Yuval Noah Harari’s book Sapiens: Imagined order is a shared system of cultural myths, laws, and religions that humans collectively believe in. We believe in a particular order not because it is objectively true, but because believing in it enables us to cooperate effectively and forge a better society. A natural order is a stable order. There is no chance that gravity will cease to function tomorrow, even if people stop believing in it. In contrast, an imagined order is always in danger of collapse, because it depends upon myths, and myths vanish once people stop believing in them.</p>

    <p>In order to safeguard an imagined order, continuous and strenuous efforts are imperative. Some of these efforts take the shape of violence and coercion. However, an imagined order cannot be sustained by violence alone. It requires some true believers as well.</p>

    <p>How do you cause people to believe in an imagined order such as Christianity, democracy or capitalism? First, you never admit that the order is imagined. You always insist that the order sustaining society is an objective reality created by the great gods or by the laws of nature. You also educate people thoroughly. From the moment they are born, you constantly remind them of the principles of the imagined order, which are incorporated into anything and everything. It is an iron rule of history that every imagined hierarchy disavows its fictional origins and claims to be natural and inevitable.</p>

    <p>Three main factors prevent people from realising that the order organising their lives exists only in their imagination: <strong><em>a.</em></strong> The imagined order is embedded in the material world. <strong><em>b.</em></strong> The imagined order shapes our desires. <strong><em>c.</em></strong> The imagined order is inter-subjective. Even if by some superhuman effort I succeed in freeing my personal desires from the grip of the imagined order, I am just one person. In order to change the imagined order I must convince millions of strangers to cooperate with me. For the imagined order is not a subjective order existing in my own imagination- it is rather an inter-subjective order, existing in the shared imagination of thousands and millions of people.</p>

    <p>It follows that in order to change an existing imagined order, we must first believe in an alternative imagined order.</p>
  </li>
  <li>
    <h2 id="india-will-go-on">India will go on</h2>
    <p>People think more or less what their generation thinks. And they think in similar ways as their generation does. This is more of a thumb rule than an absolute fact. And it relates to the earlier short-take about learning mechanisms and their impact on what and how people learn and think.</p>

    <p>While politics is one of the highest evolved functions/ activities, time and again I have become curious and disinterested in anything politics: local to international,  people to ideas. At certain point I deliberately decided that I won’t be tied to any one ideology- political for the discussion here mainly but others as well. Any one ideology is too inadequate and closed to tie oneself to. I understand <a href="/In-The-Grip-Of-An-Idea/">some reasons why</a> people do that. Primarily, people do that because it’s easy. <a href="https://www.youtube.com/watch?v=SxdOUGdseq4">Easy is not simple, though</a>. Why would you borrow ideology/ philosophy as is from some other entity and make it your own rather than synthesizing one for yourself from various ideas?</p>

    <p>I have deliberately avoided political topics- to the extent possible- since 2015. Coming to <a href="https://en.wikipedia.org/wiki/2026_Delhi_Jantar_Mantar_protests">recent student protests in India</a>, while I possibly have an average understanding of the topic, I would like to understand more. I know why, how the protests happened, politics and issues involved. What I would like to know more about is the abstract concepts. How such movements start, change course/ pivot, succeed, fizzle-out/ fail, bring about changes, second order effects, the system dynamics, etc. You can relate some ideas like <a href="/Short-Takes-1/#preference-falsification-and-preference-cascade">preference falsification and preference cascade</a> or <a href="/Short-Takes-1/#spontaneous-order">spontaneous order</a> to recent protests. But what other ideas from <a href="/Short-Takes-1">the first short takes post</a> do you find relevant?</p>

    <p>I have not seen a lot of political/ issue-based movies of old days- Benegal, Nihalani, Puri, Naseer, etc. (And sometimes when I watched those I have had at least a temporary crush on Smita Patil or Chitrangada. Who wouldn’t, right?) IMO Jabbar Patel made some great movies in that space (politics/ issues based; not Smita-Chitrangada space. Although…) Samna is very good, Sinhasan even better, and here is <a href="https://www.youtube.com/watch?v=p8zJ7-1jDHQ&amp;t=2509s">a favorite scene of mine</a> from his movie Mukta which is more relevant to the recent protests even though it isn’t on the same issues. But, just FYI, I had to watch Mukta twice to realize that the male hero is not over the top.</p>

    <p>The title of this short take- ‘India will go on’- is what R. K. Narayan said to Naipaul when Naipaul was feeling pessimistic about India. IMO, Naipaul’s ‘a wounded civilization’ is best book of his India series and ‘a million mutinies now’ is also good. And while his writing was sometimes criticized as colonial mindset, a lot of his observations- sometimes very biting- resonated with me.</p>
  </li>
</ol>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><category term="Thoughts" /><category term="Concepts" /><category term="Short-Takes" /><summary type="html"><![CDATA[In the short-takes posts I write about some concepts, phrases, models, ideas, whatever related to my work and life. As these are likely to be known to many, the idea is to just document these together, rather than go into details of these. Will keep updating.]]></summary></entry><entry><title type="html">Thoughts In Progress: 3</title><link href="https://atul-atul.github.io/Thoughts-In-Progress-3/" rel="alternate" type="text/html" title="Thoughts In Progress: 3" /><published>2026-04-10T00:00:00+05:30</published><updated>2026-04-13T05:30:01+05:30</updated><id>https://atul-atul.github.io/Thoughts-In-Progress-3</id><content type="html" xml:base="https://atul-atul.github.io/Thoughts-In-Progress-3/"><![CDATA[<p>In the <a href="/tags/#thoughts-in-progress">Thoughts-In-Progress</a> posts, I write about ideas which I may not be fully convinced of yet. Or about which I have not made up my mind yet- this way or that. Like Work In Progress, these thoughts are not done yet.</p>

<p>I have listened to <a href="https://seenunseen.in/episodes/2022/7/11/episode-285-the-life-and-times-of-montek-singh-ahluwalia/">the Montek Singh Ahluwalia(MSA) interview on Seen Unseen podcast</a> a few times. I have mentioned the episode before (coincidentally, in both earlier Thoughts-In-Progress posts).</p>

<p>A few ideas from the episode were that infrastructure cannot be traded/ imported, government should ease the movement of people to cities maybe by building new cities, do better in primary education, health, etc.</p>

<p>The above ideas seem logical right away.</p>

<p>One idea he mentioned and I still have not been able to make up my mind about is this (idea mentioned a little after 1hr30min** into the episode): He mentions that at Oxford, Prof. <a href="https://en.wikipedia.org/wiki/Ian_Little_(economist)">Ian Little</a> (who also taught Dr. Manmohan Singh) said that <strong>when you value a project you should value everything at world prices</strong>. For a steel manufacturing company, the value the company adds is the international value of iron ore (raw material) subtracted from the international value of steel. MSA mentions that when you evaluated like that Indian steel making companies of the past decades were inefficient. Before 1991 reforms, due to protection from world competition those companies got iron deposits cheaply and the steel they made did not command good prices in the international market.</p>

<p>Makes sense, right? Why then is this thought still in progress in my mind? Well, this must be true for GCC/ Iran/ Russian crude oil, etc. But isn’t this true for Indian software as well? A lot of Indian IT is still about arbitrage advantage. If the raw materials (human resources, real estate, etc. in case of IT) are valued at international prices, what kind of value do the Indian IT companies generate? Is it good enough? But on the other hand, what’s wrong with having comparatively cheap resources? Crude oil is a natural resource there and what is wrong if those countries take advantage of that? If we evaluate everything at world prices what differentiators would be there? Now, if we are talking about efficiencies, quality, systems, world competition, value added, etc. we can say that maybe Indian IT companies could do better. (Was that too politically correct?) But  if you have crude oil or IT people cheaply available, why should you evaluate everything at international market prices? Every person, country will want to take advantage of the cheap resources they have and maybe trade the arbitrage advantage for say fresh water, food (in case of middle east), foreign currency, crude oil, GPUs (in case of India), rare minerals (in case of the USA).</p>

<p>Well, the idea makes sense in the context in which MSA mentioned it. Indian companies were protected before opening Indian markets in 1991 and they had unfair advantage and had become complacent. They were not competitive and would have faced difficulty in open market. But on the other hand no market is really free market. Open/ Free market sounds good. But a lot of countries are pro business rather than pro market. They do favors for certain players. And sometimes correctly so. If US government had not funded the banks with stimulus package after the subprime crisis the banks would have been wiped out and a pro-market approach would have been to let them die and let other players enter the market; but then the people would have suffered (if my understanding is correct). All countries do that- pro business vs pro market. USA may favor Shell, fund Stanford University, and every country (people in power) will favor cronies- their own Andani families to set up Golf resorts, oil companies, etc. And this favoritism is likely to remain till some vested interests, us-vs-them feeling are there. So with these realities why not count on cheap resources, why factor in international prices of those resources?</p>

<p>I agree with the principle. But not yet convinced of the need. And yet my thoughts are not exactly <a href="/tags/#out-of-line">out-of-line</a> with MSA’s. Because I don’t think that it is a conventionally accepted wisdom to evaluate at world prices. In fact widely accepted practice seems to be to take advantage of the resources you have- offshore some work, etc. And I think when you estimate at world prices it’s to judge the merit all things being equal. But as long as all things are not equal I am not fully sure of reasons why we should. Maybe I should read more economics, project management books.</p>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><category term="Thoughts" /><category term="Thoughts-In-Progress" /><category term="Reading" /><summary type="html"><![CDATA[In the Thoughts-In-Progress posts, I write about ideas which I may not be fully convinced of yet. Or about which I have not made up my mind yet- this way or that. Like Work In Progress, these thoughts are not done yet.]]></summary></entry><entry><title type="html">Reading 1988 Book Introduction to Functional Programming</title><link href="https://atul-atul.github.io/Intro_to_Functional_Programming/" rel="alternate" type="text/html" title="Reading 1988 Book Introduction to Functional Programming" /><published>2025-11-07T00:00:00+05:30</published><updated>2025-11-07T05:30:01+05:30</updated><id>https://atul-atul.github.io/Intro_to_Functional_Programming</id><content type="html" xml:base="https://atul-atul.github.io/Intro_to_Functional_Programming/"><![CDATA[<p>Finished reading Introduction to Functional Programming by Richard Bird and Philip Wadler. The first edition. Published in 1988. This book is so old it’s not listed even on the authors’ university homepages and wikipedia entries. There is a 1998 version using Haskell that is listed. But I hadn’t read a programming book in a while, someone on twitter had mentioned this book, PDF was available, so I read it. Here are a few impressions.</p>

<p>The 1988 book by Bird and Wadler covers some basic concepts which are mainstream now and you see those covered elsewhere. But it is fun (and at times irritating) to read formal definitions in a somewhat closer to mathematics than programming style. You know when you define currying, foldright with symbols, etc. I won’t consider the book worth while if you have read a functional programming language book. But sometimes changing the perspective (language-maths) helps. In that sense a decent read.</p>

<p>And now for something completely different:</p>

<p>I don’t like when people pick a small area in an ecosystem and become Bible-salesman-like fanatic about it. I have heard about no-carb diets, long distance running, global warming just as much as I have heard about haskell and going cloud-native. I had become (~2011-15) quite fanatic about refactoring, agile, TDD, etc. I am not saying that these are bad things. What’s bad is being dogmatic about those.</p>

<p>Engineering is not purity. It is pragmatism. However much software craftsmanship, category theory, monads, clojure excite you, ideas and technologies like these are tools to better meet business needs. But there are pockets in IT people gravitate towards- e.g. emacs, agile, unix, etc. Mainly people do so because there is merit in these pockets and they do like <a href="https://www.youtube.com/watch?v=B7JcGYilsuE">cherry soda</a>.</p>

<p>Functional programming has been one such pocket for some time. You can, of course, go back to von Neumann, Alonzo Church, lisp. But in large scheme of things it is not very old if you limit to multi-core processors, delayed release of Java 8 era, etc. People behave missionary like when it comes to pure functions, loops, declarative, referential transparency, tail-call, values/ value objects, pattern-matching, list-comprehensions, lazy evaluations, currying, map, reduce, filter, etc.</p>

<p>I have written functional programs- in java, scala, scheme, clojure, erlang, elixir, JS, and <a href="https://x.com/effectfully/status/1930035642337014269">to some extent even in haskell</a>. And I have consumed a lot of material advocating functional programming. And thought process wise, it does make you think differently. But you have to manage state, integrate with other systems, etc. So it’s worth repeating that engineering is pragmatism. Immutability and purely functional data structures are ok but things work better if they are made usable (like in clojure, and later elsewhere). Also, in my opinion static typing works better but then- as far as functional programming with static typing is concerned- there could be some compromises you may have to live with.</p>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><category term="Reading" /><summary type="html"><![CDATA[Finished reading Introduction to Functional Programming by Richard Bird and Philip Wadler. The first edition. Published in 1988. This book is so old it’s not listed even on the authors’ university homepages and wikipedia entries. There is a 1998 version using Haskell that is listed. But I hadn’t read a programming book in a while, someone on twitter had mentioned this book, PDF was available, so I read it. Here are a few impressions.]]></summary></entry><entry><title type="html">An Opinionated Programmer</title><link href="https://atul-atul.github.io/an-opinionated-programmer/" rel="alternate" type="text/html" title="An Opinionated Programmer" /><published>2025-07-19T00:00:00+05:30</published><updated>2025-07-19T05:30:01+05:30</updated><id>https://atul-atul.github.io/an-opinionated-programmer</id><content type="html" xml:base="https://atul-atul.github.io/an-opinionated-programmer/"><![CDATA[<p>Recently Lex Fridman posted a podcast episode of his <a href="https://www.youtube.com/watch?v=vagyIcmIGOQ">discussion with DHH</a> (Duration 6hr+). I have previously written about another such Fridman interview- that with <a href="https://atul-atul.github.io/a-master-programmer/">John Carmack</a>. DHH is a legendary programmer. Known for his work on Ruby On Rails (RoR). You have read about him here <a href="https://atul-atul.github.io/Is-TDD-Dead-Discussion-Revisited/">more</a> than <a href="https://atul-atul.github.io/consolidations-and-monopolies/">once</a>. In fact, the <a href="https://atul-atul.github.io/Is-TDD-Dead/">oldest post on this blog</a> was about his sensible but controversial opinion. (Well, I had written a few blog posts before that one. I used wordpress for blogging then. But when migrating to/ starting with GitHub pages, those earlier posts did not seem to have stood the test of time.)</p>

<p>He is not limited to RoR. He is an influencer in the programmer community. He is very opinionated. And having acquired an aura and followers due to RoR work, he exerts influence in a few other areas as well. And he is quite noisy. I mean it as a compliment. For example, he created a lot of noise against App Store 30% payment rules (All app payments must go thr’ Apple and Apple will take 30% of the amount).</p>

<p>DHH is not an abstract-to-concrete thinker like Alan Kay or Rich Hickey (deep-thinking-as-an-activity types). But software is an opinionated world and we need such noisy people. Not all are as noisy as DHH. But we need strongly put counter opinions most of the time. Otherwise we will drown in the deafening noise created by other folks (Software Craftsmanship BS proponents, Agile consultants, Silicon Valley VCs, AWS certified cloud architects, AI hype-men/ doomsayers,  LinkedIn fiction writers).</p>

<p>(There might be some but) There does not seem to be any malice against the entity he is crusading against at a particular time. For example, these days he seems to be anti-Apple, but when M1 chips came out, he was quite vocal how they outperformed the best chips of the time. He was quite smitten by iPhone javascript performance and praised Safari in the past. But that is not limited to Apple. He has been quite noisy about how his company saved millions by moving out of AWS onto their own servers in professionally managed data centers. But he does not seem to be against everything Amazon/ AWS. He has been <a href="https://world.hey.com/dhh/the-musk-algorithm-977bf312">supportive</a> of how Musk handled twitter. But he’s called Musk delusional as well.</p>

<p>One thing he mentions in this interview with Fridman is that he being an introvert never liked to pair program with another programmer but these days AI helps him as a pair programmer. I did not think of DHH as an introvert. This is the thing… He knows how to be opinionated and when to create noise, etc. He wrote that ‘TDD is dead’ post some days before his rubyconf keynote. He started App Store payment noise just ahead of WWDC. He started talking about SSR when they were about to launch Hey. Can such person be an introvert?*</p>

<p>He is rich and can afford <a href="https://x.com/dhh/status/1819875809622171689">luxury</a>. He can also afford <a href="https://www.youtube.com/watch?v=OqPuF5d1-5U">luxury beliefs</a> but does not seem to have many such beliefs. He is not a tech bro but at times does sound like one. And there was that smear-campaign like ‘basecamp funny names’ thing shortly after he testified against Apple.</p>

<p>I don’t agree with everything he says. For example, static vs dynamic typing from the interview. In fact, I don’t even read everything he writes on his blog. But a lot of what he says makes actual sense. He is one of those very few people in software, who you can agree with, and yet choose not to be dogmatic followers/ bhakt of the person or everything they say.</p>

<hr />
<p>*Marcus Geduld made this <a href="https://www.quora.com/What-is-life-like-for-an-introvert/answer/Marcus-Geduld">point about introverts</a>. I find it insightful. When I was writing about DHH saying he’s an introvert, I remembered Marcus Geduld immediately. I must have read that answer some 8-10 years ago so I was not sure whether it’s by Marcus or my memory was playing tricks on me. But google search and quora related content helped me find this link quickly.</p>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><category term="Reading" /><category term="Tech" /><summary type="html"><![CDATA[Recently Lex Fridman posted a podcast episode of his discussion with DHH (Duration 6hr+). I have previously written about another such Fridman interview- that with John Carmack. DHH is a legendary programmer. Known for his work on Ruby On Rails (RoR). You have read about him here more than once. In fact, the oldest post on this blog was about his sensible but controversial opinion. (Well, I had written a few blog posts before that one. I used wordpress for blogging then. But when migrating to/ starting with GitHub pages, those earlier posts did not seem to have stood the test of time.)]]></summary></entry><entry><title type="html">Short Takes 2</title><link href="https://atul-atul.github.io/Short-Takes-2/" rel="alternate" type="text/html" title="Short Takes 2" /><published>2025-06-12T00:00:00+05:30</published><updated>2026-01-04T05:30:01+05:30</updated><id>https://atul-atul.github.io/Short-Takes-2</id><content type="html" xml:base="https://atul-atul.github.io/Short-Takes-2/"><![CDATA[<p>In the <a href="/tags/#short-takes">short-takes</a> posts I write about some concepts, phrases, models, ideas, whatever related to my work and life. As these are likely to be known to many, the idea is to just document these together, rather than go into details of these. Will keep updating.</p>

<ol>
  <li>
    <h2 id="pula">PuLa</h2>
    <p>There are very few people, possibly there isn’t even one, who I admire as much as I admire late <a href="https://en.wikipedia.org/wiki/Purushottam_Laxman_Deshpande">PuLa</a>.</p>

    <p>Thanks to him I got introduced to a lot of good things which have stayed long with me- from eating fish to reading Wodehouse.</p>

    <p>An important factor is that this admiration, respect, etc. for PuLa has lived long for me. As I matured, I understood some of his shortcomings and limitations, etc. But I also appreciated some other things which I did not earlier. For example, his writing is limited to Marathi language. It is not easily translated to other cultures, languages, etc. In one speech, he himself says that <a href="https://www.youtube.com/watch?v=wL2PMoHZsbg&amp;t=435s">humor and poetry are rooted deeply in the language in which they are written</a> and cannot be easily lifted and shifted. So he was aware of this. Second, many of his plays (excluding ‘Tuze Ahe Tujpashi’) are musical comedies, lacking drama. His translations (Pygmalion to ‘Ti Phulrani’, Old Man And The Sea- ‘Eka Koliyane’) are also said to lose something in translation. On the other hand, he reworked some portions of Pickwick Papers into- deeply rooted into Marathi- the iconic ‘Batatyachi Chawl’. And when he wrote about people he met in real life (<a href="https://www.youtube.com/watch?v=zahEY_JKF7o">Raosaheb</a>, for example) the balance which he struck between his admiration and knowing that the person he was writing about was not perfect is just breathtaking. I started appreciating this only after a friend pointed it out to me. It is a very difficult balance to achieve.</p>

    <p>His fine observation skills, humor, music, etc. are discussed and admired- almost worshipped- a lot. I also admire him because he worked in many areas (writing, films, music, plays, social activities, speaking truth to power, etc.) and in all these areas he did good- almost excelled. He was not always successful (the ‘Subkuch PuLa’ movie ‘GuLaacha Ganpati’, for example). But wherever he went he created a happy place. I don’t know a single- a single- person who did this better than him. I am not saying he was Leonardo Da Vinci. But, anyway. In one QI episode Ronnie Ancona called <a href="https://youtu.be/oSKNqpRgjq8?list=PLci687eliKhvL-_gTLB5uz07HZigy3Y_X&amp;t=469">Stephen Fry a renaissance man</a>. I think PuLa was the same.</p>

    <p>In one interview PuLa mentions that <a href="https://www.youtube.com/watch?v=2Ha3og_vvsw&amp;t=523s">he wrote as if he was speaking to someone</a> sitting in front of him. Because I admired his writing I also picked this way of writing to some extent (Wodehouse must have contributed, as well). And at times it is annoying. Why should I write that way when I am writing some technical notes? It makes you somewhat dependent on mostly apathetic readers.</p>

    <p>Perhaps the thing that I admire most in him is that he was very appreciative of quality in people and things. Here by appreciative I mean he spotted, praised, and <a href="https://youtu.be/bAtkxZai3fE?t=539">encouraged</a> talent early on. Here are some examples, <a href="https://youtu.be/1aKx2umllPM?t=1393">the first performance</a> of late <a href="https://en.wikipedia.org/wiki/Bhimsen_Joshi">Bhimsen Joshi</a> in Pune was at PuLa’s place. <a href="https://www.youtube.com/watch?v=6XmUaYiy3Xk&amp;t=1384s">The first letter saying ‘I liked your poems’</a> to the then unknown poet <a href="https://en.wikipedia.org/wiki/Namdeo_Dhondo_Mahanor">Mahanor</a> was by PuLa. He was the first to support the Dalit literature (He wrote a forward to Anand Yadav’s book and told Narayan Surve that <a href="https://www.youtube.com/watch?v=u-Y_fVYs2SA">his poem MoneyOrder</a> stunned him). I may not be a people person like PuLa but I hope and strive to appreciate good things like he did.</p>
  </li>
  <li>
    <h2 id="madeleine-moment">Madeleine moment</h2>
    <p>Also known as <a href="https://en.wikipedia.org/wiki/Involuntary_memory">involuntary memory</a>. What was the most recent (and somewhat dramatic) Madeleine moment you experienced? I recently spent a few weekends away from city. And once saw quite a few fireflies. Some memories were triggered. But those were neither dramatic nor quite close to heart. I should meditate more.</p>
  </li>
  <li>
    <h2 id="language-and-script-in-entertainment">Language and script (in entertainment)</h2>
    <p>Language is something that is primarily spoken. Script is written. <a href="https://en.wikipedia.org/wiki/Anurag_Kashyap">Anurag Kashyap</a> says- <a href="https://youtu.be/V5M4cIeWoMQ?t=393">in this interview</a>- that from Rangeela onwards movies started using spoken language more than language in its pure, polished form. Their (Ram Gopal Varma and Anurag Kashyap) movie Satya has long been a favorite. But I remember I didn’t understand some of the language nuances and a senior friend had to explain those to me. Even now, the expletive packed language of north Indian cinema is not for me. I do use expletives. But while, for example, the raw language fits well in <a href="https://en.wikipedia.org/wiki/Gangs_of_Wasseypur">Gangs of Wasseypur</a> movies, I don’t like blatant use of such language everywhere.</p>
  </li>
  <li>
    <h2 id="thought-subversion-is-difficult">Thought subversion is difficult</h2>
    <p>What kind of thought subversion are we comfortable with? For example, if you are from India/ Asia or were born in a religion that originated in India, would you be able to believe that Karma does not exist, that you are not reborn, that no energy flows thr’ your spine? Well, I could not do it. Christian folks may find it difficult to not believe in Original Sin. Is there any reason why one should think that life is sacred? I don’t bother about past/ future lives but that is when I am thinking/ acting consciously. But the shackles of Karma are difficult to shake off. And as a result I find it easier (and I am almost sure that you’ll find it illogical) to reconcile that while maybe past/ future lives don’t exist, there are <a href="https://en.wikipedia.org/wiki/Samskara_(Indian_philosophy)">Samskara</a> or <a href="https://en.wikipedia.org/wiki/Sa%E1%B9%85kh%C4%81ra">Saṅkhāra</a> due to karma in this life. But if someone argues with me that all that samskara thing is just escapism non-sense, I would not be able to counter that person well. Yet, such things have a hold on us. Ok, forget religious, spiritual things. Here is some text from Feynman’s book ‘Surely, You’re Joking, Mr. Feynman’: <em>‘Von Neumann gave me an interesting idea: that you don’t have to be responsible for the world that you’re in. So I have developed a very powerful sense of social irresponsibility as a result of Von Neumann’s advice. It’s made me a very happy man ever since. But it was Von Neumann who put the seed in that grew into my active irresponsibility!’</em> While I fully understand that it is a healthy attitude, I have not been able to have that even for short periods of time. Why do ideas, thoughts have such suffocating hold on us? Maybe I am someone who takes themselves/ their ideas more seriously than they should. Maybe it is due to culture, inbreeding, geography, system around us. Actionable part is: how can we escape such holds? Maybe create an environment/ ecosystem around us which promotes different thoughts, and think deeply. What else?</p>
  </li>
  <li>
    <h2 id="test-cricket-and-changing-tastes">Test cricket and changing tastes</h2>
    <p>I did not like Test cricket in the past. It’s not easy to find time to watch a match that can go on for 5 days (for men) and still end in a draw. But sometimes you can watch some of it over the weekend, in the background, in the evening thanks to timezone differences, etc. There’s no doubt T20 and One Day matches are here to take cricket forward and Test cricket will eventually be at their mercy. In fact, it already is. There are fewer Tests and some cricket playing countries have more or less given up on it (in spirit, at least). There is even talk of shortening matches to 4 days, etc. But putting aside instant gratification, if you develop a taste for it you start appreciating a drawn match or series, and even a maiden over. I watched more Test cricket in last 10 years or so than I did before. And in recent years, I have come to the conclusion that if you don’t appreciate Test cricket, you simply don’t understand cricket. Current favorite series- the Ashes, Border-Gavaskar trophy, Anderson-Tendulkar trophy, and maybe WTC. Sadly, there aren’t many countries willing to spend on Test cricket. Teams play but most of the times there’s no heart into it. Teams like Pak, SL have gone downhill due to politics, etc. And capitalism has tilted the balance towards shorter formats. And yet, in the last 5 years, there have been Test matches and series which will be remembered for long.</p>

    <p>When the changeover from the likes of Sachin, Dravid, Ganguly was taking place in Indian Cricket, a lot of things were changing- Social media, IPL, Indian cricket had more money, Mumbai was ceding ground to towns like Ranchi. I didn’t like the bearded young fellows of Indian cricket with weird nicknames (Sir, Gabbar), their antics on the ground and in front of camera, and who were comfortable with being- for the want of a better word- themselves. I thought that they were playing to the gallery. And yet today I appreciate Ravindra Jadeja. Frankly, I never thought he would last this long in the Indian side. And while I still think Rishabh Pant should ignore cameras and save risky shots for the IPL, there’s no doubt that he brings a lot to the Indian team. Recent players are more confident, gritty. It’s like Gen Z (or whatever you want to call them) people are more themselves and are breaking the mould like they do in corporate offices. And while each generation is different from the previous one, maybe there are second order effects of social media, and certainly of India’s 1991 reforms as well.</p>
  </li>
  <li>
    <h2 id="dentists">Dentists</h2>
    <p>Why do lady dentists have the habit of engaging you in, you know, small talk when you are in the dentist’s chair?</p>
  </li>
  <li>
    <h2 id="end-of-an-era-in-tennis">End of an era in Tennis</h2>
    <p>There isn’t always a single definite point in the arrow of time at which we can say a new era has begun and the old one’s gone. There is a transition which takes place where people, objects, practices, customs, and cultures change, and the old makes way for the new. The transition may not be, but generally is, gradual. While the new is getting established, the old may make and succeed in the last ditch attempts to survive and flourish. And yet the old has to go. It is the way of life. There may be some catalysts during this changeover. For example, the second world war accelerated the dismantling of the British empire; French, Russian revolutions and corresponding changes in regimes and societies, etc.</p>

    <p>One such transition has recently taken place… in men’s tennis. The Big Three (Federer, Nadal, Djokovic) are gone; the Big Four if you include Murray. 
 <br /><br /><img src="/images/TheTennisBigFour.jpg" style="width:500px;" /><br /><br />
Well, Djokovic is still not retired and in that sense he will make some spirited efforts to win next few championships and may win some. Just like Federer did. But Djokovic’s play being somewhat mechanical, there is no obvious weakness to work on or gap to bridge (unlike Federer where he improved his backhand dramatically and won the 2017 Aus Open). Most likely, this- being somewhat mechanical- made Djokovic a little boring for me. He’s the best returner, if someone broke his serve chances were he’d break back right in the next game, etc. Of course, his mental toughness was extraordinary (for example, 2019 Wimbledon final). So certainly there’s heart in it; it’s not all mechanical. Anyway, coming back to transition <a href="https://x.com/BenRothenberg/status/1964161673423462746">this tweet</a> should give us some idea. Here’s the image from the tweet:
 <br /><br /><img src="/images/TheBigThreeAtGrandSlams.png" style="width:400px;" /></p>
  </li>
  <li>
    <h2 id="doorman-fallacy">Doorman Fallacy</h2>
    <p>Till the last month I did not know about <a href="https://www.youtube.com/watch?v=9_l12-nmYQo">the doorman fallacy</a>. It does not seem to have a wikipedia entry; so not sure how widely accepted the fallacy is. I vaguely knew the concept. But did not know that there’s a name for it. Very early in my career, with agile and automation (CI pipeline, CD etc.), an excitable department head decreed that we will re-skill all manual testers to be automation testing engineers, and do away with manual and exploratory testing altogether. The exercise did not end as intended. (You know the drill: they hire external consultants, go too far because they miss the nuances and the fine print in excitement, nobody is fully accountable, and people move on to tell success stories.) While imposition from top down helps align and speed things up some of these things take time, and there are second order effects. As I my understanding has widened (and sometimes deepened) about things in general I have started understanding how complex various systems are. Many times we act on them with the illusion of knowledge, control, and confidence. And yet there is so much we don’t know. Of course, we can sometimes act with confidence precisely because of our ignorance. And sometimes we have to act. We cannot have the luxury of time, of understanding everything, etc. (as if we ever can). Then there is this related thing called <a href="https://en.wiktionary.org/wiki/Chesterton%27s_fence">Chesterton’s fence</a>. I got to know about it via youtube comments. There must be many such related concepts which I am not aware of. I suppose premium schools (for example, IITs), management schools, networks and environment help.</p>
  </li>
  <li>
    <h2 id="pretty-little-baby">Pretty Little Baby</h2>
    <p>Recently I wasted some time on twitter’s ‘For you’ feed. I follow very few people on twitter and normally my twitter feed is only the people I am following; I don’t visit the ‘For you’ tab at all. I don’t have IG, FB accounts, although I have wasted time on youtube shorts before. Anyway, this twitter ‘For you’ feed doom scrolling is quite extraordinary garbage in economy size. In the past, I thought Indians ruined orkut and quora. Later I understood that it’s not limited to Indians and those sites. Every social site gets ruined. Of course, well curated feed improves even linked-in and twitter. Coming to twitter’s garbage ‘For you’ feed, I know that the algorithm will recommend me more of the kind of content I consume. But if I have not visited the feed in the past, why should I see people with one or two sentence life philosophy, gym fail videos, bro killing it, cuteness overload, linked-in like BS essays and life stories? Of course, there are the <a href="https://x.com/PostsOfCats/status/1962922862953504992">kids</a>, daddy’s baby girl, favorite scenes from movies, cats and dogs videos (too many to link), and sometimes <a href="https://x.com/RealestMemes_/status/1954014820875088154">light humor</a> which make it somewhat bearable. And this could be the case of <a href="https://en.wikipedia.org/wiki/Frequency_illusion">frequency illusion</a> but I noticed and came to know that the song <a href="https://www.youtube.com/watch?v=LTsR3LfhdxI">Pretty Little Baby</a> is quite popular- I have seen it in videos of kittens and cats, puppies and dogs, other animals, birds, toddlers, etc.</p>
  </li>
  <li>
    <h2 id="thatd-be-quite-a-spectacle">That’d be quite a spectacle</h2>
    <p>I haven’t visited eye doctor recently but it looks clear that I may have to wear age related spectacles. During childhood, I envied people with eyeglasses because I genuinely thought <a href="https://youtu.be/HAsBk9Eia8A?t=4285">glasses made look people intelligent</a>. Yet not something I imagined I would someday ‘have to’ wear. I know it’s ok but I feel like screaming <a href="https://www.youtube.com/watch?v=6omQK8WGjwE">‘My eyes, my eyes’</a>.</p>
  </li>
  <li>
    <h2 id="sleep">Sleep</h2>
    <p>Sleep- particularly nightly sleep- is more important than you realize. That’s it. That’s the short take.</p>
  </li>
  <li>
    <h2 id="womens-odi-cricket-world-cup">Women’s ODI Cricket world cup</h2>
    <p>Well, given the current frenzy around it, <a href="https://www.espncricinfo.com/series/icc-women-s-world-cup-2025-26-1478193/india-women-vs-australia-women-2nd-semi-final-1490442/full-scorecard">the IndWvsAusW ICC WODI WC semifinal match</a> will be forgotten somewhat sooner than you’d expect. But irrespective of who wins the world cup its impact will last forever. Its impact has already happened in a sense. Because, it was not even one particular match as such. And certainly it was not a fluke like some T20 power hitting game. Longer formats test your character better. India Women’s team has been the second best team almost consistently; at least for last few years in all formats. And Aussies are still the best. But I think the impact of match is not about the team; it’s about women’s cricket in India. This impact will take a few (5+?) years to be evenly distributed but <a href="https://x.com/theanalyst/status/1983949041672347737">it would be like the start of IPL</a> or like Aishwarya and Sushmita winning those beauty pageants. Some things will be there- corruption, favoritism, vested interests, power struggles, scarcity mentality, unprofessional attitudes (acquired.fm podcast’s <a href="https://www.acquired.fm/episodes/indian-premier-league-cricket">IPL episode</a> said something like ‘these are just the norms’, way to do business in India, etc.). But there will be more money, more mind-space, and there will be progress. From physical fitness to professionalism. There will be unmatched bench strength. More than that people will be more invested in women’s cricket. Twitter became aware of the match as it progressed in favor of India and went crazy after the win. But the match was not trending earlier. With this win, I hope future matches will be better- for the want of an apt word- supported. To be sure the Aussies will continue to dominate cricket. They are a much better team than India in all areas and are thoroughly professional. And they are likely to remain so. But India will be a force to be reckoned with. And inspired performances like this match will build character. For example, I panicked and felt that India had as good as lost the match when Smriti got out. But maybe only for 5 seconds. I continued watching the match. Gone are the days when people switched off the TV as soon as Tendulkar got out. As the match progressed it’s evident that the Aussies panicked. Harman-Jemi partnership was the big tilt. Sending in Deepti before Richa was also a great move (if I am not reading too much into it). And I felt certain of India’s win when Ashleigh Gardner bowled a few not-wide-but-out-of-reach balls to Richa in the 45th over. When you put someone like Gardner on the back-foot like that and send the ball beyond the rope in the Ellyse Perry region of the boundary then you have arrived.</p>

    <p>A lot of factors have gone into getting there. Indian board being the richest because people are crazy about cricket (and there are a lot of people in India), <a href="https://x.com/johnwright15/status/1983971421773856940">the adjacent possible</a>, the T20 leagues (IPL, WPL, WBBL, Hundred), <a href="https://x.com/awcwvlc/status/1983924622488695234">Harman</a> may be retiring before the next cup, and she has <a href="https://x.com/FarziCricketer/status/1983946461885952230">swallowed the bitter pill many times</a> in the past and would like to win the cup, Deepti’s fighting spirit, India has home advantage so would like to win, the 3 defeats on the road to the semifinal stung and possibly awoke the giant, Smriti overcoming struggles against off-spinners, etc. <a href="https://www.youtube.com/watch?v=Qd6JWwRXMkQ">Jemi’s personal struggles</a> (abuse because of her non-cricket activities like dance reels, being targeted by religious losers, etc.) were of course on a different level. Until about 2 years back she was life of the party on the ground. She seemed outgoing, extroverted, new generation, etc. While the change in her presence on the ground from the past to now was visible, I did not know that she’s fighting those battles still. That reminds me that everyone is fighting a losing battle that you know nothing about; so be kinder. Lastly, if you had asked me about a single differentiating factor during close-to-retirement years of Federer, I would have said that he had better chance of winning if he got the first serve in. In the same vein, if there’s one single factor that worked better than any other in the match it was that India <a href="https://x.com/IrfanPathan/status/1983939386984075377">kept cool</a> and never let their run rate drop. Any suggestions for the final, you ask? Keep Renuka, Radha in the team, and as a wild suggestion send Smriti in at number 3.</p>
  </li>
  <li>
    <h2 id="weak-minds">Weak minds</h2>
    <p>This short take may sound like a darker side of me. But there it is. Yet let’s be clear that this is not about a person or a country or a religion. It’s more about weakness of mind that is universal. You and I have such weaknesses- maybe differing in specific aspects. Let’s take a case of a popular twitter persona- we’ll call him Kabra. Well, people from Pune cannot escape this persona if they are on twitter. Talks a lot of sense a lot of time. In that sense he is doing more good work than harm. Science, engineering, etc. And yet possibly due to driven by audience or for content engagement, ends up making compromises. People do that. But then this Orwell quote sums it up- ‘He wears a mask, and his face grows to fit it’. At one point he had written a quite messed up thread on a popular verse from the Gita. Totally screwed up meaning. His thread and replies on it told me that he did not understand the meaning- like AT ALL. And the verse is so popular that you’d think that people cannot get the basic meaning wrong. I explained correct meaning of the verse. No acknowledgement. Later he deleted his old related tweets and created a new thread on the same verse and in doing so failed to admit his old interpretation was wrong. Instead, made it sound like the old thread needed rework as the meaning can be applicable in many situations. My point is that his online persona started looking fake to me. While I have innate- well, maybe not innate- habit of <a href="https://xkcd.com/386/">correcting people</a>, after a couple of years post college, I started doing it without any sense of superiority, and to the extent possible, privately- not publicly. With genuine desire to help. But problem is that people are not able to separate their identity from their tweets. Just like programmers think they are the code they write. Such people use their misconceptions, echo chambers, and brute force to ignore reason. These people are maybe suitable for the jobs of bad Presidents or Prime Ministers of some country. I have been wrong hundreds of times and have admitted to being wrong thousands of times. Ha ha. Now you may say that I am confusing one-off incident with the person- sort of like treating a programmer same as the code they wrote. But due to incentives of user engagement such people are supple. They can sense and adapt the narrative to that which is currently popular. These are the people who always like the top ranked male tennis player. A couple of years post the Gita verse thing, he started some youtube show and in one episode attempted to explain science behind a peculiarly Indian idea… you know one of those ideas like rebirth, karma, avatar, etc. Why? Why do rational sounding intellectuals do that? Why can’t they keep these things separate? Follow the rituals if you want. Religion is not a bad thing. I know a lot of reasons why people do this. Yet this <a href="https://www.goodreads.com/quotes/11814159-one-of-the-evil-results-of-the-political-subjection-of">Huxley observation</a> hurts me. Maybe not as much as Naipaul’s ‘A wounded civilization’. Because even though criticized for colonial mindset, Naipaul tries to find reasons why people do that. And the reasons also hurt. It may appear more pronounced in Indian mind but is not limited to it. For example, in the <a href="https://www.youtube.com/watch?v=3S1dCKgohjo">Ross-Phoebe evolution argument</a> Ross should have denied even a teeny tiny possibility that the theory of evolution could be wrong. Until proven otherwise- demonstrably, repeatably.</p>
  </li>
  <li>
    <h2 id="is-ought-fallacy">Is-Ought Fallacy</h2>
    <p>Recently, while watching the <a href="https://www.youtube.com/watch?v=XJBkRKTUF34">Everything is everything episode on evolution</a> I came to know about the name for the concept- <a href="https://en.wikipedia.org/wiki/Is%E2%80%93ought_problem">Is-Ought problem</a> or fallacy. Read more about it on the wikipedia page. One of the things they missed discussing is that there is no directionality to evolution. (Well, Ajay did discuss about there being no destination, evolution never ends, etc.) But for example, human brains (some parts) are fairly better developed than in other species but may deteriorate over generations if say we leave everything to AGI. Evolution works on Good-Enough principle- not on perfecting principle. (This last statement was from a Robert Full TED talk which has been archived.) Of course, on evolutionary time-scale there could be local maximas.
   <img src="/images/Calvin_Acme_Of_Evolution.jpg" alt="" title="Calvin_Acme_Of_Evolution" /></p>

    <p>Another thing I learned from the episode is that ‘Science expands knowledge but it doesn’t <strong>necessarily</strong> expand language’.</p>
  </li>
  <li>
    <h2 id="content-creation-pressure">Content Creation Pressure</h2>
    <p>They recently stopped making Everything Is Everything(EiE) episodes. I watched a few episodes. I used to read Amit’s blog (maybe 2009-10), and have listened to a few episodes of his The Seen And The Unseen(TSATU) podcast. I learned many things. But I understand why they stopped EiE. Well, Amit’s explanation in the final episode made sense. But Ajay’s reasons resonated. If you have listened to TSATU in the past, a lot of content (particularly from Amit’s side) on EiE was known to you. Of course, the ideas were sometimes put in different contexts, etc. But there was bound to be some repetition. The Sanskrit concept of Nava-rasa (9 emotions(?)) can be packaged in various combinations to create a lot of things. In that sense some ideas are bound to be repeated. Another example- maybe you have read on this blog a few repeated things- importance of naming things, identifying things by their proper names, clean code, SAFe bashing, cognitive biases, etc. When people repeat these things it’s likely because those are close to their hearts- which is true for things repeated on this blog at least. There could be other reasons. One reason, for example, is that those things sell- like dogs feeling sleepy videos or soccer girls rolling their shorts up. But some people are more comfortable with producing what sells than others. And this is where Ajay’s reasons resonated. You have only so much to say; once you’ve said it you can utilize time better by doing some other things, etc. And creating serious content can drain energy. When creating a presentation how many times do you revise the slides? (Is this a case of ‘science does not necessarily advance the language’ mentioned above? Slides? What do you mean slides? If you insist on living in age old days why not call them transparencies instead?) Anyway, bullet pointed talk is still ok. Let’s do one experiment. Say you are going to discuss or talk about some idea for an hour. Whatever the idea you want to present, talk about may be (not <a href="https://www.youtube.com/watch?v=ayImIgdgLEI">lasagna recipe</a>, of course)- just write down what you are going to talk about. Why write the content down? To give it a fixed form. Then see how many revisions/ corrections you end up doing over a couple of days. Read it after 10-15 days. Next, create such write up once every week for say two months on different topics- serious enough, and in-depth and broad enough to interest your colleagues- people more or less in your intellectual bandwidth. It’s difficult. This is why- even though I liked the EiE- I am not sad that they stopped. The versions we see must have taken a lot of work coming up with content, editing, etc. I will consume TSATU episodes and what Amit comes back with next. But I will also watch out for Ajay’s work, if it’s not too specific to economics and if I can grasp it.</p>
  </li>
  <li>
    <h2 id="content-targeted-towards-audience">Content targeted towards audience</h2>
    <p>When you create content, you may have a certain target audience in mind. Wodehouse wrote stories set in upper class old world England with Earls and butlers because he saw that there was a curiosity for such thing among his readers. <a href="/Short-Takes-2/#pula">PuLa</a> wrote primarily for educated, somewhat nostalgic, middle class Marathi brahmins of his era who lived in the cities. During the process some authors educate their readers. Many Marathi writers before PuLa also wrote for similar audience. But they were stuck in that world. For example, humor by authors like <a href="https://en.wikipedia.org/wiki/Chintaman_Vinayak_Joshi">C. V. Joshi</a> before PuLa could not rise beyond certain limits set by the audience it was targeted towards. I think when writers like PuLa educate and elevate readers to a higher plane, they work through/ with the readers. Mangesh Padgaonkar mentions that in some plays Shakespeare added vulgarity, sexual innuendos, etc. at the beginning of the play to get people inside the theater on time. Like Mani Ratnam adding dance numbers at the beginning of his movies. People get in and forget the outside and then the drama starts. Another example, Romeo in early acts describes Rosaline using shallow ideas, and even describes Juliet in abstract terms. His love sound bookish. But in the later acts his descriptions, desires acquire more maturity, spiritual references; the love becomes deep. This is to show his own growth and development as a lover but also to get the viewers invested so that the tragedy at the end hits hard. (This- working through/ with the readers- is not always the case. Some authors may elevate the readers in spite of those same readers (they give them cars when people would’ve demanded faster horses).)
  Amit educated me in the areas of economics, books, ideas, etc. via The Seen And The Unseen podcast. His approach is <a href="https://youtu.be/JPyuH4qXLZ0?list=PL8B24C31197EC371C&amp;t=825">scholarly</a> in that he cites/ credits quite a few references, books where he came across those ideas, etc. On Everything is Everything youtube podcast, maybe because they had to work with the readers/ viewers, there were certain limitations- from topics to depth. Can you imagine what kind of content they will be able to create if they changed the audience from the likes of you and me to say people already on a somewhat higher plane? Whether they’ll want to do that may depend on various factors. But it could be one of the reasons they stopped EiE.</p>
  </li>
  <li>
    <h2 id="english-grammar">English grammar</h2>
    <p>I did my schooling in Marathi medium. English was the third language during school. While written English comes easier to me than spoken; it’s not my first language in either form. And it sounds like an excuse (and at some level it no doubt is) but you may see some grammatical errors here. Sentence construction, order of words, may-might, a-an-the, I-me, would, who-whom, shall, etc. By the way, do people still use shall or is it limited to grandpas?</p>
  </li>
  <li>
    <h2 id="straw-man-fallacy">Straw man fallacy</h2>
    <p>A <a href="https://en.wikipedia.org/wiki/Straw_man">straw man fallacy</a> is when people counter an argument that’s different from the one actually being discussed. They also don’t understand, or if they understand then they don’t acknowledge the difference. Not exactly closer to what Kahneman calls bias involving substitution where people answer cognitively easier question instead of the actual hard question that was asked.</p>
  </li>
  <li>
    <h2 id="system-dynamics">System Dynamics</h2>
    <p>System thinking/ dynamics is an approach where you look at a group of interacting subsystems <em>as a whole</em> from a viewpoint to understand how they interact with and affect each other and the whole.</p>

    <p>In the past, I <a href="/recently-read/">mentioned</a> “Thinking In Systems”. Weinberg in his An Introduction to General Systems Thinking quotes Tagore poetry: “By plucking her petals you do not gather the beauty of the flower.” (I left both books half read, by the way.) Also, take a look at this video explaining <a href="https://www.youtube.com/watch?v=Miy9uQcwo3U">difference between Analysis and Synthesis</a> approaches. If you have an engineering (or related field) background, you are familiar with and have used both these approaches. And yet, statements like <a href="https://youtu.be/AnTwZVviXyY?t=889"><strong>Structure generates behaviour</strong></a> immediately hit like a mathematics formula that tells you an absolute truth. Makes sense right away. For example, <a href="https://www.reddit.com/r/calvinandhobbes/comments/1eunu6s/calvin_and_hobbes_story_arc_calvins_killer_bike">adding training wheels</a> when a kid is learning to ride a bike may help. Or moving an energy draining person from one team to another seems to improve that person’s as well as both teams’ performance. And it could be one of the reasons why countries want to bring about a change in regime of an enemy country. The linked video makes an interesting point that “our first instinct is to blame people in the system and that is a low leverage response.” This seems to counter Weinberg’s second rule of consulting that says “No matter how it looks at first, it’s always a people problem.” But <a href="https://youtu.be/o-Yp8A7BPE8?t=1115">the video</a> says that actions people take are possible, feasible, and rational because of the universe in which they exist. And dynamics emerge from the interaction of physics, information availability, and decision rules. They make another important point that <a href="https://youtu.be/o-Yp8A7BPE8?t=846">there are no side effects; they are only effects you haven’t thought about yet</a>. Also, check out this <a href="https://www.youtube.com/playlist?list=PLL6RiAl2WHXEU04zFYyWrUGV_fqGG4TuR">chapter wise summary of Thinking In Systems</a>.</p>
  </li>
  <li>
    <h2 id="she-walked-in-beauty-like-a-starlit-night">She walked in beauty like a starlit night</h2>
    <p>I now know that it’s not the exact line from that <a href="https://www.poetryfoundation.org/poems/43844/she-walks-in-beauty">poem by Lord Byron</a>. I remembered it like ‘starlit night’. Is this called mondegreen? I must have read the line somewhere- possibly in some Marathi book- and memorized it incorrectly. But it’s likely that the author quoted it like that. Also, I cannot be sure, but I don’t think I have read/ recalled/ used that phrase in the last 10-15 years. I can’t say what triggered it but when it came to mind today, it was sudden and came so forcefully that I had to stop and google it. This is when I found the poem. I know I am going to come back to this poem many times for the lines ‘Where thoughts serenely sweet express, How pure, how dear their dwelling-place’.  This is also a… At this point- keeping the previous sentence half finished- I had to go and check if the line- ‘starlit night’- was there where I thought it would be. It was in the book I thought it’d be in and in the article I thought it’d be in and it was like I remembered it- ‘starlit night’, and it’s made me happy. Let’s complete the earlier half finished sentence some other time.</p>
  </li>
</ol>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><category term="Thoughts" /><category term="Concepts" /><category term="Short-Takes" /><summary type="html"><![CDATA[In the short-takes posts I write about some concepts, phrases, models, ideas, whatever related to my work and life. As these are likely to be known to many, the idea is to just document these together, rather than go into details of these. Will keep updating.]]></summary></entry><entry><title type="html">GFS Paper</title><link href="https://atul-atul.github.io/gfs-paper/" rel="alternate" type="text/html" title="GFS Paper" /><published>2025-03-24T00:00:00+05:30</published><updated>2025-03-27T05:30:01+05:30</updated><id>https://atul-atul.github.io/gfs-paper</id><content type="html" xml:base="https://atul-atul.github.io/gfs-paper/"><![CDATA[<p>Here is my understanding about Google File System from reading <a href="https://static.googleusercontent.com/media/research.google.com/en//archive/gfs-sosp2003.pdf">the GFS paper</a>. Some other references: <a href="https://www.youtube.com/watch?v=EpIgvowZr00&amp;list=PLrw6a1wE39_tb2fErI4-WkMbsvGQk9_UB">MIT’s lecture video</a>. I will use mostly text here- some of it is directly copied from the paper. So if you need a video walkthrough of the paper with diagrams, etc, here is a good <a href="https://www.youtube.com/watch?v=LXhgFAZroG8">youtube video</a>.</p>

<p>This paper was published in 2003, and while the concepts used were not new to academia, GFS put those to use in production. So in that sense it was revolutionary. Why did I read it now? Well, DeepSeek’s 3FS was recently announced/ open sourced and I wanted to read it but not much material seems available yet (Some reference is there as a part of an old paper… maybe I will read that next). But maybe that was a trigger.</p>

<p>The ideas relevant in this description include: distributed applications, serialization, heartbeat pings, consistency, hierarchical file system, write-ahead-log, etc.</p>

<p>GFS was designed with specific goals/ usage patterns for Google’s applications. For example, random access is not a stated goal, files are large, mostly blocks are appended than overwritten, etc. The paper mentions documents- something like web-crawler result files. But maybe while reading the paper, it’d help to think of large files- like GB sized youtube videos- being chunked apart and pieced back together.</p>

<p>Client applications access GFS using a library. This library provides an API and some utilities. When the word ‘client’ is used in the rest of this post, think of it as this client library.</p>

<p>A GFS cluster consists of a single master and multiple chunk-servers and is accessed by multiple clients. They use commodity hardware.</p>

<p>GFS stores large files by splitting them into fixed sized chunks of 64MB each. Each chunk is stored as a separate file in linux local disk. The machines storing these chunks are called chunk servers. Chunks of a file may be stored on different chunk servers. Chunks are replicated and replicas are stored on different servers. (The paper talks about racks, etc. but not much about data centers. Maybe they were using a single data center then.)</p>

<p>The workloads primarily consist of two kinds of reads: large streaming reads and small random reads. The workloads also have many large, sequential writes that append data to files.</p>

<p>In applications using GFS, files are often used as producer-consumer queues or for many-way merging. Hundreds of producers, running one per machine, concurrently append to a file. Atomicity with minimal synchronization overhead is essential.</p>

<p>High sustained bandwidth is more important than low latency.</p>

<p>Each chunk is identified by an immutable and globally unique 64 bit chunk handle assigned by the master at the time of chunk creation. Chunkservers read or write chunk data specified by a chunk handle and byte range. Large chunk size reduces metadata stored on the master and also reduces client-master interaction for this metadata. Clients can also keep TCP connection to chunk server alive for longer duration as they need to talk to fewer chunk servers due to bigger chunk sizes.</p>

<p><img src="/images/GFS_Architecture.png" alt="GFS Architecture" title="GFS Architecture" /></p>

<p>The master maintains all file system metadata. This includes the namespace, access control information, the mapping from files to chunks, and the current locations of chunks. It also controls system-wide activities such as chunk lease management, garbage collection of orphaned chunks, and chunk migration between chunkservers. The master periodically communicates with each chunkserver in HeartBeat messages to give it instructions and collect its state.</p>

<p>Clients interact with the master for metadata operations, but all data-bearing communication goes directly to the chunkservers. Clients never read and write file data through the master. Instead, a client asks the master which chunkservers it should contact. The client then caches this information for a limited time and interacts with the chunkservers directly for many subsequent operations.</p>

<p>First, using the fixed chunk size, the client translates the file name and byte offset specified by the application into a chunk index within the file. Then, it sends the master a request containing the file name and chunk index. The master replies with the corresponding chunk handle and locations of the replicas. The client caches this information using the file name and chunk index as the key.</p>

<p>The client then sends a request to one of the replicas, most likely the closest one. The request specifies the chunk handle and a byte range within that chunk. Further reads of the same chunk require no more client-master interaction until the cached information expires or the file is reopened. In fact, the client typically asks for multiple chunks in the same request and the master can also include the information for chunks immediately following those requested. This extra information sidesteps several future client-master interactions at practically no extra cost.</p>

<hr />
<h4 id="the-master-and-metadata">The Master and metadata</h4>
<p>The master stores three major types of metadata: the file and chunk namespaces, the mapping from files to chunks, and the locations of each chunk’s replicas. All metadata is kept in the master’s memory. The first two types (namespaces and file-to-chunk mapping) are also kept persistent by logging mutations to a write-ahead-log stored on the master’s local disk and replicated on remote machines. This helps when master fails and in-memory data is lost. Based on the write-ahead-log (in the paper they call it operations log), the files and chunks, as well as their versions, are all uniquely and eternally identified by the <a href="https://atul-atul.github.io/time-in-distributed-systems/">logical times</a> at which they were created. The write-ahead-log being critical persistence record is replicated on multiple remote machines and the master responds to a client operation only after flushing the corresponding log record to disk both locally and remotely (flushed in batches; not real time). To minimize startup time, they keep the log small. The master checkpoints its state whenever the log grows beyond a certain size so that it can recover by loading the latest checkpoint from local disk and replaying only the limited number of log records after that. The checkpoint is in a compact B-tree like form that can be directly mapped into memory and used for namespace lookup without extra parsing. The master switches to a new log file and creates the new checkpoint in a separate thread. The new checkpoint includes all mutations before the switch. It can be created in a minute or so for a cluster with a few million files. When completed, it is written to disk both locally and remotely. Recovery needs only the latest complete checkpoint and subsequent log files. Older checkpoints and log files can be freely deleted, though they keep a few around to guard against catastrophes. A failure during checkpointing does not affect correctness because the recovery code detects and skips incomplete checkpoints. This persistence mechanism reminded me of SSTables and memtable.</p>

<p>The master does not store chunk location information persistently. Instead, it asks each chunkserver about its chunks at master startup and whenever a chunkserver joins the cluster.</p>

<hr />
<h4 id="gfs-consistency-model">GFS Consistency Model</h4>

<p>I think this section would be easier to understand if you watch MIT’s video linked above and the leases and mutation order section below.</p>

<p>A mutation is an operation that changes the contents or metadata of a chunk such as a write or an append operation. When a mutation succeeds without interference from concurrent writers, the affected region is defined (and by implication consistent): all clients will always see what the mutation has written. Concurrent successful mutations leave the region undefined but consistent: all clients see the same data, but it may not reflect what any one mutation has written. Typically, it consists of mingled fragments from multiple mutations. A failed mutation makes the region inconsistent (hence also undefined): different clients may see different data at different times.</p>

<p>Data mutations may be writes or <strong>record appends</strong>. A write (in infrequent cases, it could be an overwrite as well) causes data to be written at an application-specified file offset. A “regular” append is merely a write at an offset that the client believes to be the current end of file. Whereas a <em>record append</em> causes data (the “record”) to be appended <em>atomically at least once</em> even in the presence of concurrent mutations, but <em>at an offset of GFS’s choosing</em>. The offset is returned to the client and marks the beginning of a defined region that contains the record. In addition, GFS may insert padding or record duplicates in between. They occupy regions considered to be inconsistent and are typically dwarfed by the amount of user data.</p>

<p>After a sequence of successful mutations, the mutated file region is guaranteed to be defined and contain the data written by the last mutation. GFS achieves this by (a) applying mutations to a chunk in the same order on all its replicas, and (b) using chunk version numbers to detect any replica that has become stale because it has missed mutations while its chunkserver was down. Afterwards, these stale replicas are never involved in another mutation or given to clients asking the master for chunk locations. They are garbage collected at the earliest opportunity.</p>

<p>Readers deal with the occasional padding and duplicates as follows. Each record prepared by the writer contains extra information like checksums so that its validity can be verified. A reader can identify and discard extra padding and record fragments using the checksums. If it cannot tolerate the occasional duplicates (e.g. if they would trigger non-idempotent operations), it can filter them out using unique identifiers in the records.</p>

<hr />
<h4 id="leases-and-mutation-order">Leases and Mutation Order</h4>

<p>Each mutation is performed at all the chunk’s replicas. GFS uses leases to maintain a consistent mutation order across replicas. The master grants a chunk lease to one of the replicas, which is called the primary. The primary picks a serial order for all mutations to the chunk. All replicas follow this order when applying mutations. Thus, the global mutation order is defined first by the lease grant order chosen by the master, and within a lease by the serial numbers assigned by the primary.</p>

<p><img src="/images/ControlAndDataFlow_GFSWriteOperation.png" alt="GFS Write operation- Control and Data Flow" title="GFS Write operation- Control and Data Flow" /></p>

<ol>
  <li>The client asks the master which chunkserver holds the current lease for the chunk and the locations of the other replicas. If no one has a lease, the master grants one to a replica it chooses (not shown in the above diagram).</li>
  <li>The master replies with the identity of the primary and the locations of the other (secondary) replicas. The client caches this data for future mutations. It needs to contact the master again only when the primary becomes unreachable or replies that it no longer holds a lease.</li>
  <li>The client pushes the data to all the replicas. A client can do so in any order. Each chunkserver will store the data in an internal LRU buffer cache until the data is used or aged out. By decoupling the data flow from the control flow, we can improve performance by scheduling the expensive data flow based on the network topology regardless of which chunkserver is the primary.</li>
  <li>Once all the replicas have acknowledged receiving the data, the client sends a write request to the primary. The request identifies the data pushed earlier to all of the replicas. The primary assigns consecutive serial numbers to all the mutations it receives, possibly from multiple clients, which provides the necessary serialization. It applies the mutation to its own local state in serial number order.</li>
  <li>The primary forwards the write request to all secondary replicas. Each secondary replica applies mutations in the same serial number order assigned by the primary.</li>
  <li>The secondaries all reply to the primary indicating that they have completed the operation.</li>
  <li>The primary replies to the client. Any errors encountered at any of the replicas are reported to the client. In case of errors, the write may have succeeded at the primary and an arbitrary subset of the secondary replicas. (If it had failed at the primary, it would not have been assigned a serial number and forwarded.) The client request is considered to have failed, and the modified region is left in an inconsistent state. The client library code handles such errors by retrying the failed mutation. It will make a few attempts at steps (3) through (7) before falling back to a retry from the beginning of the write.</li>
</ol>

<p>If a write by the application is large or straddles a chunk boundary, GFS client code breaks it down into multiple write operations.</p>

<p>While control flows from the client to the primary and then to all secondaries, data is pushed linearly along a carefully picked chain of chunkservers in a pipelined fashion.</p>

<hr />
<h4 id="atomic-record-appends">Atomic Record Appends</h4>

<p>(Again MIT video may help.)
GFS provides an atomic append operation called record append. In a traditional write, the client specifies the offset at which data is to be written. Concurrent writes to the same region are not serializable: the region may end up containing data fragments from multiple clients. In a record append, however, the client specifies only the data. GFS appends it to the file at least once atomically (i.e., as one continuous sequence of bytes) at an offset of GFS’s choosing and returns that offset to the client.</p>

<p>Record append is a kind of mutation and follows the control flow in the diagram above with only a little extra logic at the primary. The client pushes the data to all replicas of the last chunk of the file. Then, it sends its request to the primary. The primary checks to see if appending the record to the current chunk would cause the chunk to exceed the maximum size (64 MB). If so, it pads the chunk to the maximum size, tells secondaries to do the same, and replies to the client indicating that the operation should be retried on the next chunk. (Record append is restricted to be at most one-fourth of the maximum chunk size to keep worst-case fragmentation at an acceptable level.) If the record fits within the maximum size, which is the common case, the primary appends the data to its replica, tells the secondaries to write the data at the exact offset where it has, and finally replies success to the client.</p>

<p>If a record append fails at any replica, the client retries the operation. As a result, replicas of the same chunk may contain different data possibly including duplicates of the same record in whole or in part. GFS does not guarantee that all replicas are bytewise identical. It only guarantees that the data is written at least once as an atomic unit. This property follows readily from the simple observation that for the operation to report success, the data must have been written at the same offset on all replicas of some chunk. Furthermore, after this, all replicas are at least as long as the end of record and therefore any future record will be assigned a higher offset or a different chunk even if a different replica later becomes the primary.</p>

<hr />
<h4 id="snapshot">Snapshot</h4>

<p>When the master receives a snapshot request, it first revokes any outstanding leases on the chunks in the files it is about to snapshot. This ensures that any subsequent writes to these chunks will require an interaction with the master to find the lease holder. This will give the master an opportunity to create a new copy of the chunk first.
After the leases have been revoked or have expired, the master logs the operation to disk. It then applies this log record to its in-memory state by duplicating the metadata for the source file or directory tree. The newly created snapshot files point to the same chunks as the source files.
The first time a client wants to write to a chunk C after the snapshot operation, it sends a request to the master to find the current lease holder. The master notices that the reference count for chunk C is greater than one. It defers replying to the client request and instead picks a new chunk handle C’. It then asks each chunkserver that has a current replica of C to create a new chunk called C’. By creating the new chunk on the same chunkservers as the original, the data can be copied locally, not over the network.</p>

<hr />
<h4 id="master-operation">Master Operation</h4>

<p>The master executes all namespace operations. In addition, it manages chunk replicas throughout the system: it makes placement decisions, creates new chunks and hence replicas, and coordinates various system-wide activities to keep chunks fully replicated, to balance load across all the chunkservers, and to reclaim unused storage.</p>

<p>GFS logically represents its namespace as a lookup table mapping full pathnames to metadata. With prefix compression, this table can be efficiently represented in memory. Each node in the namespace tree (either an absolute file name or an absolute directory name) has an associated read-write lock. One nice property of this locking scheme is that it allows concurrent mutations in the same directory. For example, multiple file creations can be executed concurrently in the same directory: each acquires a read lock on the directory name and a write lock on the file name. The read lock on the directory name suffices to prevent the directory from being deleted, renamed, or snapshotted. The write locks on file names <a href="https://atul-atul.github.io/linearizability-and-serializability/">serialize</a> attempts to create a file with the same name twice.</p>

<hr />
<h4 id="replicas-creation-re-replication-rebalancing">Replicas: Creation, Re-replication, Rebalancing</h4>

<p>Chunk replicas are created for three reasons: chunk creation, re-replication, and rebalancing.
When the master creates a chunk, it chooses where to place the initially empty replicas. It considers several factors. (1) Place new replicas on chunkservers with below-average disk space utilization. Over time this will equalize disk utilization across chunkservers. (2) Limit the number of “recent” creations on each chunkserver. Although creation itself is cheap, it reliably predicts imminent heavy write traffic because chunks are created when demanded by writes, and in append-once-read-many workload they typically become practically read-only once they have been completely written. (3) Spread replicas of a chunk across racks.</p>

<p>The master re-replicates a chunk as soon as the number of available replicas falls below a user-specified goal.</p>

<p>The master re-balances replicas periodically: it examines the current replica distribution and moves replicas for better disk space and load balancing.</p>

<hr />
<h4 id="master-replication">Master Replication</h4>

<p>If its machine or disk fails, monitoring infrastructure outside GFS starts a new master process elsewhere with the replicated write-ahead-log. Clients use only the canonical name of the master (e.g. gfs-test), which is a DNS alias that can be changed if the master is relocated to another machine.
Moreover, “shadow” masters provide read-only access to the file system even when the primary master is down. They are shadows, not mirrors, in that they may lag the primary slightly, typically fractions of a second.</p>

<hr />
<h4 id="data-integrity">Data Integrity</h4>

<p>Each chunkserver uses checksum to detect corruption of stored data.</p>

<p>A 64MB chunk is broken up into 64KB blocks. Each has a corresponding 32 bit checksum. Like other metadata, checksums are kept in chunkserver’s memory and also stored persistently with logging, separate from user data.</p>

<p>For reads, the chunkserver verifies the checksum of data blocks that overlap the read range before returning any data to the requester, whether a client or another chunkserver. Therefore chunkservers will not propagate corruptions to other machines. If a block does not match the recorded checksum, the chunkserver returns an error to the requestor and reports the mismatch to the master. In response, the requestor will read from other replicas, while the master will clone the chunk from another replica. After a valid new replica is in place, the master instructs the chunkserver that reported the mismatch to delete its replica.</p>

<p>GFS client code further reduces this overhead by trying to align reads at checksum block boundaries. Moreover, checksum lookups and comparison on the chunkserver are done without any I/O, and checksum calculation can often be overlapped with I/Os. (The optimization mentioned in the last part- overlapped with I/O- makes me sad for not getting a CS degree. How many such fine things must be going wasted on me just because I am not aware enough!)</p>

<hr />
<h4 id="some-passing-observations">Some passing observations</h4>

<p>When you are learning about distributed systems, this is one of the first papers/ systems you learn about. Not many advanced concepts are used (transactions, multi-master, paxos, for example), some trade-off are made (like on consistency). And yet a great system was designed (the paper shares some metrics of actual GFS clusters being used). In that sense it was a very simple paper. Probably, of all the tech-papers I read so far, I finished reading this the fastest. My basic familiarity with some of the concepts (thanks to having read some other papers, Designing Data Intensive Applications book, etc.) must have helped.</p>

<p>In all distributed systems, failures are <a href="https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing">far too common</a>. You probably even remember that Leslie Lamport’s quote or maybe Joe Armstrong view of the world. But from the papers which I have read/ documented on this site, only Google’s BigTable paper talked about error scenarios/ worst cases enough. Of course, all these systems, do handles failure, etc. But the papers did not talk a lot about those. Ever since reading Michael Nygard’s book ‘Release It’, that is the first thing I think about when looking at a system- how does it handle failure, is it a recovery-oriented design, etc.</p>]]></content><author><name>{&quot;name&quot;=&gt;nil, &quot;avatar&quot;=&gt;&quot;/images/ll.jpg&quot;, &quot;location&quot;=&gt;&quot;Pune, India&quot;}</name></author><category term="Distributed-Systems" /><category term="Technical-Papers" /><category term="Technical-Reading" /><category term="Tech" /><category term="Reading" /><summary type="html"><![CDATA[Here is my understanding about Google File System from reading the GFS paper. Some other references: MIT’s lecture video. I will use mostly text here- some of it is directly copied from the paper. So if you need a video walkthrough of the paper with diagrams, etc, here is a good youtube video.]]></summary></entry></feed>