<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Codereliant’s Substack]]></title><description><![CDATA[Code & Systems Simplified
]]></description><link>https://www.codereliant.io</link><image><url>https://substackcdn.com/image/fetch/$s_!LP8C!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3eb762d4-3b20-41f0-9322-649d2e8c598d_1000x1000.png</url><title>Codereliant’s Substack</title><link>https://www.codereliant.io</link></image><generator>Substack</generator><lastBuildDate>Tue, 28 Apr 2026 11:47:50 GMT</lastBuildDate><atom:link href="https://www.codereliant.io/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Codereliant]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[codereliant@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[codereliant@substack.com]]></itunes:email><itunes:name><![CDATA[Codereliant]]></itunes:name></itunes:owner><itunes:author><![CDATA[Codereliant]]></itunes:author><googleplay:owner><![CDATA[codereliant@substack.com]]></googleplay:owner><googleplay:email><![CDATA[codereliant@substack.com]]></googleplay:email><googleplay:author><![CDATA[Codereliant]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Early preview of a new Kubernetes UI]]></title><description><![CDATA[k8s dashboard that scales with your cluster]]></description><link>https://www.codereliant.io/p/new-kubernetes-ui</link><guid isPermaLink="false">https://www.codereliant.io/p/new-kubernetes-ui</guid><pubDate>Tue, 27 Aug 2024 14:29:57 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ppDf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ppDf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png 424w, https://substackcdn.com/image/fetch/$s_!ppDf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png 848w, https://substackcdn.com/image/fetch/$s_!ppDf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png 1272w, https://substackcdn.com/image/fetch/$s_!ppDf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ppDf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png" width="1140" height="529" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:529,&quot;width&quot;:1140,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:89556,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ppDf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png 424w, https://substackcdn.com/image/fetch/$s_!ppDf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png 848w, https://substackcdn.com/image/fetch/$s_!ppDf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png 1272w, https://substackcdn.com/image/fetch/$s_!ppDf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffd947b22-9786-42b7-adda-f57be07f63cc_1140x529.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>Hey Codereliant friends!</p><p>Our team was busy creating the new AI-powered Kubernetes UI project, born from our experience managing 5,000 node clusters. Introducing <code>Kubeintel</code>!</p><p>TLDR;</p><p>&#128640; Try the live demo (no registration required):&nbsp;<a href="https://demo.kubeintel.io/search">https://demo.kubeintel.io/search</a></p><p>&#128279; Learn more:&nbsp;<a href="https://kubeintel.io/">https://kubeintel.io/</a></p><p>&#128276; Join the waitlist:&nbsp;<a href="https://kubeintel.io/waitlist">https://kubeintel.io/waitlist</a></p><p>&#127909; Video introduction:</p><div><hr></div><p>Many current Kubernetes UIs struggle with large clusters due to:</p><ul><li><p>Poor scalability: Not designed for 1000+ node clusters, leading to performance issues for both control plane and client-side operations. Issues include inefficient querying, excessive data fetching, lack of caching, and high API server load.</p></li><li><p>Limited search capabilities: Requiring precise knowledge (e.g., namespace or deployment name) or resorting to slow and heavy cluster-wide queries (<code>kubectl get pods -A</code> sound familiar?).</p></li><li><p>The lack of AI-powered troubleshooting tools creates substantial additional work for infrastructure, platform, &amp; dev teams.</p></li></ul><p>Consequently, many teams fall back to using terminals for cluster and workload navigation. We began developing Kubeintel a few months ago to address these challenges.</p><p>Key features:</p><ul><li><p>Lightning-fast UI and resource search - scaling seamlessly from 10 to 5000+ node clusters</p></li><li><p>Intelligent full-text search - typo-tolerant for effortless resource discovery</p></li><li><p>Near-zero control plane overhead - utilizing an internal embedded database instead of constant K8s API queries</p></li><li><p>AI-powered insights and troubleshooting - leveraging popular LLMs (OpenAI, Anthropic, Gemini, Ollama) to diagnose resource issues, such as pod crashes.</p></li></ul><div><hr></div><p>This is an early preview, and we want to hear from you. We'd love your feedback:</p><ul><li><p>What specific pain points in your K8s workflow would you like addressed?</p></li><li><p>How does Kubeintel compare to your current cluster navigation tools?</p></li><li><p>What features would you like to see added?</p></li></ul><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join our newsletter to stay up to date!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Critical "RegreSSHion" discovered]]></title><description><![CDATA[Honey wake up, the new SSH vulnerability just dropped.]]></description><link>https://www.codereliant.io/p/sshd-regression</link><guid isPermaLink="false">https://www.codereliant.io/p/sshd-regression</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Thu, 04 Jul 2024 20:22:29 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/01041dfa-7fbd-4a71-8e62-e25ddfce218a_2000x1339.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0MHl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0MHl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg 424w, https://substackcdn.com/image/fetch/$s_!0MHl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg 848w, https://substackcdn.com/image/fetch/$s_!0MHl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!0MHl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0MHl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/badddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0MHl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg 424w, https://substackcdn.com/image/fetch/$s_!0MHl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg 848w, https://substackcdn.com/image/fetch/$s_!0MHl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!0MHl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbadddb9c-5820-48f5-87c9-54fe36a99a31_2000x1339.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@marcel_eberle?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Marcel Eberle</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p><strong>Honey wake up, the new SSH vulnerability just dropped.</strong></p><p>A new high-severity vulnerability in OpenSSH, dubbed "regreSSHion" (<a href="https://www.cve.org/CVERecord?id=CVE-2024-6387">CVE-2024-6387)</a>, has been discovered couple days ago. This flaw affects OpenSSH servers on glibc-based Linux systems and could allow unauthenticated remote code execution with root privileges.</p><p><strong>What you need to know:</strong></p><ul><li><p>The vulnerability impacts OpenSSH versions 8.5p1 to 9.7p1, as well as versions earlier than 4.4p1 (if not patched for older CVEs).</p></li><li><p>Over 14 million potentially vulnerable instances are exposed to the internet.</p></li><li><p>While there's no known exploitation in the wild yet, a working exploit has been developed by researchers. The complexity of the exploit might delay widespread attacks, but it's important to act quickly.</p></li></ul><p><strong>Action items:</strong></p><ol><li><p>Update all OpenSSH instances to <a href="https://www.openssh.com/releasenotes.html">version 9.8p1</a> or later ASAP.</p></li><li><p>If immediate patching isn't possible, set LoginGraceTime to 0 in the sshd config file as a temporary mitigation.</p></li><li><p>Reduce the number of internet-facing sshd servers where possible to be less prone to Zero-day issues like this one.</p></li></ol><p>If you want to know more you can check out the <a href="https://blog.qualys.com/vulnerabilities-threat-research/2024/07/01/regresshion-remote-unauthenticated-code-execution-vulnerability-in-openssh-server">deep dive</a> by Qualys Threat Research Unit, who discovered and reported the issue. Stay secure!</p><blockquote><p>In our security analysis, we identified that this vulnerability is a regression of the previously patched vulnerability CVE-2006-5051, which was reported in 2006. A regression in this context means that a flaw, once fixed, has reappeared in a subsequent software release, typically due to changes or updates that inadvertently reintroduce the issue.</p></blockquote><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join our newsletter for weekly tips and news</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[From Makefiles to Taskfiles]]></title><description><![CDATA[The good old make command has been around for ages.]]></description><link>https://www.codereliant.io/p/from-makefiles-to-taskfiles</link><guid isPermaLink="false">https://www.codereliant.io/p/from-makefiles-to-taskfiles</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Thu, 13 Jun 2024 00:58:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/699f66fc-51a0-4bbe-b53a-027858c0e472_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!uZpY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!uZpY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!uZpY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!uZpY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!uZpY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!uZpY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!uZpY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!uZpY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!uZpY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!uZpY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa13c0c6a-18e1-42b2-b39b-ac6a68deba80_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@lennykuhne?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Lenny Kuhne</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>The good old <code>make</code> command has been around for ages. It helps us compile code, build projects, run tests and automate all sorts of tasks. As projects grow, Makefiles can become hard to use. The syntax, while simple, can get cryptic with complex rules and conditionals. Debugging Makefiles is no fun either. Error messages from <code>make</code> can be hard to decipher, making it tough to figure out what went wrong. A single space in the wrong place can result in <code>Makefile:42: *** commands commence before first target. Stop.</code> &#128556;</p><p>Meet <a href="https://taskfile.dev/">Taskfile</a> - a task runner tool that aims to be simpler and easier to use than Makefile</p><h3>What's Taskfile?</h3><p>A Taskfile is essentially a configuration file for the Task tool. It uses a YAML-based syntax, which is both human-readable and easy to write. Instead of the somewhat cryptic syntax of Makefiles, Taskfiles are structured and clear. This makes them easier to maintain and understand, especially for new team members.</p><p>Let&#8217;s take a look at some of the key features:</p><ul><li><p><strong>Cross-Platform Compatibility</strong> - one of the coolest things about Taskfiles is their cross-platform support. You write a Taskfile once, and it works on any system that has the Task tool installed, even Windows!</p></li><li><p><strong>Built-in Dependency Management</strong> - similar to Makefile, Taskfiles offer built-in support for dependencies. You can define which tasks depend on others, ensuring that tasks run in the correct order.</p></li><li><p><strong>Parallel Execution - </strong>you can easily specify tasks to run in parallel, which can significantly speed up your build and deployment processes</p></li><li><p><strong>Templating and Variable Substitution</strong> - you can define variables and templates directly in your Taskfile, making your task definitions more dynamic and reusable.</p></li><li><p><strong>Simplicity and Readability - </strong>YAML readability makes it easy for anyone on your team to understand and modify the Taskfile.</p></li></ul><h3>Let's try it</h3><p>Grab the project you are currently working on and let's try Taskfile in action</p><p>First we install it and create a simple <code>Taskfile.yml</code></p><pre><code>$ brew install go-task
$ vim Taskfile.yml # or task --init</code></pre><p>As mentioned above it uses simple Yaml schema. Let's start simple by defining a few basic tasks. Here&#8217;s an example:</p><pre><code>version: '3'

tasks:
  build:
    cmds:
      - go build ./...
  test:
    cmds:
      - go test ./...
</code></pre><p>Here we basically define build and test tasks similar to how you will do in a Makefile. Next you likely would need to define some dependencies, like so</p><pre><code>version: '3'

tasks:
  build:
    desc: Build the project
    cmds:
      - go build ./...
  test:
    desc: Test the project
    deps: [build]
    cmds:
      - go test ./...</code></pre><p><em>Note</em>: dependencies run in parallel, so dependencies of a task <strong>should not</strong> depend on one another.</p><p>Let's run it! You can view all available tasks by executing <code>task --list-all</code></p><pre><code>$ task --list-all
task: Available tasks for this project:
* build: Build the project
* test: Test the project

$ task build
task: [build] go build ./...

$ task test
task: [build] go build ./...
task: [test] go test ./...</code></pre><p>Your first taskfile is ready to go!</p><h3>Let's extend it more</h3><p>Now that we have hello world Taskfile, let's extend it further. In the example below we add:</p><ul><li><p><code>vars</code> - which can be interpolated and reused across all the tasks</p></li><li><p><code>env</code> - which are env variables passed to all the tasks</p></li><li><p><code>sources</code> - when given, task will compare the checksum of the source files to determine if it's necessary to run the task (to avoid unnecessary build execution for example)</p></li></ul><pre><code>version: '3'

env:
  GOFLAGS: -mod=mod

vars:
  goTestArgs: -v

tasks:
  build:
    desc: Build the project
    cmds:
      - go build ./...
  test:
    desc: Test the project
    deps: [build]
    cmds:
      - go test {{.goTestArgs}} ./...</code></pre><p><code>env</code> and <code>vars</code> here are set on the global level, but you can also do the same on the task level for better flexibility.</p><p>What else can you do with Taskfiles:</p><ul><li><p>Including other Taskfiles (e.g. OS specific)</p></li><li><p>Loop over variables/tasks and even use Go's template engine</p></li><li><p>Do task cleanups using <code>defer</code> functionality</p></li><li><p>Use a dry-run mode</p></li></ul><p>and more!</p><h3>Conclusion</h3><p>Go ahead, give Taskfiles a try. It's powerful, flexible and can simplify your build and automation processes. Want to see how others in open source use it? Here is sourcegraph <a href="https://sourcegraph.com/search?q=context:global+file:%5ETaskfile%5C.yml%24&amp;patternType=keyword&amp;sm=0">link</a> to find good examples!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Codereliant&#8217;s Substack! Subscribe for free to receive new posts and support our work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Profiling ArgoCD with Pprof]]></title><description><![CDATA[One of the things I love about engineering is the endless puzzles it throws our way.]]></description><link>https://www.codereliant.io/p/profiling-argocd-with-pprof</link><guid isPermaLink="false">https://www.codereliant.io/p/profiling-argocd-with-pprof</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Mon, 03 Jun 2024 16:18:50 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZFbr!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZFbr!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png 424w, https://substackcdn.com/image/fetch/$s_!ZFbr!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png 848w, https://substackcdn.com/image/fetch/$s_!ZFbr!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png 1272w, https://substackcdn.com/image/fetch/$s_!ZFbr!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZFbr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png" width="788" height="376" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:376,&quot;width&quot;:788,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:104728,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZFbr!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png 424w, https://substackcdn.com/image/fetch/$s_!ZFbr!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png 848w, https://substackcdn.com/image/fetch/$s_!ZFbr!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png 1272w, https://substackcdn.com/image/fetch/$s_!ZFbr!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6708fa4c-479e-4347-95dd-dde23bbddfb6_788x376.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>One of the things I love about engineering is the endless puzzles it throws our way. I can easily be carried away by a single unexpected performance degradation of a service, because it's so fun!</p><p>Recently we experienced one of these cases with <a href="https://argo-cd.readthedocs.io/en/stable/">ArgoCD</a>, a continuous delivery tool for Kubernetes clusters.</p><h3>Problem</h3><p>As a part of the ArgoCD adoption we deployed it to the huge Kubernetes cluster, with ~<em>5,000 physical nodes</em> and <em>hundreds of thousands of resources</em>. Upon using it we noticed that ArgoCD status updates and reconciliation performance were noticeably slower than on smaller clusters.</p><p>It was visible on the metrics as well, internal workqueue was always high:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sk1A!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sk1A!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png 424w, https://substackcdn.com/image/fetch/$s_!sk1A!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png 848w, https://substackcdn.com/image/fetch/$s_!sk1A!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png 1272w, https://substackcdn.com/image/fetch/$s_!sk1A!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sk1A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png" width="1374" height="1074" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1074,&quot;width&quot;:1374,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;ArgoCD workqueue&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="ArgoCD workqueue" title="ArgoCD workqueue" srcset="https://substackcdn.com/image/fetch/$s_!sk1A!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png 424w, https://substackcdn.com/image/fetch/$s_!sk1A!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png 848w, https://substackcdn.com/image/fetch/$s_!sk1A!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png 1272w, https://substackcdn.com/image/fetch/$s_!sk1A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F44eef45e-ff5b-445c-94ec-a6c8980c1f0c_1374x1074.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The reconciliation performance heatmap showed consistently high reconciliation times for all of our applications:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!m3Nx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!m3Nx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png 424w, https://substackcdn.com/image/fetch/$s_!m3Nx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png 848w, https://substackcdn.com/image/fetch/$s_!m3Nx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png 1272w, https://substackcdn.com/image/fetch/$s_!m3Nx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!m3Nx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png" width="1373" height="680" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:680,&quot;width&quot;:1373,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;ArgoCD reconciliation&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="ArgoCD reconciliation" title="ArgoCD reconciliation" srcset="https://substackcdn.com/image/fetch/$s_!m3Nx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png 424w, https://substackcdn.com/image/fetch/$s_!m3Nx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png 848w, https://substackcdn.com/image/fetch/$s_!m3Nx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png 1272w, https://substackcdn.com/image/fetch/$s_!m3Nx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88a3c29d-ba73-4326-b217-e464ab0436e9_1373x680.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Upon closer look we figured out that the actual resource sync goes pretty fast, but the status updates in the UI and in the CRD was taking <em>minutes</em> to complete. Based <a href="https://github.com/argoproj/argo-cd/blob/v2.10.11/controller/appcontroller.go#L817">on the code</a> it's done by using so-called "status processors", like so</p><pre><code>&#9;for i := 0; i &lt; statusProcessors; i++ {
&#9;&#9;go wait.Until(func() {
&#9;&#9;&#9;for ctrl.processAppRefreshQueueItem() {
&#9;&#9;&#9;}
&#9;&#9;}, time.Second, ctx.Done())
&#9;}</code></pre><p>This would be an important detail later.</p><h3>Fix Attempt #1</h3><p>As a first attempt we relied on community knowledge to configure ArgoCD for larger scale. Some great material you can find <a href="https://argo-cd.readthedocs.io/en/stable/operator-manual/high_availability/">here</a> and <a href="https://aws.amazon.com/blogs/opensource/argo-cd-application-controller-scalability-testing-on-amazon-eks/">here</a>. Things we tried:</p><ul><li><p>Bumped <code>controller.status.processors</code> and <code>controller.operation.processors</code> to recommended higher values</p></li><li><p>Bumped controller/repo-server/server resource requests/limits to the point where it no longer was throttled or OOMed</p></li><li><p>Bumped clientQPS and burstQPS</p></li><li><p>Bumped repo-server/server replicas</p></li></ul><p>We use one argocd instance per cluster, so we left sharding capabilities untouched, because it would have no impact on our setup. Unfortunately nothing from the list above helped and arguably made things <em>slightly worse</em> &#129300;</p><h3>Let's look closer</h3><p>If you get stuck with anything performance related in golang, <a href="https://github.com/google/pprof">pprof</a> is your best friend. We discussed it in details in our <a href="https://www.codereliant.io/p/memory-leaks-with-pprof">Debug Golang Memory Leaks</a> newsletter issue some time ago - how to run it, how to read flamegraphs, available profiling data, etc. Check it out if you need a refresher.</p><p>ArgoCD has pprof endpoint enabled by default, which is convenient (but make sure to not expose it to untrusted networks, as your infosec team might knock on your door)</p><p>First I wanted to look at why it uses ~4 CPU cores and ~8 Gbs of memory to operate. Depending on how your argocd is setup, you should be able to do something like this to get access to the CPU profiling information.</p><pre><code>$ kubectl port-forward pod/argocd-application-controller-0 8082  -n argocd
$ go tool pprof -http=localhost:8080 localhost:8082/debug/pprof/profile?seconds=5</code></pre><p>It will open the web UI and by navigating to the flamegraphs I found this</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!P-PT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P-PT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png 424w, https://substackcdn.com/image/fetch/$s_!P-PT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png 848w, https://substackcdn.com/image/fetch/$s_!P-PT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png 1272w, https://substackcdn.com/image/fetch/$s_!P-PT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!P-PT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png" width="1160" height="376" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:376,&quot;width&quot;:1160,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;ArgoCD profiling&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="ArgoCD profiling" title="ArgoCD profiling" srcset="https://substackcdn.com/image/fetch/$s_!P-PT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png 424w, https://substackcdn.com/image/fetch/$s_!P-PT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png 848w, https://substackcdn.com/image/fetch/$s_!P-PT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png 1272w, https://substackcdn.com/image/fetch/$s_!P-PT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1a15390b-95d4-4ef1-98af-20648c3308a9_1160x376.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This flamegraph basically shows that most of the CPU cycles spent in <code>processAppRefreshQueueItem</code>, which is exactly the functionality we see lagging. Looking further down the stack we can see that CPU is wasted on iterating through the hierarchy of resources that are located in ArgoCD cache implementation.</p><h3>Fix Attempt #2</h3><p>Looking at the code we can see that controller <a href="https://github.com/argoproj/gitops-engine/blob/v0.7.3/pkg/cache/cluster.go#L854">builds</a> a cache of all the resources that are in the cluster and maintains the "internal view" of a cluster in order to be able to accurately compare the state of resources in the cluster with the desired state in Git. That comes with the caveat - even though you might have a handful of applications and couple hundreds resources in them, ArgoCD will cache all resources that exist in your cluster, even if it won't ever use them. To confirm this we can look into the "Resource Objects Count" in cache:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7Azj!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7Azj!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png 424w, https://substackcdn.com/image/fetch/$s_!7Azj!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png 848w, https://substackcdn.com/image/fetch/$s_!7Azj!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png 1272w, https://substackcdn.com/image/fetch/$s_!7Azj!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!7Azj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png" width="1456" height="312" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:312,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;ArgoCD object count&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="ArgoCD object count" title="ArgoCD object count" srcset="https://substackcdn.com/image/fetch/$s_!7Azj!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png 424w, https://substackcdn.com/image/fetch/$s_!7Azj!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png 848w, https://substackcdn.com/image/fetch/$s_!7Azj!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png 1272w, https://substackcdn.com/image/fetch/$s_!7Azj!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6177c7b8-5b74-4f10-9ce6-714ed78931f9_2000x428.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>As you can see it has ~370k resources and ArgoCD spends a lot of time processing through these, so it can explain the slow processing, high CPU and high memory.</p><p>So what if we reduce the amount of resources ArgoCD keeps in cache by removing things we don't need? Then the status update performance and resource utilization should improve.</p><p>You can configure <code>resource exclusion</code> <a href="https://argo-cd.readthedocs.io/en/stable/operator-manual/declarative-setup/#resource-exclusioninclusion">like so</a>:</p><pre><code>    resource.exclusions: |
      - apiGroups:
          - autoscaling.k8s.io
        kinds:
          - '*'
        clusters:
          - '*'
      - apiGroups:
          - discovery.k8s.io
        kinds:
          - EndpointSlice
        clusters:
          - '*'
...</code></pre><p>After doing the above and excluding resources we don't care about, here are the results:</p><ul><li><p>The amount of resources in cache <strong>reduced 3x</strong> to ~100k</p></li><li><p>Memory usage <strong>reduced 5x</strong></p></li><li><p>Avg CPU usage <strong>reduced by 2x</strong></p></li><li><p>Reconciliation speed improved, but only slightly, maybe by 10% &#128546;</p></li></ul><p>We were back to square one</p><h3>Let's dig more</h3><p>Another useful feature pprof has is ability to take goroutine dumps. You can do so by querying the pprof endpoint like so:</p><pre><code># full goroutine dump
$ curl 'localhost:8082/debug/pprof/goroutine?debug=2'

# "grouped" view
$ curl 'localhost:8082/debug/pprof/goroutine?debug=2'</code></pre><p>I was looking for <code>processAppRefreshQueueItem</code> to understand where it gets stuck.</p><p>The goroutine dump would look something like so for this call:</p><pre><code>#&#9;0x46dba4&#9;sync.runtime_SemacquireRWMutexR+0x24&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;/usr/local/go/src/runtime/sema.go:82
#&#9;0x1eec619&#9;sync.(*RWMutex).RLock+0x99&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;/usr/local/go/src/sync/rwmutex.go:71
#&#9;0x1eec5f4&#9;github.com/argoproj/gitops-engine/pkg/cache.(*clusterCache).IterateHierarchy+0x74&#9;&#9;&#9;/go/pkg/mod/github.com/argoproj/gitops-engine@v0.7.1-0.20240122213038-792124280fcc/pkg/cache/cluster.go:972
#&#9;0x2259aa4&#9;github.com/argoproj/argo-cd/v2/controller/cache.(*liveStateCache).IterateHierarchy+0xc4&#9;&#9;&#9;/go/src/github.com/argoproj/argo-cd/controller/cache/cache.go:604
#&#9;0x22c43c2&#9;github.com/argoproj/argo-cd/v2/controller.(*ApplicationController).getResourceTree+0x782&#9;&#9;/go/src/github.com/argoproj/argo-cd/controller/appcontroller.go:535
#&#9;0x22c3675&#9;github.com/argoproj/argo-cd/v2/controller.(*ApplicationController).setAppManagedResources+0x95&#9;&#9;/go/src/github.com/argoproj/argo-cd/controller/appcontroller.go:455
#&#9;0x22d04b6&#9;github.com/argoproj/argo-cd/v2/controller.(*ApplicationController).processAppRefreshQueueItem+0x14b6&#9;/go/src/github.com/argoproj/argo-cd/controller/appcontroller.go:1596
#&#9;0x22c83c4&#9;github.com/argoproj/argo-cd/v2/controller.(*ApplicationController).Run.func3+0x24&#9;&#9;&#9;/go/src/github.com/argoproj/argo-cd/controller/appcontroller.go:819
#&#9;0x12fda52&#9;k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1+0x32&#9;&#9;&#9;&#9;&#9;&#9;/go/pkg/mod/k8s.io/apimachinery@v0.26.11/pkg/util/wait/wait.go:157
#&#9;0x12fd90e&#9;k8s.io/apimachinery/pkg/util/wait.BackoffUntil+0xae&#9;&#9;&#9;&#9;&#9;&#9;&#9;/go/pkg/mod/k8s.io/apimachinery@v0.26.11/pkg/util/wait/wait.go:158
#&#9;0x12fd7fe&#9;k8s.io/apimachinery/pkg/util/wait.JitterUntil+0x7e&#9;&#9;&#9;&#9;&#9;&#9;&#9;/go/pkg/mod/k8s.io/apimachinery@v0.26.11/pkg/util/wait/wait.go:135
#&#9;0x12fd73d&#9;k8s.io/apimachinery/pkg/util/wait.Until+0x1d&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;/go/pkg/mod/k8s.io/apimachinery@v0.26.11/pkg/util/wait/wait.go:92</code></pre><p>As you can see this goroutine is stuck waiting on <code>sync.(*RWMutex).RLock</code> at the top of the stack.</p><p>By taking look at grouped view the problem I had &#128161; moment: 49/50 status processors were waiting on the lock, so it was a <strong>lock contention problem</strong>:</p><ul><li><p>24 goroutines blocked on&nbsp;<code>github.com/argoproj/gitops-engine/pkg/cache.(*clusterCache).IterateHierarchy</code></p></li><li><p>14 goroutines blocked on&nbsp;<code>github.com/argoproj/gitops-engine/pkg/cache.(*clusterCache).GetAPIResources</code></p></li><li><p>6 goroutines blocked on&nbsp;<code>github.com/argoproj/gitops-engine/pkg/cache.(*clusterCache).GetManagedLiveObjs</code></p></li><li><p>5 goroutines blocked on&nbsp;<code>github.com/argoproj/gitops-engine/pkg/cache.(*clusterCache).FindResources</code></p></li><li><p>1 active on&nbsp;<code>github.com/argoproj/gitops-engine/pkg/cache.(*Resource).iterateChildren</code></p></li></ul><p>Unfortunately in golang there is no easy way to understand who is holding the lock, but going through the <a href="https://github.com/argoproj/gitops-engine/blob/v0.6.2/pkg/cache/cluster.go">code</a> it's likely related to the watch, which updates the cache on k8s resources updates. In large clusters, where resource updates occur frequently, this lock contention could explain the performance issues.</p><h3>Fix Attempt #3</h3><p>We were running ArgoCD 2.5 and I found two issues related to locks (<a href="https://github.com/argoproj/gitops-engine/pull/543">1</a> and <a href="https://github.com/argoproj/gitops-engine/pull/539">2</a>). The first one was to likely improve the lock contention cause it removes unnecessary lock from <code>GetAPIResources</code> call, which we saw occupying significant amount of goroutines.</p><p>So we upgraded to ArgoCD 2.10 and confirmed that <code>GetAPIResources</code> no longer waits for a lock &#128640;</p><p>The reconcile speed improved... <strong>somewhat </strong>&#128532;. The workqueue visibly reduced on the graphs during low pod churn periods, but still took minutes when a lot of pods being scheduled.</p><p>Taking a fresh goroutine dump:</p><ul><li><p>36 goroutines blocked on <code>github.com/argoproj/gitops-engine/pkg/cache.(*clusterCache).IterateHierarchy</code></p></li><li><p>10 goroutines blocked on <code>github.com/argoproj/gitops-engine/pkg/cache.(*clusterCache).GetManagedLiveObjs</code></p></li><li><p>3 goroutines blocked on <code>github.com/argoproj/gitops-engine/pkg/cache.(*clusterCache).FindResources</code></p></li><li><p>1 active on&nbsp;<code>github.com/argoproj/gitops-engine/pkg/cache.(*Resource).iterateChildren</code></p></li></ul><p>So the lock contention was just skewed towards <code>IterateHierarchy</code> call. Ugh!</p><h3>Next Steps</h3><p>So after trying all of the above solutions we are down to two options at this point, which were a last resort but will address the performance issues we were seeing</p><ul><li><p>Significantly bump <a href="https://argo-cd.readthedocs.io/en/stable/faq/#how-often-does-argo-cd-check-for-changes-to-my-git-or-helm-repository">reconciliation timeout</a> from 45s to 5 minutes or more. This will reduce the workqueue size, since applications would be time queued less often</p></li><li><p><a href="https://argo-cd.readthedocs.io/en/stable/operator-manual/reconcile/">Filter out</a> resource updates not related to the "change in desired state of application". By default, an ArgoCD application is refreshed every time a resource that belongs to it changes. So if we filter out not-so-important, but frequently updated fields like <code>/status</code> we can also reduce the workqueue size and improve speed.</p></li></ul><div><hr></div><p>In conclusion, troubleshooting performance issues in complex systems can be challenging, but with the right tools and approach, it can also be a rewarding learning experience. Hope you enjoyed this deep dive! &#128373;&#65039;</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Codereliant&#8217;s Substack! Subscribe for free to receive new posts and support our work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[SRECon24 Report]]></title><description><![CDATA[SRECon has gathered SRE and systems engineers in March this year, but if you missed it - talks were recently uploaded to youtube on Usenix channel.]]></description><link>https://www.codereliant.io/p/srecon24-report</link><guid isPermaLink="false">https://www.codereliant.io/p/srecon24-report</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Mon, 06 May 2024 15:20:27 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/67a14382-39c1-4af3-858b-1b307a8c9540_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Q1A_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Q1A_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Q1A_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Q1A_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Q1A_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Q1A_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Q1A_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Q1A_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Q1A_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Q1A_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F78010c54-ffc0-4a0d-a7ba-57cf0806bb6c_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@headwayio?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Headway</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p><a href="https://www.usenix.org/conference/srecon24americas">SRECon</a> has gathered SRE and systems engineers in March this year, but if you missed it - talks were recently uploaded to youtube on <a href="https://www.youtube.com/@UsenixOrg">Usenix channel</a>.</p><p>Here is Codereliant's <strong>Top 5</strong> recommendations of what to watch:</p><blockquote><p>&#128214; <strong><a href="https://www.youtube.com/watch?v=XSsrafnpvxU&amp;ab_channel=USENIX">Product Reliability for Google Maps</a></strong><br><em>Micah Lerner and Joe Abrams</em></p></blockquote><p>Learn how Google Maps, the app with over 1 billion monthly users, tackled subtle user experience issues that traditional server monitoring couldn't catch. Learn about their journey towards <strong>user-centric reliability</strong> and the lessons they learned along the way.</p><blockquote><p>&#128214; <strong><a href="https://www.youtube.com/watch?v=pVXSLTGzNLw&amp;ab_channel=USENIX">Sharding: Growing Systems from Node-scale to Planet-scale</a></strong><br><em>Adam Mckaig</em></p></blockquote><p>This talk goes deep into workload sharding: when it makes sense, what problem it has, and how it can solve common scalability and reliability issues in your systems. You will learn fundamental sharding patterns like worker pools, read replicas, horizontal and vertical sharding, and multi-cell/multi-region architectures.</p><blockquote><p>&#128214; <strong><a href="https://www.youtube.com/watch?v=X21uSjIMuHE&amp;ab_channel=USENIX">Teaching SRE</a></strong><br><em>Mikey Dickerson</em></p></blockquote><p>This talk has an interesting insights into training a new wave of system engineers. The author designed and taught a class for computer science majors called "Managing Complex Systems". Students work on a project, progressing through a series of assignments that cover key SRE topics such as setting up infrastructure, monitoring, on-call rotations, capacity planning, incident response, etc.</p><blockquote><p>&#128214; <strong><a href="https://www.youtube.com/watch?v=HSoPidn_32s&amp;ab_channel=USENIX">Deciphering Cache Inconsistencies in a Distributed Environment</a></strong><br><em>Akashdeep Goel and Prudhviraj Karumanchi</em></p></blockquote><p>Probably every SRE has their "caching" story. Engineers from Netflix share their experience debugging a critical issue with their distributed, replicated key-value store called EVCache, which threatened to delay a major global product launch. The incident walkthrough highlights the challenges and rewards of operating and troubleshooting large-scale distributed systems in a high-stakes production environment.</p><blockquote><p>&#128214; <strong><a href="https://www.youtube.com/watch?v=jVTf5WsHkH8&amp;ab_channel=USENIX">Meeting the Challenge of Burnout</a></strong><br><em>Christina Maslach</em></p></blockquote><p>While this is not a technical talk, I think we don't talk about this topic enough. A pioneering researcher on<strong> </strong>job burnout, clarifies the concept of burnout, its causes, and potential solutions. She emphasizes that burnout is an <strong>occupational phenomenon</strong> resulting from chronic workplace stressors that have not been successfully managed, rather than an individual medical condition.</p><div><hr></div><p>Hey there, reader! &#128075;</p><p>You know what they say, sharing is caring! If you found this newsletter helpful please take a moment to share it with your friends, colleagues and social media followers. Thanks for being a part of this community! &#128640;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.codereliant.io/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Keep Scripts Running Forever]]></title><description><![CDATA[Whether you're automating processes, managing server chores, or just experimenting; you often need a way to keep your scripts running after disconnect or indefinitely.]]></description><link>https://www.codereliant.io/p/keep-scripts-running-forever</link><guid isPermaLink="false">https://www.codereliant.io/p/keep-scripts-running-forever</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Tue, 30 Apr 2024 12:51:35 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/a22a3553-54b8-49f6-a23c-67fa7ae384e4_2000x1500.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Hn4b!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Hn4b!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Hn4b!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Hn4b!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Hn4b!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Hn4b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Hn4b!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Hn4b!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Hn4b!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Hn4b!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec949008-8d76-492b-9551-446fb0f05894_2000x1500.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@6heinz3r?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Gabriel Heinzer</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>Whether you're automating processes, managing server chores, or just experimenting; you often need a way to keep your scripts running after disconnect or indefinitely. I see people using mostly <code>nohup</code> &amp; <code>screen</code> for this, but there are some other tools available as well.</p><p>Let's discuss the less well-known but convenient ways to run scripts or commands on a Linux machine forever&#8212;even after logging out&#8212;in this blog post.</p><p>But first, let's us do a refresher of known methods:</p><blockquote><p>1&#65039;&#8419; <strong><a href="https://linux.die.net/man/1/nohup">nohup</a></strong></p></blockquote><pre><code>nohup while true; do dig codereliant.io NS; sleep 1; done &amp;
</code></pre><p>This command uses <code>nohup</code> to ignore the HUP (hangup) signal, which is sent to the process when the user logs out. The output of the command will be redirected to a file named <code>nohup.out</code> by default, unless you specify otherwise.</p><p>The command <code>while true; do dig codereliant.io NS; sleep 1; done</code> is a loop that continuously runs the <code>dig</code> command to retrieve the NS records for the domain <code>codereliant.io</code>, with a 1-second delay between each query. And we will use this as an example throughout the post.</p><blockquote><p>2&#65039;&#8419; <strong><a href="https://linux.die.net/man/1/screen">screen</a></strong> or <strong><a href="https://man7.org/linux/man-pages/man1/tmux.1.html">tmux</a></strong></p></blockquote><p>Alternatively, using <code>screen</code> or <code>tmux</code> can be very effective. These tools allow you to start a session, run the command, and then detach from the session while leaving it running on the server.</p><ol><li><p>Start a new <code>screen</code> or <code>tmux</code> session:</p></li></ol><pre><code>screen
</code></pre><ol start="2"><li><p>Run your command</p></li></ol><pre><code>while true; do dig codereliant.io NS; sleep 1; done</code></pre><ol start="3"><li><p>Detach from the screen session by pressing <code>Ctrl-A</code> followed by <code>D</code>.</p></li></ol><p>This way, the process will keep running in the background inside the screen session, even if you log out, and you can reattach to it later if needed.</p><p>For <strong>tmux</strong>, you use <code>tmux</code> to start a new session, and <code>Ctrl-B</code> followed by <code>D</code> to detach from the screen.</p><blockquote><p>3&#65039;&#8419; <strong><a href="https://linuxcommand.org/lc3_man_pages/disownh.html">disown</a></strong></p></blockquote><p>Sometimes in a machine or mostly in a running docker container you might not have <code>nohup</code>, <code>screen</code>, or <code>tmux</code> installed, you can use another approach to keep your command running in the background even after you log out or detach from the container by using the shell's job control features along with redirection of outputs to avoid the terminal sending a <code>HUP</code> (hangup) signal.</p><p>The <code>disown</code> command in bash removes a shell job from the shell's job table, making it immune to the <code>HUP</code> signal when you log out. Here&#8217;s how you can use it:</p><ol><li><p>Start the process in the background as usual:</p></li></ol><pre><code>while true; do dig codereliant.io NS; sleep 1; done &amp;</code></pre><ol start="2"><li><p>Then you can use <code>jobs -l</code> to see the running jobs and their job numbers.</p></li><li><p>Use <code>disown</code> with the job number to remove the job from the shell&#8217;s job table:</p></li></ol><pre><code>disown %1
</code></pre><ol start="4"><li><p>Replace <code>%1</code> with the actual job number if it's different.</p></li></ol><blockquote><p>4&#65039;&#8419; <strong><a href="https://man7.org/linux/man-pages/man1/setsid.1.html">setsid</a></strong></p></blockquote><p>Another tool you might have available is <code>setsid</code>, which runs a program in a new session. This means the program will not be tied to the terminal session and will continue running after logout:</p><pre><code>setsid sh -c 'while true; do dig codereliant.io NS; sleep 1; done' &amp;
</code></pre><p>This command wraps your loop in a <code>sh -c</code> command string, ensuring it can handle the loop syntax correctly, and starts it in a new session using <code>setsid</code>.</p><h3>Redirecting Outputs</h3><p>In all these cases, it&#8217;s a good idea to redirect stdout and stderr to a file or <code>/dev/null</code> to prevent the process from trying to write to a non-existent terminal, which could cause it to stop:</p><pre><code>while true; do dig codereliant.io NS; sleep 1; done &gt;/dev/null 2&gt;&amp;1 &amp;
</code></pre><p>Adding <code>&gt;/dev/null 2&gt;&amp;1</code> redirects both the standard output and the standard error to <code>/dev/null</code>, effectively discarding all output.</p><p>Using any of these methods, you should be able to run your command in the background effectively without having traditional utilities like <code>nohup</code> or <code>screen</code>.</p><p>If you liked this post and want to learn more about similar concepts, subscribe to our newsletter! We'll keep you updated with more tips, tricks, and in-depth guides to ensure you're always a step ahead in managing your technology.</p><div><hr></div><p>Hey there, reader! &#128075;</p><p>You know what they say, sharing is caring! If you found this newsletter helpful please take a moment to share it with your friends, colleagues and social media followers. Thanks for being a part of this community! &#128640;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.codereliant.io/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[SRE Prodverbs]]></title><description><![CDATA["Prodverbs" (or production proverbs) is a cool collection of sayings maintained by Google's SRE team, which all of us who write or maintain distributed systems should understand.]]></description><link>https://www.codereliant.io/p/sre-prodverbs</link><guid isPermaLink="false">https://www.codereliant.io/p/sre-prodverbs</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Tue, 23 Apr 2024 15:21:02 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/23ba7d35-275a-4908-b20b-184b1faeafd2_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lvT0!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lvT0!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!lvT0!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!lvT0!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!lvT0!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lvT0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lvT0!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!lvT0!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!lvT0!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!lvT0!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6371c819-c0eb-4c55-9381-357250705a73_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@jordanharrison?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Jordan Harrison</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p><a href="https://sre.google/prodverbs/">"Prodverbs"</a> (or production proverbs) is a cool collection of sayings maintained by Google's SRE team, which all of us who write or maintain distributed systems should understand. Let's explore each one:</p><blockquote><p>1&#65039;&#8419; If two systems must agree for them to work, someday they will inevitably disagree</p></blockquote><p>It captures an important challenge in distributed systems: the need for agreement among multiple components. In a distributed system, processes often need to reach consensus on a single value or state to maintain consistency and coordinate their actions. However, relying on perfect agreement is unrealistic in the face of network partitions, split-brain situations, hardware failures, etc. The prodverb serves as a reminder that building reliable distributed systems requires careful design and the use of proven consensus algorithms, such as <a href="https://en.wikipedia.org/wiki/Paxos_(computer_science)">Paxos</a> and <a href="https://en.wikipedia.org/wiki/Raft_(algorithm)">Raft</a>, which ensure that all processes in the group will eventually converge on a single agreed-upon value, even in the presence of failures and unreliable networks.</p><blockquote><p>2&#65039;&#8419; Decrease variance, increase mean</p></blockquote><p>You should be focusing on improving the typical user experience rather than over-optimizing for edge cases. Reducing variability leads to more predictable performance for majority of the users.</p><blockquote><p>3&#65039;&#8419; Backups are only as good as the last restore</p></blockquote><p>Backups are a critical part of our reliability toolkit, but they're not something we can just set and forget. This saying emphasizes the importance of regularly testing our restore processes. Automating and exercising restores helps ensure that when we need our backups, they'll actually work.</p><blockquote><p>4&#65039;&#8419; If you have no SLOs, toil is your job</p></blockquote><p>Without clear reliability targets, SRE work can become an endless cycle of reactive firefighting. Service Level Objectives align teams around key metrics and help prioritize work that meaningfully improves reliability. This prodverb reminds us that if we don't set our own agenda with SLOs, toil will rule the day.</p><blockquote><p>5&#65039;&#8419; Hope is not a strategy</p></blockquote><p>This prodverb reminds us that wishful thinking is not enough to build reliable systems. We can't just hope that things will work out or that failures won't happen.</p><p>Some key aspects of having a solid strategy include:</p><ul><li><p>Designing for failure</p></li><li><p>Capacity planning</p></li><li><p>Security and access controls</p></li><li><p>Incident response planning</p></li><li><p>etc</p></li></ul><p>This prodverb encapsulates mindset shift from passively wishing for the best to actively working to make the system as robust as possible.</p><blockquote><p>6&#65039;&#8419; Scale maintenance sublinearly with the growth of the service</p></blockquote><p>What worked for 10 servers may not cut it for 10,000. Plan for the future, explore ways to reduce maintenance overhead - automate tasks, simplify architectures, and empower dev teams to share the load.</p><blockquote><p>7&#65039;&#8419; May all your incidents be novel</p></blockquote><p>In a perfect world, we'd never have repeat incidents. While that may not be realistic, this saying suggests us to strive to learn from every incident. By performing blameless postmortems and addressing the core of the problem, we can work to ensure that the same type of incident won't happen again.</p><div><hr></div><p>Hey there, reader! &#128075;</p><p>You know what they say, sharing is caring! If you found this newsletter helpful please take a moment to share it with your friends, colleagues and social media followers. Thanks for being a part of this community! &#128640;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.codereliant.io/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[From Web Scraping to Conversational AI]]></title><description><![CDATA[&#128161; A Step-by-Step Tutorial on how to make an AI chatbot for your website]]></description><link>https://www.codereliant.io/p/free-ai-chatbot</link><guid isPermaLink="false">https://www.codereliant.io/p/free-ai-chatbot</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Wed, 17 Apr 2024 15:28:42 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/13d1f47d-de4b-49e3-bce4-6574ccd6b2f7_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WPYm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Face2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WPYm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Face2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!WPYm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Face2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!WPYm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Face2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!WPYm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Face2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WPYm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Face2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ace2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WPYm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Face2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!WPYm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Face2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!WPYm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Face2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!WPYm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Face2a044-b402-432e-888a-626dd4b366b9_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@williamnavarro_?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">William Navarro</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><h3></h3><blockquote><p>&#128161; <strong>A Step-by-Step Tutorial on how to make an AI chatbot for your website</strong></p></blockquote><blockquote><p>&#128161; We will learn and use:<br>&#8226; <a href="https://github.com/astral-sh/uv">Python uv</a>: blazing fast pip replacement<br>&#8226; <a href="https://scrapy.org/">Scrapy</a>: Web scraper toolkit<br>&#8226; <a href="https://openai.com/">OpenAI</a>: embeddings api &amp; LLM<br>&#8226; <a href="https://www.langchain.com/">Langchain</a>: Semantic Chunking<br>&#8226; <a href="https://qdrant.tech/">Qdrant</a>: Vector DB to store embedding &amp; query them</p></blockquote><p>Did you see lately an increase in the number of websites that has an AI chatbot capability? That allows you to ask question about pricing, documentation, advanced questions, etc....</p><p>If you've noticed this trend, you're not alone. AI chatbots have become increasingly popular on websites across various industries, as they provide a convenient and efficient way for users to get the information they need quickly. These chatbots are powered by advanced technologies such as natural language processing (NLP), machine learning, and deep learning, which enable them to understand and respond to user queries in a human-like manner.</p><p>We will look into the process of creating your own AI chatbot for your website using Python and a combination of powerful tools and libraries. We'll cover web scraping using <a href="https://scrapy.org/">Scrapy</a> to gather content from your site, creating <a href="https://platform.openai.com/docs/guides/embeddings">embeddings</a> from the scraped content using the OpenAI API, and utilizing <a href="https://qdrant.tech/">Qdrant</a> as a vector database to store and query the embeddings. Additionally, we'll explore how to use <a href="https://www.langchain.com/">Langchain</a> for semantic chunking and integrate the queried content with OpenAI's GPT-4 to provide accurate and context-aware responses to user queries.</p><h2>Set Up &amp; Env</h2><p>We will make a twist and use <a href="https://github.com/astral-sh/uv">uv</a> as our blazing fast python installer, so go ahead and install if you don't have it:</p><pre><code># On macOS and Linux.
curl -LsSf https://astral.sh/uv/install.sh | sh

# On Windows.
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"</code></pre><p>Then, we will create a new directory and install all the needed libraries:</p><pre><code>mkdir chatbot &amp;&amp; cd chatbot
uv venv
uv pip install scrapy
uv pip install beautifulsoup4
uv pip install openai
uv pip install qdrant-client
uv pip install langchain
uv pip install langchain_experimental
uv pip install langchain_openai
uv pip install gradio</code></pre><h2>Website Scrapping</h2><p>Now let's create a new scrapy project for our website, in our use case, we will use yours truly <a href="https://www.codereliant.io">codereliant.io</a>:</p><pre><code>scrapy startproject codereliant</code></pre><p>In the file <code>items.py</code> modify the class <code>CodereliantItem</code> like below:</p><pre><code># Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html

import scrapy


class CodereliantItem(scrapy.Item):
    url = scrapy.Field()
    pass
</code></pre><p>Let's do a simple test to see if our scraping is working as intended:</p><pre><code>cd codereliant
scrapy crawl codereliant -L ERROR -O output.json</code></pre><p>From within the codereliant folder we run the scrapping command, which will result in a file <code>output.json</code> that contains all of our website urls:</p><pre><code>less output.json
[
{"url": "https://www.codereliant.io"},
{"url": "https://www.codereliant.io/sre-interview-prep-plan-week-6/"},
{"url": "https://www.codereliant.io/free-goodies/"},
{"url": "https://www.codereliant.io/about/"},
{"url": "https://www.codereliant.io/the-most-tragic-bug/"},
{"url": "https://www.codereliant.io/pod-doctor/"},
{"url": "https://www.codereliant.io/from-reactive-to-proactive-transforming-software-maintenance-with-auto-remediation/"},
{"url": "https://www.codereliant.io/topics/"},
{"url": "https://www.codereliant.io/the-2038-problem/"},
{"url": "https://www.codereliant.io/14-years-of-go/"},
......
</code></pre><p>We now that we will need more than just the urls if we want to create the chatbot.</p><h2>Data Extraction &amp; Preprocessing</h2><p>We already collected the url, now we need to other interesting data: page title, description, &amp; page body.</p><p>Let's add these items to our <code>CodereliantItem</code> class in <code>items.py</code>:</p><pre><code>class CodereliantItem(scrapy.Item):
    url = scrapy.Field()
    title = scrapy.Field()
    description = scrapy.Field()
    body = scrapy.Field()
    pass</code></pre><p>Now our item class has these fields defined, lets' actually grab the data in <code>parse_item</code> method that is defined in <code>CodereliantSpider</code> within <code>spiders/codereliant.py</code>:</p><pre><code>def parse_item(self, response):
    item = CodereliantItem()
    item['url'] = response.url
    item['title'] = response.css('title::text').get()
    item['description'] = response.css(
        'meta[name="description"]::attr(content)').get()
    item['body'] = response.css('body').get()
    return item</code></pre><blockquote><p>&#128161; We used css selector to collect the data needed. You can read more about Scrapy data selectors in <a href="https://docs.scrapy.org/en/latest/topics/selectors.html">here</a>.</p></blockquote><p>In order to either preprocess or post process our data, we need to write pipelines. the first pipeline we will write is the pipeline that will convert our page body content from html to just plain text.</p><p>First let's add a data field to <code>CodereliantItem</code>, which will hold the plain body:</p><pre><code>class CodereliantItem(scrapy.Item):
    url = scrapy.Field()
    title = scrapy.Field()
    description = scrapy.Field()
    body = scrapy.Field()
    plain_body = scrapy.Field() # add this line
    pass</code></pre><p>All of our pipelines are located in <code>pipelines.py</code>. we will write our first simple <code>BodyTxtConverterPipeline</code>:</p><pre><code>class BodyTxtConverterPipeline:
    # use beatifulsoup to convert html to text
    def process_item(self, item, spider):
        item['plain_body'] = BeautifulSoup(item['body'], 'html.parser').get_text()
        return item</code></pre><p>Now that we wrote our pipeline we need to enable it in <code>settings.py</code>, we need to uncomment the variable ITEM_PIPELINES and make it match:</p><pre><code>ITEM_PIPELINES = {
   "codereliant.pipelines.BodyTxtConverterPipeline": 300,
}</code></pre><p>To test that everything is working, we just need to try the <code>scrapy</code> command like above:</p><pre><code>scrapy crawl codereliant -L ERROR -O output.json</code></pre><p>by looking inside the file <code>output.json</code> we can see that we have successfully collected the data we are interested in + the <code>plain_body</code>.</p><h2>Semantic Chunking</h2><p>Now the more interesting part, which is now that we have collected all the data we need, what's next?</p><blockquote><p>&#128161; For this part, you will need an OpenAI API account with sufficient credits.</p></blockquote><p>Let's add a field in <code>CodereliantItem</code> to hold the chunks:</p><pre><code>class CodereliantItem(scrapy.Item):
    chunks = scrapy.Field() # add this line
    ......</code></pre><p>Our pipeline will leverage the abstractions of langchain, and it will also live in <code>pipelines.py</code>:</p><pre><code>class TextSplitterPipeline:
    def open_spider(self, spider):
        self.text_splitter = SemanticChunker(
            OpenAIEmbeddings(), breakpoint_threshold_type="percentile"
        )

    def process_item(self, item, spider):
        docs = self.text_splitter.create_documents([item['plain_body']])
        item['chunks'] = []
        for doc in docs:
            text = doc.page_content.replace("\n", " ")
            item['chunks'].append(text)
        return item</code></pre><p>Let's add this to<code>settings.py</code> like the previous pipeline:</p><pre><code>ITEM_PIPELINES = {
   "codereliant.pipelines.BodyTxtConverterPipeline": 300,
   "codereliant.pipelines.TextSplitterPipeline": 400,
}</code></pre><p>The number here signifies the order, we run pipelines from smallest to largest.</p><h2>VectorDB Storage</h2><p>Now we need create embeddings from these chunks and store them in our database. Let's start a standalone docker container of qdrant in a new terminal:</p><pre><code>docker run -p 6333:6333 -p 6334:6334 \
    -v $(pwd)/qdrant_storage:/qdrant/storage:z \
    qdrant/qdrant</code></pre><p>Our pipeline this time is a bit involved, but we will explain the code below:</p><pre><code>class VecorDBPipeline:
    def open_spider(self, spider):
        # constants
        self.COLLECTION_NAME = "codereliant"
        self.EMBEDDING_MODEL = "text-embedding-3-small"
        self.EMBEDDING_MODEL_VECOTR_SIZE = 1536 # hardcoded, but can be obtained from the model

        # clients
        self.openai_client = OpenAI()
        self.client = QdrantClient(url="http://localhost:6333")

        # create collection in qdrant
        self.client.recreate_collection(
            collection_name=self.COLLECTION_NAME,
            vectors_config=models.VectorParams(
                size=self.EMBEDDING_MODEL_VECOTR_SIZE,  
                distance=models.Distance.COSINE,
            ),
        )

    def process_item(self, item, spider):
        unique_ids = [str(uuid.uuid4()) for _ in item['chunks']]
        result = self.openai_client.embeddings.create(input=item["chunks"], model=self.EMBEDDING_MODEL)

        self.client.upload_points(
            collection_name=self.COLLECTION_NAME,
            points=[
                models.PointStruct(
                    id=unique_id,
                    vector=data.embedding,
                    payload={
                        "url": item['url'],
                        "title": item['title'],
                        "description": item['description'],
                        "chunk": chunk,
                    }
                )
                for unique_id, chunk, data in zip(unique_ids, item['chunks'], result.data)
            ],
        )
        return item
</code></pre><p>In summary, the <code>open_spider</code> method is responsible for initializing the necessary clients and creating the collection in the Qdrant database, while the <code>process_item</code> method handles the creation of embeddings for each chunk using the OpenAI API and uploads the embeddings and associated metadata to the Qdrant database.</p><p>and here is the explanation in great details:</p><ol><li><p><code>open_spider(self, spider)</code>&nbsp;method:</p><ul><li><p>This method is called when the spider is opened and is used for initialization purposes.</p></li><li><p>It sets up some constants:</p><ul><li><p><code>COLLECTION_NAME</code>: The name of the collection in the Qdrant database.</p></li><li><p><code>EMBEDDING_MODEL</code>: The name of the OpenAI embedding model to be used.</p></li><li><p><code>EMBEDDING_MODEL_VECOTR_SIZE</code>: The vector size of the embedding model (hardcoded as 1536 in this case).</p></li></ul></li><li><p>It initializes two clients:</p><ul><li><p><code>openai_client</code>: An instance of the&nbsp;<code>OpenAI</code>&nbsp;client for interacting with the OpenAI API.</p></li><li><p><code>client</code>: An instance of the&nbsp;<code>QdrantClient</code>&nbsp;for connecting to the Qdrant database.</p></li></ul></li><li><p>It recreates a collection in the Qdrant database using the&nbsp;<code>recreate_collection</code>&nbsp;method of the&nbsp;<code>QdrantClient</code>. The collection is created with the specified&nbsp;<code>COLLECTION_NAME</code>&nbsp;and a&nbsp;<code>VectorParams</code>&nbsp;configuration that includes the vector size (<code>EMBEDDING_MODEL_VECOTR_SIZE</code>) and the distance metric (<code>models.Distance.COSINE</code>).</p></li></ul></li><li><p><code>process_item(self, item, spider)</code>&nbsp;method:</p><ul><li><p>This method is called for each item yielded by the spider.</p></li><li><p>It generates unique IDs for each chunk in the&nbsp;<code>item['chunks']</code>&nbsp;list using&nbsp;<code>uuid.uuid4()</code>.</p></li><li><p>It creates embeddings for each chunk using the OpenAI API's&nbsp;<code>embeddings.create</code>&nbsp;method, specifying the chunks and the&nbsp;<code>EMBEDDING_MODEL</code>.</p></li><li><p>It uploads the embeddings and associated metadata to the Qdrant database using the&nbsp;<code>upload_points</code>&nbsp;method of the&nbsp;<code>QdrantClient</code>.</p><ul><li><p>For each chunk, it creates a&nbsp;<code>PointStruct</code>&nbsp;object containing:</p><ul><li><p><code>id</code>: The unique ID generated for the chunk.</p></li><li><p><code>vector</code>: The embedding vector obtained from the OpenAI API.</p></li><li><p><code>payload</code>: A dictionary containing metadata associated with the chunk, such as the URL, title, description, and the chunk itself.</p></li></ul></li></ul></li></ul></li></ol><p>Finally, we need to add the pipeline <code>VecorDBPipeline</code> to <code>settings.py</code>:</p><pre><code>ITEM_PIPELINES = {
   "codereliant.pipelines.BodyTxtConverterPipeline": 300,
   "codereliant.pipelines.TextSplitterPipeline": 400,
   "codereliant.pipelines.VecorDBPipeline": 500,
}</code></pre><p>Now before we test it we need to set our OpenAI token</p><pre><code>export OPENAI_API_KEY='sk-...........'
scrapy crawl codereliant -L ERROR -O output.json</code></pre><p>We can verify by looking at our Qdrant dashboard UI which is located at: <a href="http://localhost:6333/dashboard">http://localhost:6333/dashboard</a> .</p><p>From there we can see the info of the collection and some useful stats:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3QTu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3QTu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png 424w, https://substackcdn.com/image/fetch/$s_!3QTu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png 848w, https://substackcdn.com/image/fetch/$s_!3QTu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png 1272w, https://substackcdn.com/image/fetch/$s_!3QTu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3QTu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png" width="1456" height="695" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:695,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!3QTu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png 424w, https://substackcdn.com/image/fetch/$s_!3QTu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png 848w, https://substackcdn.com/image/fetch/$s_!3QTu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png 1272w, https://substackcdn.com/image/fetch/$s_!3QTu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F04fe4339-2747-446c-886d-ba9a7a3f21fe_2000x955.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Chatbot</h2><p>Finally we got to the actual chatbot. We will create a separate python file outside the <code>codereliant</code> and within out <code>chatbot</code> directory:</p><pre><code>cd ../
touch chat.py
uv pip install gradio
</code></pre><p>we just created a python file that will contain our chat interface and install gradio ui toolkit.</p><p>Below is the code for chat.py:</p><pre><code>import json
import gradio as gr
from openai import OpenAI
from qdrant_client import QdrantClient

# constants
COLLECTION_NAME = "codereliant"
EMBEDDING_MODEL = "text-embedding-3-small"

# clients
openai_client = OpenAI()
client = QdrantClient(url="http://localhost:6333")

def search_similar_text(text):
    hits = client.search(
        collection_name=COLLECTION_NAME,
        query_vector=openai_client.embeddings.create(input=[text],model=EMBEDDING_MODEL,)
        .data[0]
        .embedding,
        limit=3,
    )
    return hits

def generate_response(query, history):
    hits = search_similar_text(query)
    # create the context based on the hits
    context = ""
    for hit in hits:
        context += json.dumps(hit.payload) + "\n"
    prompt = generate_prompt(context, query)
    completion = openai_client.chat.completions.create(
        model="gpt-4-turbo",
        messages=[
            {"role": "system", "content": "You are codereliant chatbot, skilled in answering questions about codereliant.io."},
            {"role": "user", "content": prompt}
        ]
    )
    
    return completion.choices[0].message.content

def generate_prompt(context, query):
    prompt = f"""
Context:
{context}

Query: {query}

Based on the provided context, answer the query. If the context does not contain enough information to answer the query, respond with "I'm sorry, but the provided context does not have sufficient information to answer your query. Also, answer like a customer service representative would."

Answer:
"""
    return prompt

demo = gr.ChatInterface(fn=generate_response, examples=[ "what is this website about?","what can I learn from codereliant?", "Do you have any SRE interview preparation posts?"], title="CodeReliant Bot", multimodal=False)
demo.launch()

</code></pre><p>Let's go through each function and briefly explain what they do:</p><ol><li><p><code>search_similar_text(text)</code>:</p><ul><li><p>This function takes a&nbsp;<code>text</code>&nbsp;parameter and searches for similar texts in the Qdrant database.</p></li><li><p>It creates an embedding of the input&nbsp;<code>text</code>&nbsp;using the specified&nbsp;<code>EMBEDDING_MODEL</code>&nbsp;and the OpenAI API.</p></li><li><p>It then searches the Qdrant collection (<code>COLLECTION_NAME</code>) for the top 3 (<code>limit=3</code>) most similar vectors to the input text's embedding.</p></li><li><p>The function returns the search results (<code>hits</code>) containing the similar texts and their associated metadata.</p></li></ul></li><li><p><code>generate_response(query, history)</code>:</p><ul><li><p>This function generates a response to a given&nbsp;<code>query</code>&nbsp;based on the search results from the Qdrant database.</p></li><li><p>It calls the&nbsp;<code>search_similar_text(query)</code>&nbsp;function to retrieve the most similar texts to the query.</p></li><li><p>It then constructs a&nbsp;<code>context</code>&nbsp;string by concatenating the&nbsp;<code>payload</code>&nbsp;(metadata) of each hit retrieved from the database.</p></li><li><p>It generates a prompt using the&nbsp;<code>generate_prompt(context, query)</code>&nbsp;function, which combines the context and the query.</p></li><li><p>Finally, it uses the OpenAI API to create a chat completion using the&nbsp;<code>gpt-4-turbo</code>&nbsp;model, passing the generated prompt as the user's message.</p></li><li><p>The function returns the generated response obtained from the chat completion.</p></li></ul></li><li><p><code>generate_prompt(context, query)</code>:</p><ul><li><p>This function generates a prompt by combining the&nbsp;<code>context</code>&nbsp;and the&nbsp;<code>query</code>.</p></li><li><p>The prompt includes the context, the query, and instructions on how to answer the query based on the provided context.</p></li><li><p>If the context does not contain enough information to answer the query, it instructs the model to respond with a specific message indicating the lack of information and to answer like a customer service representative.</p></li><li><p>The function returns the generated prompt as a string.</p></li></ul></li><li><p>The last part of the code sets up a Gradio&nbsp;<code>ChatInterface</code>&nbsp;for interacting with the chatbot:</p><ul><li><p>It creates an instance of&nbsp;<code>gr.ChatInterface</code>&nbsp;called&nbsp;<code>demo</code>.</p></li><li><p>The&nbsp;<code>fn</code>&nbsp;parameter is set to the&nbsp;<code>generate_response</code>&nbsp;function, which will be called whenever a user sends a message.</p></li><li><p>The&nbsp;<code>examples</code>&nbsp;parameter is set to a list of example queries to showcase the chatbot's capabilities.</p></li><li><p>The&nbsp;<code>title</code>&nbsp;parameter sets the title of the chat interface to "CodeReliant Bot".</p></li><li><p>The&nbsp;<code>multimodal</code>&nbsp;parameter is set to&nbsp;<code>False</code>, indicating that the chat interface will only handle text input and output.</p></li><li><p>Finally, the&nbsp;<code>launch()</code>&nbsp;method is called on the&nbsp;<code>demo</code>&nbsp;instance to start the chat interface.</p></li></ul></li></ol><p>These functions work together to create a chatbot that can search for similar texts in our Qdrant database based on user queries, generate prompts combining the retrieved context and the query, and provide responses using the OpenAI API's chat completion feature. The chatbot is then made interactive using Gradio's <code>ChatInterface</code>.</p><p>To run it, make sure the OpenAI token is set, and just run:</p><pre><code>python chat.py

#Running on local URL:  http://127.0.0.1:7860

#To create a public link, set `share=True` in `launch()`.</code></pre><p>Below is a screenshot of trying the examples with our ChatBot and getting responses like we do from other sites:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FDeL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FDeL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png 424w, https://substackcdn.com/image/fetch/$s_!FDeL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png 848w, https://substackcdn.com/image/fetch/$s_!FDeL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png 1272w, https://substackcdn.com/image/fetch/$s_!FDeL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FDeL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png" width="1456" height="919" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:919,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FDeL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png 424w, https://substackcdn.com/image/fetch/$s_!FDeL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png 848w, https://substackcdn.com/image/fetch/$s_!FDeL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png 1272w, https://substackcdn.com/image/fetch/$s_!FDeL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe9994c88-fb5e-493b-b38e-162827aefa91_2000x1263.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The <a href="https://github.com/misoukrane/chatbot-tutorial">Github link</a> contains the full code of this tutorial!</p><div><hr></div><p>Hey there, reader! &#128075;</p><p>You know what they say, sharing is caring! If you found this newsletter helpful please take a moment to share it with your friends, colleagues and social media followers. Thanks for being a part of this community! &#128640;</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.codereliant.io/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[5 VSCode Extensions for Productivity]]></title><description><![CDATA[VSCode has become the default code editor for many developers.]]></description><link>https://www.codereliant.io/p/vscode-extensions</link><guid isPermaLink="false">https://www.codereliant.io/p/vscode-extensions</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Wed, 10 Apr 2024 14:55:32 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/d1c3671c-ed7f-421f-820e-b280fe9e78e8_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oqGy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oqGy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!oqGy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!oqGy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!oqGy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oqGy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oqGy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!oqGy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!oqGy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!oqGy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3fed105f-c90f-4fe6-94ba-7276b05c938f_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@afgprogrammer?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Mohammad Rahmani</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p><a href="https://code.visualstudio.com/">VSCode</a> has become the default code editor for many developers. And as many developers, we are always on the lookout for tools that can boost our productivity and workflows.</p><p>Let's explore 5 must-have VSCode extensions that can take your coding productivity to the next level. I'll skip the <a href="https://marketplace.visualstudio.com/items?itemName=GitHub.copilot">Copilot</a>, as I hope you already use it &#128516;</p><blockquote><p>1&#65039;&#8419; <strong>GitLens</strong></p></blockquote><p><a href="https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens">GitLens</a> is a powerful extension that improves the built-in Git capabilities of VSCode. It provides a set of features for visualizing and exploring Git repositories. With GitLens, you can easily view the history of a file, see who made changes and when, and even compare different versions of the code side by side. It also offers advanced blame annotations, allowing you to quickly identify the author of each line of code.</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9A4v!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9A4v!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png 424w, https://substackcdn.com/image/fetch/$s_!9A4v!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png 848w, https://substackcdn.com/image/fetch/$s_!9A4v!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png 1272w, https://substackcdn.com/image/fetch/$s_!9A4v!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9A4v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png" width="610" height="216" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:216,&quot;width&quot;:610,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Current Line Hovers&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Current Line Hovers" title="Current Line Hovers" srcset="https://substackcdn.com/image/fetch/$s_!9A4v!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png 424w, https://substackcdn.com/image/fetch/$s_!9A4v!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png 848w, https://substackcdn.com/image/fetch/$s_!9A4v!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png 1272w, https://substackcdn.com/image/fetch/$s_!9A4v!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe6bc7c59-3be3-4822-8f00-c20fa58c9016_610x216.png 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><blockquote><p>2&#65039;&#8419; <strong>Find It Faster</strong></p></blockquote><p><a href="https://marketplace.visualstudio.com/items?itemName=TomRijndorp.find-it-faster">FindItFaster</a> is an extension that enhances your search capabilities within VSCode. It provides a more intuitive and efficient way to search for files, symbols, and text across your project. With this extension, you can use fuzzy search to quickly locate files based on partial matches, search for symbols within files, and even perform global searches across multiple directories. This extension can save you valuable time when navigating through large codebases. Under the hood it uses a combination of <code>fzf</code>, <code>rg</code> and <code>bat</code>, tools we discussed in one the previous articles <a href="https://www.codereliant.io/p/legacy-cli-no-more">here</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vTvW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vTvW!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif 424w, https://substackcdn.com/image/fetch/$s_!vTvW!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif 848w, https://substackcdn.com/image/fetch/$s_!vTvW!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif 1272w, https://substackcdn.com/image/fetch/$s_!vTvW!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vTvW!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif" width="1024" height="576" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:576,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Find Files&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Find Files" title="Find Files" srcset="https://substackcdn.com/image/fetch/$s_!vTvW!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif 424w, https://substackcdn.com/image/fetch/$s_!vTvW!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif 848w, https://substackcdn.com/image/fetch/$s_!vTvW!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif 1272w, https://substackcdn.com/image/fetch/$s_!vTvW!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F09144fa1-41cf-4ca1-9340-a5f1e56782ce_1024x576.gif 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p>3&#65039;&#8419; <strong>CodeSnap / Live Share</strong></p></blockquote><p>CodeSnap &amp; Live Share is a combination of two powerful extensions that enhance collaboration and code sharing capabilities in VSCode.</p><p><a href="https://marketplace.visualstudio.com/items?itemName=adpyke.codesnap">CodeSnap</a> allows you to easily create beautiful code snippets and share them with others. It captures your code as an image, complete with syntax highlighting and customizable themes. You can add custom backgrounds and annotations to make your code snippets more visually appealing. It's perfect for sharing code snippets on social media, in documentation, or in presentations.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pIx_!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pIx_!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png 424w, https://substackcdn.com/image/fetch/$s_!pIx_!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png 848w, https://substackcdn.com/image/fetch/$s_!pIx_!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png 1272w, https://substackcdn.com/image/fetch/$s_!pIx_!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pIx_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png" width="1266" height="724" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:724,&quot;width&quot;:1266,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pIx_!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png 424w, https://substackcdn.com/image/fetch/$s_!pIx_!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png 848w, https://substackcdn.com/image/fetch/$s_!pIx_!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png 1272w, https://substackcdn.com/image/fetch/$s_!pIx_!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4287db0f-8443-4b3b-a7ec-bb4df148c564_1266x724.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><a href="https://code.visualstudio.com/learn/collaboration/live-share">Live Share</a> enables real-time collaboration within VSCode. It allows you to share your code with others and work together in real-time. You can invite teammates to join your coding session, share your editor, terminal, and even debugging sessions. Live Share makes paired programming seamless and efficient.</p><blockquote><p>4&#65039;&#8419; <strong>Remote - SSH</strong></p></blockquote><p><a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh">Remote - SSH</a> is an extension that allows you to connect to remote machines and work with files and folders as if they were local. You can develop on remote servers, virtual machines, or even containers seamlessly within VSCode.</p><p>This extension enables you to open any folder on a remote machine and take advantage of all the features and extensions of VSCode, including IntelliSense, debugging, and version control. It provides a secure and efficient way to work on remote projects without the need for local setup or file synchronization.</p><blockquote><p>5&#65039;&#8419; <strong>Project Manager</strong></p></blockquote><p>With <a href="https://marketplace.visualstudio.com/items?itemName=alefragnani.project-manager">Project Manager</a>, you can define a list of projects, each with its own set of settings, such as the project's root directory, mark favorites, autodetect projects from Git repositories and more. Once your projects are set up, switching between them becomes very easy. You can use the keyboard shortcuts to open a project, and Project Manager will handle the rest, instantly loading the project's files and applying the associated settings.</p><p>One of the standout features of Project Manager is its ability to remember the state of your workspace for each project. It preserves the opened files, layout, and even the active file and line position, ensuring that you can quickly resume work exactly where you left off.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!1IJh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!1IJh!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif 424w, https://substackcdn.com/image/fetch/$s_!1IJh!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif 848w, https://substackcdn.com/image/fetch/$s_!1IJh!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif 1272w, https://substackcdn.com/image/fetch/$s_!1IJh!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!1IJh!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif" width="910" height="500" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/da276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:500,&quot;width&quot;:910,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Side Bar&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Side Bar" title="Side Bar" srcset="https://substackcdn.com/image/fetch/$s_!1IJh!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif 424w, https://substackcdn.com/image/fetch/$s_!1IJh!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif 848w, https://substackcdn.com/image/fetch/$s_!1IJh!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif 1272w, https://substackcdn.com/image/fetch/$s_!1IJh!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda276db5-9ac1-4452-9114-2ba7bcfa32b6_910x500.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p>&#128161; <strong>Bonus</strong></p></blockquote><p>Nothing improves the productivity more than a good IDE theme &#128133; &#128512;</p><p>I've been mostly using <a href="https://marketplace.visualstudio.com/items?itemName=zhuangtongfa.Material-theme">One Dark Pro</a> and <a href="https://marketplace.visualstudio.com/items?itemName=sdras.night-owl">Night Owl</a> with some customizations.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!3dx8!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!3dx8!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png 424w, https://substackcdn.com/image/fetch/$s_!3dx8!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png 848w, https://substackcdn.com/image/fetch/$s_!3dx8!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png 1272w, https://substackcdn.com/image/fetch/$s_!3dx8!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!3dx8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png" width="2306" height="1768" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1768,&quot;width&quot;:2306,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;ScreenShot&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="ScreenShot" title="ScreenShot" srcset="https://substackcdn.com/image/fetch/$s_!3dx8!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png 424w, https://substackcdn.com/image/fetch/$s_!3dx8!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png 848w, https://substackcdn.com/image/fetch/$s_!3dx8!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png 1272w, https://substackcdn.com/image/fetch/$s_!3dx8!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F630336f0-6d91-4e0c-893a-5d0a4f7682ab_2306x1768.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><strong>Happy Coding!</strong></p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Free coding tips weekly:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Auto Remediation 101]]></title><description><![CDATA[Have you ever been on call and you get woken up by the same alert, an alert that you can't do anything about it, and the only way to make it go away is to restart the system responsible.]]></description><link>https://www.codereliant.io/p/from-reactive-to-proactive-transforming-software-maintenance-with-auto-remediation</link><guid isPermaLink="false">https://www.codereliant.io/p/from-reactive-to-proactive-transforming-software-maintenance-with-auto-remediation</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Fri, 05 Apr 2024 16:43:41 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/fc2ffa9c-d948-41c1-9984-80ef3a3853cb_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!PeUW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!PeUW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!PeUW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!PeUW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!PeUW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!PeUW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!PeUW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!PeUW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!PeUW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!PeUW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fada628b1-95cd-4d97-b2bd-e0f7b2c776b2_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@jefflssantos?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Jefferson Santos</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>Have you ever been on call and you get woken up by the same alert, an alert that you can't do anything about it, and the only way to make it go away is to <strong>restart</strong> the system responsible.</p><p>Auto remediation is an approach that SREs apply for these types of alerts and many other different ones. it makes our life easier, and it helps us focus on more critical tasks. Auto remediation is the process of automatically identifying and resolving issues in software systems without human intervention. It enables our systems to self-heal and recover from failures, minimizing downtime and ensuring continuous operation.</p><p>In this blog post, we'll explore what auto remediation is, its benefits, and how to implement it effectively.</p><h2>What is Auto Remediation?</h2><p>Auto remediation refers to the automated process of identifying and resolving issues in software systems without human intervention. It ensures that systems stays up and have a smooth continuous operation through auto recovering from failures.</p><h3>Common Scenarios for Auto Remediation</h3><p>Auto remediation can be applied to various scenarios, including:</p><ul><li><p>Infrastructure failures: Automatically provisioning backup resources or restarting failed components.</p></li><li><p>Application errors and exceptions: Identifying and resolving common application issues.</p></li><li><p>Security vulnerabilities: Automatically patching known vulnerabilities.</p></li><li><p>Performance issues: Dynamically scaling resources based on workload.</p></li></ul><h3>Benefits of Auto Remediation</h3><p>Implementing auto remediation offers several benefits:</p><ul><li><p>Faster recovery times: Issues are resolved quickly, minimizing downtime.</p></li><li><p>Reduced manual intervention: Automated remediation reduces the need for manual troubleshooting.</p></li><li><p>Improved system reliability and availability: Systems become more resilient and self-healing.</p></li><li><p>Cost savings: Automated remediation reduces the cost associated with manual intervention and downtime.</p></li></ul><h2>Key Components of an Auto Remediation System</h2><p>An effective auto remediation system consists of the following components:</p><ol><li><p>Monitoring and Alerting: Continuously monitor system metrics and logs to detect anomalies and trigger alerts.</p><ol><li><p>For example tools like <a href="https://prometheus.io/">Prometheus</a> and <a href="https://prometheus.io/docs/alerting/latest/alertmanager/">AlertManger</a>.</p></li></ol></li><li><p>Incident Detection and Analysis: Analyze alerts and correlate data to identify the root cause of incidents.</p></li><li><p>Remediation Policies and Rules: Define a set of predefined policies and rules to determine the appropriate remediation actions.</p></li><li><p>Automation and Orchestration Tools: Utilize automation tools to execute remediation actions and orchestrate the overall process.</p></li></ol><p>Here's a simple example of a remediation webhook for AlertManager using Golang:</p><pre><code>package main

import (
    "encoding/json"
    "fmt"
    "net/http"
    "time"
)

type AlertMessage struct {
    Alerts []Alert `json:"alerts"`
}

type Alert struct {
    Status      string            `json:"status"`
    Labels      map[string]string `json:"labels"`
    Annotations map[string]string `json:"annotations"`
    StartsAt    time.Time         `json:"startsAt"`
    EndsAt      time.Time         `json:"endsAt"`
}

func handleWebhook(w http.ResponseWriter, r *http.Request) {
    if r.Method != http.MethodPost {
        http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
        return
    }

    var alertMessage AlertMessage
    err := json.NewDecoder(r.Body).Decode(&amp;alertMessage)
    if err != nil {
        http.Error(w, "Invalid request payload", http.StatusBadRequest)
        return
    }

    for _, alert := range alertMessage.Alerts {
        if alert.Status == "firing" {
            if alert.Labels["alertname"] == "HighCPUUsage" || alert.Labels["alertname"] == "HighMemoryUsage" {
                duration := time.Since(alert.StartsAt)
                if duration &gt;= 30*time.Minute {
                    nodeName := alert.Labels["instance"]
                    restartNode(nodeName)
                }
            }
        }
    }

    w.WriteHeader(http.StatusOK)
}

func restartNode(nodeName string) {
    // Implement the logic to restart the node based on the nodeName
    fmt.Printf("Restarting node: %s\n", nodeName)
    // ...
}

func main() {
    http.HandleFunc("/webhook", handleWebhook)
    fmt.Println("Webhook server is running on :8080")
    http.ListenAndServe(":8080", nil)
}</code></pre><p>In this code:</p><ol><li><p>We define the necessary structs (<code>AlertMessage</code>&nbsp;and&nbsp;<code>Alert</code>) to represent the JSON payload received from Alertmanager.</p></li><li><p>The&nbsp;<code>handleWebhook</code>&nbsp;function is the HTTP handler for the webhook endpoint. It expects a POST request with the alert payload.</p></li><li><p>We decode the JSON payload into the&nbsp;<code>AlertMessage</code>&nbsp;struct.</p></li><li><p>We iterate over each alert in the&nbsp;<code>Alerts</code>&nbsp;array.</p></li><li><p>For each alert, we check if the alert status is "firing" and if the alert name is either <code>HighCPUUsage</code> or <code>HighMemoryUsage</code>.</p></li><li><p>If the alert has been firing for at least 30 minutes (we can adjust the duration as needed), we extract the&nbsp;<code>instance</code>&nbsp;label, which represents the node name.</p></li><li><p>We call the&nbsp;<code>restartNode</code>&nbsp;function, passing the node name as an argument. This function should contain the logic to restart the node (e.g., making an API call to a cloud provider or executing a system command).</p></li><li><p>Finally, we set up the webhook server to listen on port 8080 and handle incoming requests.</p></li></ol><p>To use this webhook, we need to configure Alertmanager to send alerts to the webhook URL (e.g., <code>http://your-server:8080/webhook</code>) when the specified conditions are met.</p><h3>Implementing Auto Remediation</h3><p>To implement auto remediation effectively:</p><ol><li><p>Identify critical systems and failure scenarios.</p></li><li><p>Define remediation workflows and playbooks.</p></li><li><p>Select appropriate automation tools and technologies.</p></li><li><p>Test and validate auto remediation processes.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz 424w, https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz 848w, https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz 1272w, https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz 1456w" sizes="100vw"><img src="https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz" width="460" height="380" data-attrs="{&quot;src&quot;:&quot;https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:380,&quot;width&quot;:460,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Auto remediation steps&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Auto remediation steps" title="Auto remediation steps" srcset="https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz 424w, https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz 848w, https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz 1272w, https://jxawqcyqfpgxmcztoora.supabase.co/storage/v1/object/public/documents-data/png-preview-chat/Z5kPOr9Jsz 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Auto remediation steps</figcaption></figure></div><p>By following these guidelines and leveraging the power of automation, we can build resilient and self-healing software systems that minimize downtime and ensure optimal performance.</p><h2>Conclusion</h2><p>Auto remediation is crucial for every engineer that run and operate systems. It empowers SREs to focus on more strategic tasks while ensuring the reliability and availability of software systems. Keep in mind that you should continuously refine and optimize your processes to build truly resilient and self-healing systems.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Free coding tips weekly:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Building a Kubernetes Pod Doctor with Gradio and GPT-4]]></title><description><![CDATA[Hey devs,]]></description><link>https://www.codereliant.io/p/pod-doctor</link><guid isPermaLink="false">https://www.codereliant.io/p/pod-doctor</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Tue, 26 Mar 2024 15:56:42 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/6c49001b-c09a-4a90-9119-2f552e7d6fba_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lCEt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lCEt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!lCEt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!lCEt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!lCEt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lCEt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lCEt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!lCEt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!lCEt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!lCEt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1e6727d6-de98-43b2-ab93-1ac62b6fceaa_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@nci?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">National Cancer Institute</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>Hey devs, <br>As many of you, I&#8217;ve been exploring how AI can help me be more productive with my day to day tasks. So <strong>&#8220;Pod Doctor&#8221;</strong> was born. This is a little tool (just <strong>180</strong> lines!) which helps me with Kubernetes Pod troubleshooting faster than if I were to do it myself. You can find the full code on&nbsp;<a href="https://github.com/codereliant/pod-doctor">github</a> and in this beginner tutorial we&#8217;ll go through the steps required to be able build similar tools for yourself.<br><br>We&#8217;ll learn how to create&nbsp;<a href="https://www.gradio.app/">Gradio's</a> chatbot UI, integrate the&nbsp;<a href="https://github.com/kubernetes-client/python">Kubernetes Python client</a>, and leverage GPT-4's language for understanding and reasoning.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!s87L!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!s87L!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png 424w, https://substackcdn.com/image/fetch/$s_!s87L!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png 848w, https://substackcdn.com/image/fetch/$s_!s87L!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png 1272w, https://substackcdn.com/image/fetch/$s_!s87L!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!s87L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png" width="1456" height="842" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:842,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!s87L!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png 424w, https://substackcdn.com/image/fetch/$s_!s87L!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png 848w, https://substackcdn.com/image/fetch/$s_!s87L!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png 1272w, https://substackcdn.com/image/fetch/$s_!s87L!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F27d6824c-5906-4c14-976c-a0099d467ae9_2000x1156.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The user interface of the Pod Doctor application is built using <a href="https://www.gradio.app/">Gradio</a>, which is a Python library for creating customizable UI components and deploying machine learning models. The interface consists of the following elements:</p><ol><li><p><strong>Title</strong>: A label displaying the name of the application, "Pod Doctor."</p></li><li><p><strong>Chatbot</strong>: A chatbot-style interface for displaying the conversation between the user and the language model.</p></li><li><p><strong>Namespace Dropdown</strong>: A dropdown menu that allows users to select the Kubernetes namespace they want to interact with.</p></li><li><p><strong>Pod Dropdown</strong>: A dropdown menu that populates with the list of pods available in the selected namespace.</p></li><li><p><strong>Include Events Checkbox</strong>: A checkbox that allows users to include pod events in the information provided to the language model.</p></li><li><p><strong>Include Logs Checkbox</strong>: A checkbox that allows users to include pod logs in the information provided to the language model.</p></li><li><p><strong>Message Input</strong>: A text input field where users can type their messages or queries.</p></li></ol><pre><code>with gr.Blocks(theme=gr.themes.Soft()) as demo:
    with gr.Row():
        title = gr.Label("Pod Doctor")
    with gr.Row():
        with gr.Column(scale=4):
            chatbot = gr.Chatbot(height="600px")
        with gr.Column(scale=1):
            namespace = gr.Dropdown(
                list_namespaces(),
                label="Namespace",
                info="Select the namespace you want to check the pod in.",
                interactive=True,
            )
            pod = gr.Dropdown(
                [],
                label="Pod",
                info="Select the pod you want to interact with.",
                interactive=True,
            )
            include_events = gr.Checkbox(
                label="Include Events",
                info="Include the pod events.",
                interactive=True,
            )
            include_logs = gr.Checkbox(
                label="Include Logs",
                info="Include the pod logs.",
                interactive=True,
            )
            namespace.change(namespace_change, inputs=namespace, outputs=pod)
    with gr.Row():
        msg = gr.Textbox()

    def respond(message, chat_history, namespace, pod, include_events, include_logs):
        if not namespace or not pod or not message:
            chat_history.append((message or "Error", "Please select a namespace and pod."))
            return "", chat_history
        bot_message = call_llm(message, namespace, pod, include_events, include_logs)
        new_message = f"Namespace {namespace}, Pod: {pod}, Include Events: {include_events}, Include Logs: {include_logs} \n {message}"
        chat_history.append((new_message, bot_message))
        return "", chat_history
    msg.submit(respond, [msg, chatbot, namespace, pod, include_events, include_logs], [msg, chatbot])</code></pre><p>As we progress through the tutorial, you may encounter function calls that are not yet defined. However, these functions will be explained and implemented as we move forward.</p><p>Let's define a function that is responsible for updating the dropdown of pods once a namespace is selected:</p><pre><code>def namespace_change(value):
    """
    Returns a Dropdown widget populated with a list of pods based on the given value.

    Args:
        value (str): The namespace to filter the pods.

    Returns:
        gr.Dropdown: A Dropdown widget with choices populated from the list of pods.
    """
    pods = list_pods(value)
    return gr.Dropdown(choices=pods)</code></pre><h2>Kubernetes Integration</h2><p>The Pod Doctor application integrates with a Kubernetes cluster using the <code>kubernetes</code> Python <a href="https://github.com/kubernetes-client/python">library</a>. The following functions handle the interaction with the Kubernetes API:</p><p>first we need to import the k8s library and load the config :</p><pre><code>from kubernetes import client, config

config.load_kube_config()</code></pre><p><code>list_namespaces()</code>: Retrieves a list of namespaces from the Kubernetes cluster.</p><pre><code>def list_namespaces():
    """
    Retrieves a list of namespaces from the Kubernetes cluster.

    Returns:
        A list of namespace names.
    """
    v1 = client.CoreV1Api()
    namespaces = v1.list_namespace()
    return [namespace.metadata.name for namespace in namespaces.items]</code></pre><p><code>list_pods(namespace)</code>: Lists all pods in the specified namespace.</p><pre><code>def list_pods(namespace):
    """
    List all pods in the specified namespace.

    Args:
        namespace (str): The namespace to list pods from.

    Returns:
        list: A list of pod names.
    """
    v1 = client.CoreV1Api()
    pods = v1.list_namespaced_pod(namespace)
    return [pod.metadata.name for pod in pods.items]</code></pre><p><code>get_pod_info(namespace, pod, include_events, include_logs)</code>: Retrieves detailed information about a specific pod, including events and logs if requested.</p><pre><code>def get_pod_info(namespace, pod, include_events, include_logs):
    """
    Retrieves information about a specific pod in a given namespace.

    Args:
        namespace (str): The namespace of the pod.
        pod (str): The name of the pod.
        include_events (bool): Flag indicating whether to include events associated with the pod.
        include_logs (bool): Flag indicating whether to include logs of the pod.

    Returns:
        dict: A dictionary containing the pod information, events (if include_events is True), and logs (if include_logs is True).
    """
    v1 = client.CoreV1Api()
    pod_info = v1.read_namespaced_pod(pod, namespace)
    pod_info_map = pod_info.to_dict()
    pod_info_map["metadata"]["managed_fields"] = None
    
    info = {
        "PodInfo": pod_info_map,
    }
    if include_events:
        events = v1.list_namespaced_event(namespace)
        info["Events"] = [
            {
                "Name": event.metadata.name,
                "Message": event.message,
                "Reason": event.reason,
            }
            for event in events.items
            if event.involved_object.name == pod
        ]
    if include_logs:
        logs = v1.read_namespaced_pod_log(pod, namespace)
        info["Logs"] = logs
    
    return info</code></pre><h2>LLM &amp; GPT-4</h2><p>The heart of the Pod Doctor application is the integration with the GPT-4 language model from OpenAI. The <code>call_llm</code> function is responsible for generating a response based on the user's message, the selected namespace, pod, and the options for including events and logs.</p><p>Here's how the <code>call_llm</code> function works:</p><ol><li><p>The&nbsp;<code>get_pod_info</code>&nbsp;function is called to retrieve the pod information, including events and logs if requested.</p></li><li><p>The&nbsp;<code>create_prompt</code>&nbsp;function generates a prompt message by combining the user's message with the pod information.</p></li><li><p>The OpenAI API is called using the&nbsp;<code>openAiClient.chat.completions.create</code>&nbsp;method, passing the prompt message and the GPT-4 model.</p></li><li><p>The response from the language model is returned and displayed in the chatbot interface.</p></li></ol><pre><code>from openai import OpenAI
import yaml

openAiClient = OpenAI()

def create_prompt(msg, info):
    """
    Creates a prompt message with the given message and pod information.

    Args:
        msg (str): The main message for the prompt.
        info (dict): A dictionary containing pod information.

    Returns:
        str: The generated prompt message.
    """
    prompt = f"{msg}\n"
    prompt += f"Pod Info: \n {yaml.dump(info['PodInfo'])} \n"
    if info.get("Events"):
        prompt += f"Here are the last few events for the pod: \n"
        for event in info["Events"]:
            prompt += f"Event: {event['Name']}, Reason: {event['Reason']}, Message: {event['Message']}\n"
    if info.get("Logs"):
        prompt += f"Here are the last few logs for the pod: \n"
        prompt += info["Logs"]
    return prompt


def call_llm(msg, namespace, pod, include_events, include_logs):
    """
    Calls the Language Model to generate a response based on the given message, namespace, pod, and options.

    Args:
        msg (str): The user's message.
        namespace (str): The namespace of the pod.
        pod (str): The name of the pod.
        include_events (bool): Whether to include events in the pod information.
        include_logs (bool): Whether to include logs in the pod information.

    Returns:
        str: The generated response from the Language Model.
    """
    info = get_pod_info(namespace, pod, include_events, include_logs)
    prompt = create_prompt(msg, info)
    
    completion = openAiClient.chat.completions.create(
        model="gpt-3.5-turbo",
        messages=[
            {"role": "system", "content": "You are a kubernetes expert, and will help the user with request below based on the context and info provided"},
            {"role": "user", "content": prompt}
        ]
    )
    return completion.choices[0].message.content</code></pre><h2>Usage</h2><p>We need one piece of code to wrap everything together:</p><pre><code>if __name__ == "__main__":
    demo.launch()</code></pre><pre><code>export OPENAI_API_KEY='sk-xxxxxxxxxx'
python app.py</code></pre><p>To use the Pod Doctor application, follow these steps:</p><ol><li><p>Make sure your local kubernetes config is setup try <code>kubectl cluster-info</code></p></li><li><p>Select the desired Kubernetes namespace from the "Namespace" dropdown.</p></li><li><p>Select the pod you want to interact with from the "Pod" dropdown.</p></li><li><p>Optional: Check the "Include Events" and "Include Logs" checkboxes if you want to include pod events and logs in the information provided to the language model.</p></li><li><p>Type your message or query in the text input field and press Enter.</p></li><li><p>The application will display the response from the GPT-4 language model in the chatbot interface.</p></li></ol><p>Let's try a deploying a pod with the wrong port in the probes configuration and ask Pod Doctor to troubleshoot it for us.</p><p>Below is the bad nginx pod we will apply:</p><pre><code>apiVersion: v1
kind: Pod
metadata:
  name: nginx
spec:
  containers:
    - name: nginx
      image: nginx
      ports:
        - containerPort: 80
      livenessProbe:
        httpGet:
          path: /
          port: 81
      readinessProbe:
        httpGet:
          path: /
          port: 81
</code></pre><p>After we apply this yaml we go to our app, select the namespace where we aplied it, select include events and logs, and type `troubleshoot` in the textbox, hit enter and watch the magic:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Mi1J!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Mi1J!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png 424w, https://substackcdn.com/image/fetch/$s_!Mi1J!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png 848w, https://substackcdn.com/image/fetch/$s_!Mi1J!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png 1272w, https://substackcdn.com/image/fetch/$s_!Mi1J!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Mi1J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png" width="1456" height="807" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:807,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Mi1J!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png 424w, https://substackcdn.com/image/fetch/$s_!Mi1J!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png 848w, https://substackcdn.com/image/fetch/$s_!Mi1J!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png 1272w, https://substackcdn.com/image/fetch/$s_!Mi1J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F54171fb1-475d-4d80-81b4-8c8071692189_2000x1108.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Conclusion</h2><p>By combining the power of <a href="https://www.gradio.app/">Gradio</a> for building user interfaces, the <a href="https://github.com/kubernetes-client/python">Kubernetes Python library</a> for interacting with Kubernetes pods, and the advanced language understanding capabilities of GPT-4, the <strong>Pod Doctor</strong> application provides a powerful and intuitive way to interact with and troubleshoot your Kubernetes pods.</p><p>You can find the full code in <a href="https://github.com/codereliant/pod-doctor">github</a>.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join our weekly Newsletter for more tips!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[The Tragic Race Condition]]></title><description><![CDATA[In the early 1980s, a groundbreaking piece of medical technology emerged, promising to revolutionize cancer treatment.]]></description><link>https://www.codereliant.io/p/the-most-tragic-bug</link><guid isPermaLink="false">https://www.codereliant.io/p/the-most-tragic-bug</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Wed, 20 Mar 2024 16:21:20 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!vcG7!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!vcG7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg 424w, https://substackcdn.com/image/fetch/$s_!vcG7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg 848w, https://substackcdn.com/image/fetch/$s_!vcG7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!vcG7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!vcG7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg" width="960" height="550" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:550,&quot;width&quot;:960,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;The Tragic Race Condition&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="The Tragic Race Condition" title="The Tragic Race Condition" srcset="https://substackcdn.com/image/fetch/$s_!vcG7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg 424w, https://substackcdn.com/image/fetch/$s_!vcG7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg 848w, https://substackcdn.com/image/fetch/$s_!vcG7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!vcG7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8267ac85-794b-4305-b678-2ddb24ce7d80_960x550.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In the early 1980s, a groundbreaking piece of medical technology emerged, promising to revolutionize cancer treatment.</p><p>The <a href="https://en.wikipedia.org/wiki/Therac-25">Therac-25</a>, a computer-controlled radiation therapy machine, was a leap forward, promising to deliver precise radiation doses to patients battling cancer. It was one of the first radiation therapy machines controlled <strong>primarily by software</strong> rather than hardwired logic.</p><p>Hospitals eagerly adopted this cutting-edge device, trusting its software to accurately calibrate and deliver calculated dosages of high-energy radiation to destroy cancerous cells without harming surrounding healthy tissue. Little did they know, the Therac-25's software carried lethal bugs that would turn its precision medicine promise into a real-life nightmare.</p><h2>Fatal Flaws</h2><p>Between 1985-1987, a series of horrifying incidents occurred where the Therac-25 massively overdosed patients with radiation levels hundreds of times higher than safe limits. The impacts were catastrophic - causing serious radiation injuries, permanent disabilities, and multiple deaths.</p><h3>Malfunction 54</h3><p>It started at a cancer center in East Texas in 1986. An experienced technician was setting up a radiation treatment, which some training and use of a machine would only take seconds to breeze through. After initially entering the wrong radiation mode code, she quickly course-corrected using the cursor keys as was common practice. The machine then showed an error message "Malfunction 54". The technician had seen these unclear error messages many times before during normal use. She didn't think it was a serious issue, so she went ahead with the treatment anyway.</p><p>But this bypassed an important safety step. It meant the machine's powerful scanning magnets were out of sync with the new radiation settings the technician had entered. As a result, the patient ended up getting blasted with a massive radiation dose - over 16,000 times more than he was supposed to receive. It was radiation exposure on the same level as the Chernobyl nuclear disaster. The patient said it felt like a "burning, shocking" sensation, as if hot coffee had been poured on him. After a few days the patient unfortunately died from the complications of this exposure.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CAwo!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b97504-1737-4503-a387-626bc2b105d8_800x450.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CAwo!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b97504-1737-4503-a387-626bc2b105d8_800x450.gif 424w, https://substackcdn.com/image/fetch/$s_!CAwo!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b97504-1737-4503-a387-626bc2b105d8_800x450.gif 848w, https://substackcdn.com/image/fetch/$s_!CAwo!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b97504-1737-4503-a387-626bc2b105d8_800x450.gif 1272w, https://substackcdn.com/image/fetch/$s_!CAwo!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b97504-1737-4503-a387-626bc2b105d8_800x450.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CAwo!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b97504-1737-4503-a387-626bc2b105d8_800x450.gif" width="800" height="450" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a7b97504-1737-4503-a387-626bc2b105d8_800x450.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:450,&quot;width&quot;:800,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;File:Therac 25 Malfunction 54 8 sec.gif&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="File:Therac 25 Malfunction 54 8 sec.gif" title="File:Therac 25 Malfunction 54 8 sec.gif" srcset="https://substackcdn.com/image/fetch/$s_!CAwo!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b97504-1737-4503-a387-626bc2b105d8_800x450.gif 424w, https://substackcdn.com/image/fetch/$s_!CAwo!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b97504-1737-4503-a387-626bc2b105d8_800x450.gif 848w, https://substackcdn.com/image/fetch/$s_!CAwo!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b97504-1737-4503-a387-626bc2b105d8_800x450.gif 1272w, https://substackcdn.com/image/fetch/$s_!CAwo!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b97504-1737-4503-a387-626bc2b105d8_800x450.gif 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Malfunction 54</figcaption></figure></div><h3>Root Cause Analysis</h3><p>The fatally flawed software behavior was eventually recreated during another patient treatment by the same technician who had dealt with the initial "Malfunction 54" error. Tragically, this second patient also died from a massive radiation overdose. The hospital physicist became convinced there was an underlying issue with how the machine's powerful magnets were controlling and shaping the radiation beam.</p><p>After trying different scenarios, the physicist finally managed to trigger the glitch by rapidly entering treatment settings in a very specific sequence at maximum speed. To his alarm, the amount of radiation being delivered was so high that it went beyond the maximum his testing equipment could measure. Recalibrating the detectors revealed a dose in the range of 10,000 to 20,000 rads - over 100 times the intended therapeutic level and lethally excessive.</p><p><strong>Here's what was happening</strong>: multiple routines were running concurrently in the software, including ones for data entry and keyboard input handling. These routines shared a single variable that recorded when the technician finished entering commands.</p><p>Once data entry completed, the beam calibration and magnet setting phase would begin. However, if the technician made a specific sequence of rapid edits <strong>during that 8-second magnet setting window</strong>, the new settings wouldn't actually apply to the hardware due to the shared program variable.</p><p>The user interface would then display the wrong treatment mode to the technician, who would proceed to confirm and start the potentially lethal treatment, unaware of the inconsistent machine state. This race condition defect was present in the previous Therac-20 model as well. But hardware interlocks on that older system prevented the flaw from actually causing radiation overdoses.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9gQp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9gQp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png 424w, https://substackcdn.com/image/fetch/$s_!9gQp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png 848w, https://substackcdn.com/image/fetch/$s_!9gQp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png 1272w, https://substackcdn.com/image/fetch/$s_!9gQp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9gQp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png" width="518" height="325" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:325,&quot;width&quot;:518,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Radiation Accident - Therac25 - Radiation Oncology Blog&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Radiation Accident - Therac25 - Radiation Oncology Blog" title="Radiation Accident - Therac25 - Radiation Oncology Blog" srcset="https://substackcdn.com/image/fetch/$s_!9gQp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png 424w, https://substackcdn.com/image/fetch/$s_!9gQp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png 848w, https://substackcdn.com/image/fetch/$s_!9gQp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png 1272w, https://substackcdn.com/image/fetch/$s_!9gQp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F64fa7405-d7bb-4043-a13c-c7078977737e_518x325.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>The Aftermath</h2><p>It took over 2 years and multiple serious overdoses before the connection was made to the race condition causing these catastrophic failures in the Therac-25's operation. This resulted in at least 6 incidents, where patients were given massive overdoses of radiation altering their life forever.</p><p>The aftermath investigations found several major contributing causes beyond just the specific race condition software bug. These included:</p><ul><li><p>Poor software development practices at the manufacturer AECL, with lack of independent code review, testing, and safety analysis. The software was <strong>developed by a</strong> <strong>single unidentified programmer</strong> over the course of several years</p></li><li><p>Overconfidence and assurances given to operators that overdoses were impossible, causing them to discount safety warnings and hardware safeties.</p></li><li><p>Engineering issues like cryptic error messages, lack of hardware interlocks, reusing software from older models without verifying safety.</p></li></ul><p>In addition to Malfunction 54 there was a number of other bugs potentially costing lives. The tragedy exposed widespread lapses in regulatory oversight and quality control processes for medical device software at the time. It prompted an overhaul of FDA regulations and safety standards, including:</p><ul><li><p>Mandating rigorous hazard analysis, risk assessment, and testing protocols for safety-critical code.</p></li><li><p>Stricter requirements around software design, development lifecycles, and quality assurance.</p></li><li><p>Enabling better traceability through design history file documentation.</p></li></ul><p>Not many of us work on software projects like this, but the Therac-25 incidents serves as a wake-up call that software bugs could have catastrophic real-world consequences when proper development rigor and safety processes were not followed.</p><p>Links to learn more:</p><ul><li><p><a href="http://sunnyday.mit.edu/papers/therac.pdf">http://sunnyday.mit.edu/papers/therac.pdf</a></p></li><li><p><a href="https://www.youtube.com/watch?v=Ap0orGCiou8">https://www.youtube.com/watch?v=Ap0orGCiou8</a></p></li><li><p><a href="https://www.bugsnag.com/blog/bug-day-race-condition-therac-25/">https://www.bugsnag.com/blog/bug-day-race-condition-therac-25/</a></p></li></ul><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join our weekly Newsletter!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[SRE Interview Prep Plan (Week 6)]]></title><description><![CDATA[Series Overview:]]></description><link>https://www.codereliant.io/p/sre-interview-prep-plan-week-6</link><guid isPermaLink="false">https://www.codereliant.io/p/sre-interview-prep-plan-week-6</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Thu, 14 Mar 2024 17:13:15 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/fb3c0cfa-27f5-46ee-af6e-73f575bccb87_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yWfa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yWfa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!yWfa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!yWfa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!yWfa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yWfa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yWfa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!yWfa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!yWfa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!yWfa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F52636caa-360e-4397-a48b-8fba87a034b9_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@headwayio?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Headway</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>Series Overview:</p><ul><li><p>Week 1: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-1">Fundamentals of SRE</a></p></li><li><p>Week 2: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-2">Automation &amp; Scripting</a></p></li><li><p>Week 3: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-3">Monitoring, Logging, and Alerting</a></p></li><li><p>Week 4: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-4">Incident Management Lifecycle</a></p></li><li><p>Week 5: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-5">Scalability, Performance, &amp; System Design</a></p></li><li><p>Week 6: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-6">Mock Interviews and Revision</a> (This post)</p></li></ul><p>As we step into the final week of our SRE interview preparation plan, it's time to focus and polish our skills.</p><p>Week 6 is designed to simulate the real interview experience, combining technical and behavioral mock interviews with a focused revision period. Through technical mock interviews on Days 1-3, our focus would be to sharpen our problem-solving and communication skills.</p><p>Days 6-7 offers a critical opportunity for revision and personalized feedback, allowing you to refine your approach and improve your understanding based on the insights gained. This final push is about more than just acing your interviews; it's about laying a solid foundation for a thriving career in Site Reliability Engineering.</p><blockquote><p>&#128640; For the mocking interviews you can use ChatGPT or any other suitable AI chat bot. If you want to go through a more authentic experience with a real person you can look for services that provide it as a paid service, e.g. <a href="https://interviewing.io/">https://interviewing.io/</a> (not sponsored)</p></blockquote><h2>Days 1-3: Technical Mock Interviews</h2><h3>Day 1-2: LeetCode Coding Challenges</h3><p>The first day kicks off with a deep dive into LeetCode problems, focusing primarily on data structures and algorithms. Your tasks for the day will include a balanced mix of easy to medium difficulty questions, covering arrays, linked lists, and binary trees. If you know you will be interviewing for a more dev focused roles throw in some hard challenges as well. You should approach problems methodically, emphasizing not just the correctness of your solutions but also their efficiency and scalability. Talk the solutions out loud to illustrate your train of thought, because that's what interviewers would expect from you. After completing the challenges, spend some time reviewing your solutions, identifying areas for optimization and alternative approaches.</p><h3>Day 3: System Design Fundamentals</h3><p>Transitioning from coding challenges, spend Day 3 on System Design problems, a critical component of the SRE interview process. You should already be confident with it, but <a href="https://github.com/prasadgujar/low-level-design-primer/blob/master/questions.md">find some scenarios</a> that require you to design scalable, reliable, and efficient systems, reflecting real-world problems SREs often face. Start with fundamental concepts such as load balancing, caching, and database selection, moving towards designing a complete system by the end of the day. Ensure you consider scalability, resilience, and maintenance, and not just the immediate requirements. Engage in mock interviews where you'll need to explain your design choices, trade-offs, and how you'd monitor and troubleshoot the systems you design.</p><h3>Resources:</h3><ul><li><p><a href="https://leetcode.com/">Leetcode</a></p></li><li><p><a href="https://www.algoexpert.io/product">AlgoExpert</a></p></li><li><p><a href="https://www.hackerrank.com/">HackerRank</a></p></li><li><p><a href="https://www.educative.io/courses/grokking-modern-system-design-interview-for-engineers-managers">Grokking Modern System Design Interview</a></p></li><li><p><a href="https://interviewing.io/">Interviewing.io</a></p></li></ul><p>These three days of intensive technical mock interviews are structured to cover a broad spectrum of topics and question types you're likely to encounter.<br>Remember, the goal is not just to find the right answers but to demonstrate clear, logical thinking, and effective communication of complex ideas.</p><h3>Days 4-5: Behavioral Mock Interviews Focusing on SRE Scenarios</h3><h3>Day 4: Behavioral Interview Fundamentals</h3><p>The fourth day of the week shifts the focus towards behavioral aspects, crucial for any SRE role. This day explore your past experiences, focusing on scenarios that highlight your problem-solving skills, teamwork, leadership, and resilience. The STAR method (Situation, Task, Action, Result) will be your guiding principle, helping you structure your responses in a clear, concise, and compelling manner. Ask yourself questions like, "Describe a time when you had to troubleshoot a critical issue under tight deadlines," or "Tell us about a moment when you proposed a change that significantly improved system reliability." The aim is to not just recount your experiences but to demonstrate your thought process, decision-making skills, and the impact of your actions.</p><h3>Day 5: Incident Management and Collaborative Problem-Solving</h3><p>Building on the behavioral foundations, Day 5 goes into SRE-specific scenarios, particularly focusing on incident management, system failures, and collaborative problem-solving under pressure. You'll face questions designed to uncover your ability to manage crises, coordinate with cross-functional teams, and communicate effectively during high-stakes situations. Prepare for questions like, "Explain how you managed a major service outage," or "Describe your approach to resolving a conflict within your team during a critical system update." Utilizing the STAR method, your responses should clearly articulate how you identified the issue, formulated a strategy, collaborated with others, and implemented a solution that mitigated the impact of the incident.</p><h3>Resources:</h3><ul><li><p><a href="https://www.themuse.com/advice/star-interview-method">Star Interview Method</a></p></li><li><p><a href="https://capd.mit.edu/resources/the-star-method-for-behavioral-interviews/">The Star Method for Behavioral Interview</a></p></li><li><p><a href="https://www.remoterocketship.com/advice/guide/site-reliability-engineer/incident-response-sre-interview-questions-and-answers">10 Incident Response SRE Interview Questions</a></p></li><li><p><a href="https://www.techinterviewhandbook.org/behavioral-interview/">Behavioral Interview for Software Engineers</a></p></li></ul><p>These two days of behavioral mock interviews are crucial for demonstrating your soft skills, which are as important as your technical skills in an SRE role. Employers look for candidates who not only have the technical expertise to manage and improve systems but also the interpersonal skills to work effectively within teams and handle stress and conflict gracefully.</p><h2>Days 6-7: Revision and Feedback</h2><h3>Day 6: Comprehensive Revision</h3><p>On Day 6, it's time to consolidate your learnings from the week. Begin with a thorough review of the technical concepts and system design principles you tackled in the first three days. Revisit the LeetCode problems and system design scenarios, paying special attention to the areas where you felt challenged or received constructive feedback. This is also a good opportunity to refine your understanding of SRE fundamentals, including reliability patterns, performance metrics, and incident management protocols. Use this day for focused study sessions, perhaps revisiting key resources or tutorials that address your areas for improvement. The goal is to reinforce your knowledge base and sharpen your skills, ensuring you're well-prepared for any technical question that might come your way.</p><h3>Day 7: Reflecting on Feedback and Setting Goals</h3><p>The final day of your interview preparation plan is dedicated to reflection and forward planning. Start by reviewing the feedback received during your mock interviews. Identify common themes or areas for improvement, whether they relate to technical skills, communication, problem-solving approaches, or behavioral responses. Reflect on this feedback critically, acknowledging your strengths and recognizing areas where you can grow.</p><p>After this reflection, set <strong>actionable goals</strong> for continued improvement. These might include continue mastering specific technical skills, practicing the STAR method to refine your storytelling abilities, or engaging in more real-world problem-solving exercises to build your confidence and competence in SRE scenarios. Consider scheduling follow-up mock interviews with peers or mentors to assess your progress against these goals.</p><p>Additionally, use this day to practice self-care and mental preparation. Interviewing can be stressful, and ensuring you're mentally and physically ready is as important as the technical and behavioral preparation.</p><p>Days 6 and 7 wrap up your intensive interview preparation plan by emphasizing the importance of self-assessment and continuous improvement. By taking the time to review, reflect, and set future goals, you're not just preparing to succeed in your interviews but also laying the groundwork for a thriving career.</p><h2>Conclusion</h2><p>As we conclude our six-week SRE interview preparation journey, remember that the essence of success lies in the balance between both technical and behavioral proficiency.</p><blockquote><p>&#128640; Stay committed to continuous learning, and approach your interviews with confidence. Don't stop practicing preparation topics while you are hunting for jobs, talking to recruiters and engineering managers. <strong>Good luck!</strong></p></blockquote><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Codereliant&#8217;s Substack! Subscribe for free to receive new posts and support our work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[The 2038 Problem]]></title><description><![CDATA[The "Harmless" Y2K]]></description><link>https://www.codereliant.io/p/the-2038-problem</link><guid isPermaLink="false">https://www.codereliant.io/p/the-2038-problem</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Tue, 05 Mar 2024 15:57:05 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f89a7bc0-a159-4abd-beae-39c15ffd904d_2000x1132.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aiml!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aiml!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aiml!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aiml!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aiml!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aiml!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aiml!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg 424w, https://substackcdn.com/image/fetch/$s_!aiml!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg 848w, https://substackcdn.com/image/fetch/$s_!aiml!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!aiml!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb53bd7ef-3059-4eb1-84ef-7f48b50a0b2a_2000x1132.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@vixenly?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Kym MacKinnon</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><h2>The "Harmless" Y2K</h2><p>Remember the <a href="https://en.wikipedia.org/wiki/Year_2000_problem">"Year 2000" problem</a> (or Y2K) in the late 90s? This referred to the fact that many older computer systems represented years using only two digits. This meant that when the year 2000 arrived, many systems would incorrectly display it as "00" instead of "2000", causing errors with dates and calculations.</p><p>While I was a teenager at the time, I was already into computers so it fascinated me and I was glued to the screen reading about it. When the New Year eve hit... <strong>nothing happened</strong>. Life continued as normal, so all the non-technical people around me said this "threat" was blown out of the proportion to make some news headlines. What I didn't know is that behind the scenes there was a <a href="https://www.si.edu/spotlight/y2k#:~:text=Research%20firm%20Gartner%20estimated%20the,before%20midnight%20December%2031%2C%201999.">massive efforts</a> to remediate systems to avoid major disruptions when the actual date arrived.</p><p>This is a great example of <a href="https://en.wikipedia.org/wiki/Preparedness_paradox">"Preparedness paradox"</a>. When a potential disaster is properly prepared for, <strong>it won't seem like a big deal</strong> after the fact. People will think the precautions were unnecessary. But Y2K could have been a major catastrophe if nothing was done. Some estimates suggested failures in key systems could lead to blackouts, air travel shutdowns, supply chain issues and even <a href="https://journals.sagepub.com/doi/full/10.2968/055002009">nuclear missile system failures</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pHUK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pHUK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png 424w, https://substackcdn.com/image/fetch/$s_!pHUK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png 848w, https://substackcdn.com/image/fetch/$s_!pHUK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png 1272w, https://substackcdn.com/image/fetch/$s_!pHUK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!pHUK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png" width="255" height="363" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:363,&quot;width&quot;:255,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;2038&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="2038" title="2038" srcset="https://substackcdn.com/image/fetch/$s_!pHUK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png 424w, https://substackcdn.com/image/fetch/$s_!pHUK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png 848w, https://substackcdn.com/image/fetch/$s_!pHUK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png 1272w, https://substackcdn.com/image/fetch/$s_!pHUK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb86773d0-fdf2-42c9-ab33-f62b9948ff46_255x363.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><a href="https://xkcd.com/607/">Credit</a></figcaption></figure></div><h2><strong>The End of Time</strong></h2><p>"The 2038 problem" relates to an issue with how Unix-based systems store dates and timestamps. Most Unix systems use a 32-bit signed integer to represent the number of seconds since January 1st, 1970. This is known as the Unix epoch or <a href="https://en.wikipedia.org/wiki/Unix_time">Unix time</a>.</p><p>The core of the issue is that a 32-bit variable can only store integers up to 2147483647. Once the system clock ticks past this at 03:14:07 UTC on January 19, 2038, it will integer to overflow, setting its value to &#8722;(2<sup>31</sup>) , wreaking havoc from there:</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!TQc4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TQc4!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif 424w, https://substackcdn.com/image/fetch/$s_!TQc4!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif 848w, https://substackcdn.com/image/fetch/$s_!TQc4!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif 1272w, https://substackcdn.com/image/fetch/$s_!TQc4!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!TQc4!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif" width="400" height="130" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:130,&quot;width&quot;:400,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!TQc4!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif 424w, https://substackcdn.com/image/fetch/$s_!TQc4!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif 848w, https://substackcdn.com/image/fetch/$s_!TQc4!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif 1272w, https://substackcdn.com/image/fetch/$s_!TQc4!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b9752d1-ab3e-437d-915f-65c8d14e27bb_400x130.gif 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><p>When this overflow happens, any application relying on the correct Unix time stamp will fail or behave erratically. Dates will suddenly show as being in December 1901, calculations will be off, comparisons won't work properly, and overall system functionality will break.</p><h2>The Impact</h2><p>What systems can be impacted by this issue if we don't act accordingly:</p><ul><li><p><strong>Legacy Systems and Embedded Devices:</strong> many older systems, especially those in critical infrastructure like nuclear power plants, airplanes, healthcare devices, telecommunications equipment, and embedded systems in consumer electronics are using 32-bit time representations. These systems are often not updated or replaced frequently, making them the biggest threat.</p></li><li><p><strong>Operating Systems:</strong> some older or less maintained operating systems that still rely on 32-bit time representations will face issues. Although many modern operating systems have transitioned to 64-bit time representations, legacy versions and systems might still be in use in certain environments.</p></li><li><p><strong>Databases: </strong>some databases still operate with 32-bit time fields and apps rely on <code>UNIX_TIMESTAMP()</code> type of queries.</p></li><li><p><strong>File systems:</strong> older file system versions still use 32 bits to represent times in the inodes.</p></li><li><p><strong>Networking Equipment</strong>: networking protocols and systems that use 32-bit time stamps for scheduling, logging, timeout management, etc could fail.</p></li><li><p><strong>Financial Systems:</strong> banking and financial systems that use 32-bit timestamps for transaction processing, logging, or future date calculations may also be impacted.</p></li></ul><p>Essentially any software, service, business or personal function that relies on accurate recording of dates and times is at risk if steps are not taken to address the 2038 problem. And the risks go beyond just computer failures - they extend to legal, <a href="https://twitter.com/jxxf/status/1219009308438024200">financial</a>, scientific and other integrity issues. I don't consider myself a <a href="https://en.wikipedia.org/wiki/Survivalism">prepper</a>, but proactive remediation is needed to avoid catastrophe.</p><p>Let's do a little experiment. Set your system date past January 19, 2038 and see if the software you are working on is still functions properly. Chances are it might break.</p><h2>The Mitigation</h2><p>We are <strong>only 14 years</strong> away. The time is running out fast, but the good news the tech community is already working on mitigation, in order to address the risks before 2038.</p><p>Some OSS examples I found of what being done proactively:</p><ul><li><p><a href="https://www.zdnet.com/article/linux-is-ready-for-the-end-of-time/">Linux is ready to the end of time</a></p></li><li><p><a href="https://linuxiac.com/debian-takes-proactive-steps-to-address-y2k38/">Debian efforts to address Y2K38</a></p></li><li><p><a href="https://lwn.net/Kernel/Index/#Year_2038_problem">LWN coverage of 2038 progress</a></p></li><li><p><a href="https://www.phoronix.com/news/XFS-Linux-5.10">XFS addresses 2038 problem</a></p></li><li><p><a href="https://bugs.mysql.com/bug.php?id=12654">MySQL functions to support 64-bit unix timestamp</a></p></li><li><p><a href="https://github.com/memcached/memcached/pull/934">Memcached fixes log timestamps</a></p></li></ul><p>Implementing the following actions today can significantly reduce your chances of hitting the bugs in your systems:</p><ul><li><p>Identify the inventory of vulnerable systems by thorough inspections and testing to uncover any sections of code, libraries, or dependencies susceptible to the 2038 issue.</p></li><li><p>Transition to a 64-bit system for the storage and management of date and time information, greatly increasing the range of dates that can be accommodated.</p></li><li><p>Adopt alternative formats for date and time, such as ISO 8601, to enhance the robustness and compatibility of data handling.</p></li><li><p>Perform required software, firmware or hardware upgrades and migrations to ensure your systems are future proof. Easier said than done, as some of this would require significant capital/operating investments and multi-year journey to finish.</p></li></ul><h2>Closing Thoughts</h2><p>The Year 2038 bug is real and will bite us if systems are not properly updated. While it may seem distant, the task of updating legacy infrastructure is monumental and time-consuming. We cannot afford to delay.</p><p>And I don't know about you, but I'm definitely not flying or driving anywhere that day &#128516;</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Don't miss the next post!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Chat with your Kubernetes Cluster]]></title><description><![CDATA[Hey there!]]></description><link>https://www.codereliant.io/p/chat-with-your-kubernetes-cluster</link><guid isPermaLink="false">https://www.codereliant.io/p/chat-with-your-kubernetes-cluster</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Fri, 01 Mar 2024 12:03:46 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/ddf140b2-ccfb-4670-902a-f369c135c904_2000x1125.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!JXyH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!JXyH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg 424w, https://substackcdn.com/image/fetch/$s_!JXyH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg 848w, https://substackcdn.com/image/fetch/$s_!JXyH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!JXyH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!JXyH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!JXyH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg 424w, https://substackcdn.com/image/fetch/$s_!JXyH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg 848w, https://substackcdn.com/image/fetch/$s_!JXyH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!JXyH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbcf509f0-e5b0-421d-b545-2bd07fddb690_2000x1125.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@steve_j?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Steve Johnson</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>Hey there! Ever wished you could just chat with your Kubernetes cluster instead of wrestling with endless commands? Well, guess what? Now you can, thanks to a bit of magic from OpenAI's GPT.</p><p>In this post, I'm gonna show you a super simple Python script that lets you do just that. Whether you're a coding newbie or a seasoned pro, you'll see how easy it is to make your Kubernetes cluster understand plain English.</p><p>So, grab your favorite snack, and let's get this coding party started. It's gonna be fun, I promise!</p><h2>Design</h2><p>Here is a diagram illustrating the workflow of the chatbot system, including interactions between the User, Chatbot, OpenAI API, and the Kubernetes cluster:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yc1O!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Febf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yc1O!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Febf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png 424w, https://substackcdn.com/image/fetch/$s_!yc1O!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Febf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png 848w, https://substackcdn.com/image/fetch/$s_!yc1O!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Febf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png 1272w, https://substackcdn.com/image/fetch/$s_!yc1O!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Febf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!yc1O!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Febf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png" width="1048" height="760" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ebf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:760,&quot;width&quot;:1048,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;alt text&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="alt text" title="alt text" srcset="https://substackcdn.com/image/fetch/$s_!yc1O!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Febf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png 424w, https://substackcdn.com/image/fetch/$s_!yc1O!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Febf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png 848w, https://substackcdn.com/image/fetch/$s_!yc1O!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Febf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png 1272w, https://substackcdn.com/image/fetch/$s_!yc1O!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Febf8b302-da2c-4962-834c-0c0dd12663e1_1048x760.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>User to Chatbot</strong>: The user inputs a command or query.</p></li><li><p><strong>Chatbot to OpenAI API</strong>: The chatbot sends the query to the OpenAI API.</p></li><li><p><strong>Conditional Interaction with Kubernetes</strong>:</p><ul><li><p>If the OpenAI API requests the execution of a Kubernetes command, the chatbot executes it on the Kubernetes System and returns the output back to the OpenAI API.</p></li><li><p>If no Kubernetes command is needed, the OpenAI API generates a response based on AI.</p></li></ul></li><li><p><strong>Final Response to User</strong>: The OpenAI API sends the final response to the chatbot, which then displays it to the user.</p></li></ul><h2>Environment Set Up</h2><p>Before we go into the tutorial, ensure you have Python 3 installed and accessible in your terminal. We'll begin by creating a virtual environment and installing two essential libraries: <code>openai</code> and <code>colorama</code>. This setup is crucial for a streamlined development experience.</p><pre><code>mkdir k8s-chat
cd k8s-chat

# set up env
python3 -m venv .venv
source .venv/bin/activate

# install libraries
pip install openai
pip install colorama

# create the python file
# for our code
touch chat_with_k8s.py
</code></pre><h2>Code</h2><p>Let's start by writing a simple python function that will be able to execute any arbitrary <code>kubectl</code> commands:</p><h3>Executing Kubectl commands:</h3><pre><code>import subprocess

def execute_kubectl_cmd(cmd):
    # add kubectl prefix if it's not already there
    if not cmd.startswith("kubectl"):
        cmd = f"kubectl {cmd}"

    if cmd.startswith("kubectl delete"):
        return "I'm sorry, Deleting resources is disabled."
    
    try:
        output = subprocess.check_output(cmd, shell=True)
        return output.decode('utf-8')
    except subprocess.CalledProcessError as e:
        return f"Error executing kubectl command: {e}"
</code></pre><p>This function is a utility for safely executing Kubernetes commands from a Python script. It ensures that commands are correctly formatted, prevents potentially destructive delete operations, and provides feedback on the success or failure of command execution.</p><h3>Tool Definition:</h3><p>Let's then define the using the openai function calling <a href="https://platform.openai.com/docs/guides/function-calling">documentation</a>,</p><pre><code>import json
import subprocess

from colorama import Back, init, Fore
from openai import OpenAI

client = OpenAI()
model_name = "gpt-3.5-turbo-0125"

tools = [
    {
        "type": "function",
        "function": {
            "name": "execute_kubectl_cmd",
            "description": "execute the kubeclt command against the current kubernetes cluster",
            "parameters": {
                "type": "object",
                    "properties": {
                        "cmd": {
                            "type": "string",
                            "description": "the kubectl command to execute",
                        },
                    },
                    "required": ["cmd"],
            },
        },
    }
]</code></pre><p>The <code>client</code> is simply initializing the openai api, and the <code>model_name</code> is just a variable for what model we want to use with our system.</p><p>A list named <code>tools</code> is defined with a single tool (<code>execute_kubectl_cmd</code>), detailing its purpose and required parameters. This tool is intended to execute Kubernetes commands.</p><blockquote><p>&#128161; You are not limited to one function when using gpt function calling</p></blockquote><p><strong>Processing Chat Input</strong>:</p><p>This function contains the chat completion and the interaction with the openai api</p><pre><code>def chat_completion(user_input):
    messages = [{"role": "user", "content": user_input}]
    response = client.chat.completions.create(
        model=model_name,
        messages=messages,
        tools=tools,
        tool_choice="auto",
    )
    response_message = response.choices[0].message
    tool_calls = response_message.tool_calls
    if tool_calls:
        available_functions = {
            "execute_kubectl_cmd": execute_kubectl_cmd,
        }
        messages.append(response_message)
        for tool_call in tool_calls:
            function_name = tool_call.function.name
            function_to_call = available_functions[function_name]
            function_args = json.loads(tool_call.function.arguments)
            function_response = function_to_call(
                cmd=function_args.get("cmd"),
            )
            messages.append(
                {
                    "tool_call_id": tool_call.id,
                    "role": "tool",
                    "name": function_name,
                    "content": function_response,
                }
            )
        second_response = client.chat.completions.create(
            model=model_name,
            messages=messages,
        )
        return second_response.choices[0].message.content
    else:
        return response_message</code></pre><p>Below are the steps the function takes.</p><ul><li><p>The <code>chat_completion</code> function simulates processing user input through an AI model. It prepares the input message, sends it to the OpenAI client, and retrieves a response.</p></li><li><p>If the response includes a call to the <code>execute_kubectl_cmd</code> tool, it executes the command and appends both the AI's response and the command's output to the conversation.</p></li><li><p>It then sends this extended conversation back to the model for further processing, if necessary, and returns the final message content to be displayed to the user.</p></li></ul><h3>Running the Chatbot:</h3><p>The <code>run_conversation</code> function initiates an interactive chat session. It welcomes the user and enters a loop to accept user input.</p><pre><code>def run_conversation():
    print("Welcome to the Kubernetes chatbot!")
    print("You can ask me anything about your Kubernetes cluster.")
    while True:
        print(Back.CYAN + Fore.BLACK + " You: ", end="")
        print(" &gt; ", end="")
        user_input = input()
        if user_input.lower() == "exit" or user_input.lower() == "q":
            print("Goodbye!")
            break
        else:
            resp = chat_completion(user_input)
            print("")
            print(Back.GREEN + Fore.BLACK + " Assitant: ", end="")
            print(" &gt; ", end="")
            print(f"{resp}")
            print("")</code></pre><p>If the user types "exit" or "q", the chatbot ends the session. Otherwise, it processes the user's input through the <code>chat_completion</code> function.</p><h3>Main Execution</h3><p>Finally, the script initializes Colorama's auto-reset feature (to prevent color codes from leaking into unrelated terminal output) and starts the conversation loop.</p><pre><code>def main():
    init(autoreset=True)
    run_conversation()


if __name__ == "__main__":
    main()</code></pre><p>To run the code, just make sure that you have <code>OPENAI_API_KEY</code> secret in the env and that you are running from the <code>venv</code> env created at the beginning of the post.</p><blockquote><p>&#128161; In order to obtain the OpenAI api key secret, you need to create an account with OpenAI, and add $$ to it. You can find more on this <a href="https://help.openai.com/en/articles/4936850-where-do-i-find-my-openai-api-key">page</a>.</p></blockquote><pre><code>export OPENAI_API_KEY="xxxxxxxxxx"
python chat_with_k8s.py</code></pre><h2>Demo</h2><p>We will use <a href="https://kind.sigs.k8s.io/">Kind</a> to run a local kubernetes cluster, and chat with it.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!SCAI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!SCAI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png 424w, https://substackcdn.com/image/fetch/$s_!SCAI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png 848w, https://substackcdn.com/image/fetch/$s_!SCAI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png 1272w, https://substackcdn.com/image/fetch/$s_!SCAI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!SCAI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png" width="1456" height="713" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:713,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;chat with k8s demo&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="chat with k8s demo" title="chat with k8s demo" srcset="https://substackcdn.com/image/fetch/$s_!SCAI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png 424w, https://substackcdn.com/image/fetch/$s_!SCAI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png 848w, https://substackcdn.com/image/fetch/$s_!SCAI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png 1272w, https://substackcdn.com/image/fetch/$s_!SCAI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd6b0ff76-83b0-47c0-ae40-6512b372cbfb_2000x979.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Utilizing the <code>openai</code> library, we seamlessly interact with the GPT AI model, particularly through function calling, streamlining the process of communicating with functions or APIs. This demonstrates the practicality and efficiency of integrating AI into operational scripts.</p><p>for the full code, you can check the <a href="https://github.com/codereliant/k8s-chatbot">git repository</a>.</p><p>And don't forget to sign up to get fresh content delivered to your inbox.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Codereliant&#8217;s Substack! Subscribe for free to receive new posts and support our work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA["14 Years of Go" by Rob Pike]]></title><description><![CDATA[At the closing talk of GopherConAU 2023, Rob Pike, one of the original creators of Go, shared a retrospective on the 14-year journey of the Go programming language.]]></description><link>https://www.codereliant.io/p/14-years-of-go</link><guid isPermaLink="false">https://www.codereliant.io/p/14-years-of-go</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Fri, 23 Feb 2024 16:55:23 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/bb1de6c4-235f-4925-a6a0-98b480fc8a1a_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CaFH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CaFH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!CaFH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!CaFH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!CaFH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CaFH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CaFH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!CaFH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!CaFH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!CaFH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe2c937c3-448b-4b41-8677-489f2585e178_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@ffstop?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Fotis Fotopoulos</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>At the closing talk of GopherConAU 2023, <a href="https://en.wikipedia.org/wiki/Rob_Pike">Rob Pike</a>, one of the original creators of Go, shared a retrospective on the 14-year journey of the Go programming language. Celebrating the anniversary of Go's launch as an open-source project, Pike offered a personal, rather than an official Google or Go team perspective. Check it out! But if you are short on time check our notes below.</p><p><strong>Upd</strong>: a stranger from hackernews pointed out that Pike also posted a detailed text version of this talk <a href="https://commandcenter.blogspot.com/2024/01/what-we-got-right-what-we-got-wrong.html">here</a>.</p><div class="captioned-image-container"><figure><div id="youtube2-yE5Tpp2BSGw" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;yE5Tpp2BSGw&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/yE5Tpp2BSGw?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div></figure></div><h4>Beyond a Programming Language</h4><p>Pike told the audience that Go's inception was driven not by a desire to create a new programming language but to address the complexities of modern server software development. Highlighting goals like improved build times, effective dependency management, and efficient multicore CPU utilization, he argued that Go's real triumphs extend into tooling, deployment, and community engagement rather than just language design.</p><h3>Successes Celebrated</h3><p>Pike emphasized several aspects where Go notably succeeded:</p><ul><li><p><strong>Specification and Multiple Implementations</strong>: Go's formal specification from the outset allowed for multiple compatible compiler implementations, providing a diverse ecosystem.</p></li><li><p><strong>Portability: </strong>Go was designed to support easy cross-compilation, allowing developers to write code on any platform and compile it for any other.</p></li><li><p><strong>Compatibility:</strong> Go team has been committed to a compatibility promise, ensuring that code written for earlier versions continues to compile and run correctly with newer versions. This commitment has been crucial for developers relying on Go for long-term projects, providing them with confidence that their codebase will remain stable over time.</p></li><li><p><strong>Concurrency Model</strong>: Go's approach to concurrency, leveraging goroutines and channels, was highlighted as a significant advancement, making concurrent programming more accessible and safer.</p></li><li><p><strong>Standard Library</strong>: The comprehensive standard library was praised for providing a solid foundation for developing modern server software, unifying the community and preventing many libraries from rising at early stages.</p></li><li><p><strong>Interfaces</strong>: Pike emphasized that the way interfaces integrate into Go, enabling polymorphism through composition, is one of the most distinctive and successful aspects of the language. The interface mechanism aligns well with Go's focus on simplicity, readability, and organic code design.</p></li><li><p><strong>Tooling</strong>: The reliability, speed, and ease of use of the Go toolchain, including the compiler, linker, and package manager, were highlighted as key factors in Go's adoption. Tools like <code>go fmt</code> and <code>go vet</code> ensure code consistency and quality, aiding in the maintenance and collaboration of large codebases.</p></li><li><p><strong>Community and Documentation: </strong>The vibrant and supportive Go community was acknowledged for its contributions to enriching the Go ecosystem with libraries, tutorials, and blog posts. Pike also commended the extensive and clear documentation that has significantly facilitated the onboarding of new developers.</p></li></ul><h4>Addressing Criticisms</h4><p>While acknowledging Go's widespread adoption and success in various industries, Pike did areas of contention, such as error handling, the initial absence of generics, and the limitations in reflection capabilities and performance. He expressed personal regrets and areas for improvement, including the standard library and safety measures in the compiler.</p><h4>Looking Forward</h4><p>Pike's talk also looked to the future, suggesting areas where Go could continue to evolve, such as improving compile-time safety checks and exploring memory management strategies like arenas for specific use cases. He underscored the importance of balancing innovation with Go's core principles of simplicity and efficiency.</p><p>As Go continues to mature, its journey offers lessons in language design, community building, and the iterative process of software development.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join our weekly Newsletter for more insights!</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[SRE Interview Prep Plan (Week 5)]]></title><description><![CDATA[Series Overview:]]></description><link>https://www.codereliant.io/p/sre-interview-prep-plan-week-5</link><guid isPermaLink="false">https://www.codereliant.io/p/sre-interview-prep-plan-week-5</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Tue, 13 Feb 2024 16:28:00 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/4ca612a3-f601-4d85-be98-db6e7bcb7821_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!k69G!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!k69G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!k69G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!k69G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!k69G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!k69G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!k69G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!k69G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!k69G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!k69G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5979faca-1ac6-4760-a4fe-e04ac6afdda0_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@campaign_creators?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Campaign Creators</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>Series Overview:</p><ul><li><p>Week 1: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-1">Fundamentals of SRE</a></p></li><li><p>Week 2: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-2">Automation &amp; Scripting</a></p></li><li><p>Week 3: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-3">Monitoring, Logging, and Alerting</a></p></li><li><p>Week 4: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-4">Incident Management Lifecycle</a></p></li><li><p>Week 5: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-5">Scalability, Performance, &amp; System Design</a> (This post)</p></li><li><p>Week 6: <a href="https://www.codereliant.io/p/sre-interview-prep-plan-week-6">Mock Interviews and Revision</a></p></li></ul><p>Welcome to Week 5 of our SRE interview preparation guide, focusing on scalability, performance tuning, and systems design. This week is crucial for understanding how to ensure that systems can handle growth and maintain performance under different loads. As systems grow in users and data, they must scale effectively to meet demand without compromising on performance. This part will equip you with the foundational knowledge needed to tackle these challenges.</p><p>Throughout this week, we'll cover the key concepts of scalability and performance, understand various tuning techniques, and explore real-world case studies to see how theory is applied in practice. Whether you're preparing for an interview or looking to strengthen your skills, this will be valuable for designing and optimizing systems that are robust, efficient, and scalable.</p><h2>Days 1-3: Understanding Scalability and Performance Concepts</h2><h3>Day 1: Introduction to Scalability</h3><ul><li><p><strong>What is Scalability?</strong> Learn the difference between vertical and horizontal scaling and when to use each.</p></li><li><p><strong>Challenges of Scaling</strong>: Discover common challenges in scaling applications, including database bottlenecks, cache invalidation, and the CAP theorem.</p></li></ul><h3>Day 2: Performance Metrics and Tools</h3><ul><li><p><strong>Key Metrics</strong>: Understand the importance of latency, throughput, and error rates in measuring system performance.</p></li><li><p><strong>Monitoring and Observability Tools</strong>: Get acquainted with tools like Prometheus, Grafana, and Elastic Stack for monitoring system health and performance.</p></li></ul><h3>Day 3: Architectural Patterns for Scalability</h3><ul><li><p><strong>Microservices Architecture</strong>: Explore how decomposing applications into microservices can improve scalability.</p></li><li><p><strong>Database Sharding</strong>: Learn about database sharding techniques for distributing data across multiple servers to reduce load.</p></li><li><p><strong>Caching Strategies</strong>: Understand various caching strategies and their impact on performance.</p></li></ul><h3>Sample Interview Questions:</h3><ol><li><p>What is the difference between vertical scaling and horizontal scaling, and when would you use each?</p></li><li><p>How does the CAP theorem affect the design of distributed systems?</p></li><li><p>What are some common challenges you might face when scaling an application, and how would you address them?</p></li><li><p>Explain the importance of latency, throughput, and error rates in measuring the performance of a system.</p></li><li><p>Discuss how you would use a tool like Prometheus or Grafana for monitoring system performance.</p></li><li><p>How can a microservices architecture improve the scalability of an application? What are the potential trade-offs?</p></li><li><p>Describe a scenario where database sharding can be used to improve performance. How does it work?</p></li><li><p>What strategies would you employ to optimize the performance of a web application at the code level?</p></li><li><p>Explain various caching strategies and how they impact system performance.</p></li><li><p>Can you describe a situation where you had to scale a system to meet increased demand? What challenges did you face, and how did you overcome them?</p></li></ol><h3>Resources:</h3><ul><li><p><a href="https://www.amazon.com/stores/Martin-Kleppmann/author/B00Q43XKD6?ref=ap_rdr&amp;isDramIntegrated=true&amp;shoppingPortalEnabled=true">Design Data Intensive Applications</a> (Book)</p></li><li><p><a href="https://www.codereliant.io/p/scaling-software-systems-10-key-factors">Scaling Software Systems: 10 Key Factors</a> (Blog Post)</p></li><li><p><a href="http://highscalability.com/">High Scalability</a> (Blog)</p></li><li><p><a href="https://sre.google/sre-book/reliable-product-launches/">Reliable Product Launches at Scale</a> (SRE Book Chapter)</p></li><li><p><a href="https://www.educative.io/blog/scalable-systems-101">Scalable Systems 101</a> (Blog Post)</p></li><li><p><a href="https://groups.csail.mit.edu/tds/papers/Gilbert/Brewer2.pdf">Perspectives on the CAP Theorem</a> (Paper)</p></li></ul><h2>Days 4-5: Performance Tuning Techniques</h2><h3>Day 4: Optimizing Application Performance</h3><ul><li><p><strong>Code Optimization</strong>: Tips for writing efficient code to reduce latency and increase throughput.</p></li><li><p><strong>Concurrency and Parallelism</strong>: Techniques for leveraging concurrency and parallel processing to improve application performance.</p></li></ul><h3>Day 5: Infrastructure Optimization</h3><ul><li><p><strong>Load Balancing</strong>: Learn how to effectively distribute traffic across servers to maximize resource utilization.</p></li><li><p><strong>Auto-scaling</strong>: Understand how to automatically scale your infrastructure based on the load to maintain optimal performance.</p></li></ul><h3>Sample Interview Questions:</h3><ol><li><p>Describe how you would approach performance tuning in a system that is experiencing high latency.</p></li><li><p>What tools and techniques do you use for identifying performance bottlenecks in a web application?</p></li><li><p>Explain the concept of load balancing and how it can be implemented to improve application performance and availability.</p></li><li><p>How would you implement auto-scaling for a cloud-based application, and what metrics would you monitor to trigger scaling actions?</p></li><li><p>Discuss the impact of database optimization on application performance. What strategies might you employ to optimize database queries?</p></li><li><p>Can you describe a time when you successfully optimized the performance of a system? What was the issue, and what steps did you take to resolve it?</p></li><li><p>What role does caching play in improving system performance, and how do you decide what to cache?</p></li><li><p>How do you ensure that performance optimizations do not negatively impact the maintainability and readability of the code?</p></li></ol><h3>Resources:</h3><ul><li><p><a href="https://www.amazon.com/Systems-Performance-Brendan-Gregg/dp/0136820158/">Systems Performance</a> (Book)</p></li><li><p><a href="https://www.amazon.com/SQL-Tuning-Generating-Optimal-Execution/dp/0596005733">SQL Tuning</a> (book)</p></li><li><p><a href="https://www.brendangregg.com/blog/index.html">Brendan Gregg's Blog</a> (Blog)</p></li><li><p><a href="https://www.youtube.com/watch?v=fhBHvsi0Ql0&amp;ab_channel=USENIX">Linux Systems Performance</a> (Video)</p></li></ul><h2>Days 6-7: System Design</h2><p>In the final days of Week 5, our focus shifts towards system design interviews, emphasizing the creation of large-scale systems such as YouTube, Netflix, Uber, or Messenger from the ground up. Candidates will be challenged to outline their approaches to architecting these platforms, considering scalability, data management, user experience, and performance optimization.</p><p>This exercise tests the ability to integrate various components: like databases, caching, load balancing, and microservices into a cohesive, scalable system. It's an opportunity for candidates to demonstrate their understanding of complex system architectures and their capability to design solutions that are not only efficient and reliable but also scalable and performant under high loads. This segment aims to mimic real-world challenges, preparing candidates for the intricacies of system design they'll encounter in their careers.</p><h3>Sample Interview Questions:</h3><ol><li><p>How would you design a scalable video streaming service like YouTube?</p></li><li><p>Design a global messaging service like WhatsApp or Messenger.</p></li><li><p>How would you architect a ride-sharing service like Uber or Lyft?</p></li><li><p>Design a content delivery network (CDN) to serve web content globally.</p></li><li><p>How would you create a scalable e-commerce platform like Amazon?</p></li><li><p>Design a real-time sports scoring app that can handle millions of users.</p></li><li><p>How would you architect a cloud-based file storage service like Dropbox?</p></li><li><p>Design a scalable social networking platform like Twitter or Instagram.</p></li></ol><p>Resources:</p><ul><li><p><a href="https://www.educative.io/courses/grokking-modern-system-design-interview-for-engineers-managers">Grokking the System Design Interview</a> (Paid Course)</p></li><li><p><a href="https://github.com/donnemartin/system-design-primer">System Design Primer</a> (Guide)</p></li><li><p><a href="https://github.com/karanpratapsingh/system-design">System Design</a> (Guide)</p></li><li><p><a href="https://interviewing.io/guides/system-design-interview">System Design Interview</a> (Guide)</p></li></ul><h2>Conclusion:</h2><p>Through understanding key concepts, mastering tuning techniques, and exploring system design challenges, you're now equipped to tackle the scalability and performance questions that come your way.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Codereliant&#8217;s Substack! Subscribe for free to receive new posts and support our work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Legacy CLIs No More]]></title><description><![CDATA[Linux CLIs are a part of every software engineer's daily workflow.]]></description><link>https://www.codereliant.io/p/legacy-cli-no-more</link><guid isPermaLink="false">https://www.codereliant.io/p/legacy-cli-no-more</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Sun, 04 Feb 2024 20:03:01 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0ca56c33-8c0b-47ef-9c0c-4d99fcd9b045_2000x1500.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FjjX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FjjX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg 424w, https://substackcdn.com/image/fetch/$s_!FjjX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg 848w, https://substackcdn.com/image/fetch/$s_!FjjX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!FjjX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FjjX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FjjX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg 424w, https://substackcdn.com/image/fetch/$s_!FjjX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg 848w, https://substackcdn.com/image/fetch/$s_!FjjX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!FjjX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F684672f4-f1d0-4c94-96cd-5e354afe32b7_2000x1500.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@6heinz3r?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Gabriel Heinzer</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>Linux CLIs are a part of every software engineer's daily workflow. But I still see many developers rely on legacy tools that have been around <em>for decades</em>. It's time to upgrade your CLI toolbelt and switch to faster, more powerful, and flexible tools.</p><ul><li><p><strong>grep &#8594; <a href="https://github.com/BurntSushi/ripgrep">ripgrep</a> (rg)</strong></p><ul><li><p><strong>Significantly</strong> faster, respects <code>.gitignore</code> files, and offers a more user-friendly syntax and output. It&#8217;s designed for speed and efficiency in searching or filtering large amounts of text. If you were to try just one tool from this list - try ripgrep.</p></li></ul></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Aayf!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Aayf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp 424w, https://substackcdn.com/image/fetch/$s_!Aayf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp 848w, https://substackcdn.com/image/fetch/$s_!Aayf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp 1272w, https://substackcdn.com/image/fetch/$s_!Aayf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Aayf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp" width="1396" height="744" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:744,&quot;width&quot;:1396,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Using ripgrep Command in Linux&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Using ripgrep Command in Linux" title="Using ripgrep Command in Linux" srcset="https://substackcdn.com/image/fetch/$s_!Aayf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp 424w, https://substackcdn.com/image/fetch/$s_!Aayf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp 848w, https://substackcdn.com/image/fetch/$s_!Aayf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp 1272w, https://substackcdn.com/image/fetch/$s_!Aayf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F604c3905-4892-41a1-a3b5-98be87640d78_1396x744.webp 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>find &#8594; <a href="https://github.com/junegunn/fzf">fzf</a></strong></p><ul><li><p><code>fzf</code> is a general-purpose command-line fuzzy finder and it would enhance your overall productivity. It can be used to search and select files, command history, processes, hostnames, bookmarks, git commits, and much more. If you try <a href="https://github.com/junegunn/fzf?tab=readme-ov-file#key-bindings-for-command-line">command history search</a> with fzf - you'll never go back to the old ways.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AU4A!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AU4A!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png 424w, https://substackcdn.com/image/fetch/$s_!AU4A!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png 848w, https://substackcdn.com/image/fetch/$s_!AU4A!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png 1272w, https://substackcdn.com/image/fetch/$s_!AU4A!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AU4A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png" width="1338" height="656" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:656,&quot;width&quot;:1338,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AU4A!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png 424w, https://substackcdn.com/image/fetch/$s_!AU4A!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png 848w, https://substackcdn.com/image/fetch/$s_!AU4A!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png 1272w, https://substackcdn.com/image/fetch/$s_!AU4A!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F263fb371-cdde-427e-9a29-a6b6e5aa782d_1338x656.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul></li></ul><ul><li><p><strong>cat &#8594; <a href="https://github.com/sharkdp/bat">bat</a></strong></p><ul><li><p>Adds syntax highlighting for code snippets and integrates with git for side-by-side diff views.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gyXu!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gyXu!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png 424w, https://substackcdn.com/image/fetch/$s_!gyXu!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png 848w, https://substackcdn.com/image/fetch/$s_!gyXu!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png 1272w, https://substackcdn.com/image/fetch/$s_!gyXu!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gyXu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png" width="656" height="327" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:327,&quot;width&quot;:656,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Git integration example&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Git integration example" title="Git integration example" srcset="https://substackcdn.com/image/fetch/$s_!gyXu!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png 424w, https://substackcdn.com/image/fetch/$s_!gyXu!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png 848w, https://substackcdn.com/image/fetch/$s_!gyXu!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png 1272w, https://substackcdn.com/image/fetch/$s_!gyXu!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1fa3b757-db48-4f14-b03e-a78b564ed5b5_656x327.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul></li></ul><ul><li><p><strong>ls &#8594; <a href="https://github.com/eza-community/eza">eza</a> / <a href="https://github.com/lsd-rs/lsd">lsd</a></strong></p><ul><li><p>Both offer color-coded output and icons, so provides visually pleasing and structured display. They are also backwards-compatible with ls, so it would be easy to transition.</p></li></ul></li></ul><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YwG2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00a76921-e151-492b-996e-011d20155237_812x188.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YwG2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00a76921-e151-492b-996e-011d20155237_812x188.png 424w, https://substackcdn.com/image/fetch/$s_!YwG2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00a76921-e151-492b-996e-011d20155237_812x188.png 848w, https://substackcdn.com/image/fetch/$s_!YwG2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00a76921-e151-492b-996e-011d20155237_812x188.png 1272w, https://substackcdn.com/image/fetch/$s_!YwG2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00a76921-e151-492b-996e-011d20155237_812x188.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YwG2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00a76921-e151-492b-996e-011d20155237_812x188.png" width="812" height="188" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/00a76921-e151-492b-996e-011d20155237_812x188.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:188,&quot;width&quot;:812,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="image" title="image" srcset="https://substackcdn.com/image/fetch/$s_!YwG2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00a76921-e151-492b-996e-011d20155237_812x188.png 424w, https://substackcdn.com/image/fetch/$s_!YwG2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00a76921-e151-492b-996e-011d20155237_812x188.png 848w, https://substackcdn.com/image/fetch/$s_!YwG2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00a76921-e151-492b-996e-011d20155237_812x188.png 1272w, https://substackcdn.com/image/fetch/$s_!YwG2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00a76921-e151-492b-996e-011d20155237_812x188.png 1456w" sizes="100vw"></picture><div></div></div></a></figure></div><ul><li><p><strong>du &#8594; <a href="https://dev.yorhel.nl/ncdu">ncdu</a></strong></p><ul><li><p>Offers an interactive interface, making it easier to navigate and understand disk usage. It's user-friendly and provides a clearer view of what's consuming disk space. No more <code>du -hs *</code></p></li></ul></li></ul><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rWev!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rWev!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png 424w, https://substackcdn.com/image/fetch/$s_!rWev!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png 848w, https://substackcdn.com/image/fetch/$s_!rWev!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png 1272w, https://substackcdn.com/image/fetch/$s_!rWev!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rWev!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png" width="602" height="211" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:211,&quot;width&quot;:602,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!rWev!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png 424w, https://substackcdn.com/image/fetch/$s_!rWev!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png 848w, https://substackcdn.com/image/fetch/$s_!rWev!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png 1272w, https://substackcdn.com/image/fetch/$s_!rWev!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F764f8daa-d30d-4a8e-86b5-e01d601c1116_602x211.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a></figure></div><ul><li><p><strong>man &#8594; <a href="https://github.com/tldr-pages/tldr">tldr</a></strong></p><ul><li><p>Simplifies command documentation, providing concise and practical examples. It&#8217;s great for quickly learning or recalling a command without wading through verbose manuals.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZGs2!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZGs2!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png 424w, https://substackcdn.com/image/fetch/$s_!ZGs2!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png 848w, https://substackcdn.com/image/fetch/$s_!ZGs2!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png 1272w, https://substackcdn.com/image/fetch/$s_!ZGs2!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZGs2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png" width="1456" height="723" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:723,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZGs2!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png 424w, https://substackcdn.com/image/fetch/$s_!ZGs2!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png 848w, https://substackcdn.com/image/fetch/$s_!ZGs2!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png 1272w, https://substackcdn.com/image/fetch/$s_!ZGs2!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F28cbd153-36a6-454a-a842-b3fe236ef6f9_1478x734.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div></li></ul></li></ul><ul><li><p><strong>diff &#8594; <a href="https://github.com/dandavison/delta">delta</a></strong></p><ul><li><p>Provides a side-by-side comparison with syntax highlighting, making it far easier to spot differences. It's an excellent tool for code review and comparing file changes.</p></li></ul></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_DOi!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_DOi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png 424w, https://substackcdn.com/image/fetch/$s_!_DOi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png 848w, https://substackcdn.com/image/fetch/$s_!_DOi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png 1272w, https://substackcdn.com/image/fetch/$s_!_DOi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_DOi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png" width="3360" height="1344" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1344,&quot;width&quot;:3360,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;image&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="image" title="image" srcset="https://substackcdn.com/image/fetch/$s_!_DOi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png 424w, https://substackcdn.com/image/fetch/$s_!_DOi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png 848w, https://substackcdn.com/image/fetch/$s_!_DOi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png 1272w, https://substackcdn.com/image/fetch/$s_!_DOi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F270a707a-4b4e-469c-b042-2d23032eab38_3360x1344.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>curl &#8594; <a href="https://github.com/rs/curlie">curlie</a></strong></p><ul><li><p>Offers a more user-friendly interface for making web requests, combining the power of <code>curl</code> with the ease of use typically found in HTTP clients with a more modern interface.</p></li></ul></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!RBP-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!RBP-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png 424w, https://substackcdn.com/image/fetch/$s_!RBP-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png 848w, https://substackcdn.com/image/fetch/$s_!RBP-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png 1272w, https://substackcdn.com/image/fetch/$s_!RBP-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!RBP-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png" width="1684" height="996" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:996,&quot;width&quot;:1684,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!RBP-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png 424w, https://substackcdn.com/image/fetch/$s_!RBP-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png 848w, https://substackcdn.com/image/fetch/$s_!RBP-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png 1272w, https://substackcdn.com/image/fetch/$s_!RBP-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F99c2d10f-c8e5-485c-bf1b-db76f0f18e3c_1684x996.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ul><li><p><strong>dig &#8594; <a href="https://github.com/ogham/dog">dog</a></strong></p><ul><li><p>A modern alternative to <code>dig</code>, featuring a more user-friendly interface, colorful output, and additional DNS query types. It&#8217;s designed for readability and simplicity.</p></li></ul></li></ul><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YyRT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YyRT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png 424w, https://substackcdn.com/image/fetch/$s_!YyRT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png 848w, https://substackcdn.com/image/fetch/$s_!YyRT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png 1272w, https://substackcdn.com/image/fetch/$s_!YyRT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YyRT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png" width="1364" height="890" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:890,&quot;width&quot;:1364,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;A screenshot of dog making a DNS request&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="A screenshot of dog making a DNS request" title="A screenshot of dog making a DNS request" srcset="https://substackcdn.com/image/fetch/$s_!YyRT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png 424w, https://substackcdn.com/image/fetch/$s_!YyRT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png 848w, https://substackcdn.com/image/fetch/$s_!YyRT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png 1272w, https://substackcdn.com/image/fetch/$s_!YyRT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F93c508a4-6fa2-4f1b-9fbe-f03944bee375_1364x890.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><div><hr></div><p>Updating your muscle memory and systems to use these tools may take some time, but the payoff in productivity and capabilities is worth it. Give them a shot!</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Join our weekly newsletter for more tips:</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div>]]></content:encoded></item><item><title><![CDATA[Why Distributed Systems Fail? (part 2)]]></title><description><![CDATA[In the first part of our exploration into the fallacies of distributed computing, we looked into four common misconceptions that can significantly impact the design and functionality of distributed systems: the reliability of the network, the illusion of zero latency, the myth of infinite bandwidth, and the false sense of inherent network security.]]></description><link>https://www.codereliant.io/p/why-distributed-systems-fail-2</link><guid isPermaLink="false">https://www.codereliant.io/p/why-distributed-systems-fail-2</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Mon, 29 Jan 2024 16:35:07 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/d3ee2f00-f798-40ab-9cf7-71c9b14517a3_2000x1335.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!OdRI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!OdRI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg 424w, https://substackcdn.com/image/fetch/$s_!OdRI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg 848w, https://substackcdn.com/image/fetch/$s_!OdRI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!OdRI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!OdRI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!OdRI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg 424w, https://substackcdn.com/image/fetch/$s_!OdRI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg 848w, https://substackcdn.com/image/fetch/$s_!OdRI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!OdRI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1da08300-2d00-4afd-bc08-b66a060408b2_2000x1335.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@bochelly?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Mr. Bochelly</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>In the <a href="https://www.codereliant.io/p/why-distributed-systems-fail-1">first part</a> of our exploration into the fallacies of distributed computing, we looked into four common misconceptions that can significantly impact the design and functionality of distributed systems: the reliability of the network, the illusion of zero latency, the myth of infinite bandwidth, and the false sense of inherent network security.</p><p>Now, in Part 2 of this series, we turn our attention to the remaining four fallacies, each presenting unique challenges and requiring careful consideration:</p><ol><li><p><strong>Topology Doesn't Change:</strong> The oversight of network dynamics and their impact on system performance.</p></li><li><p><strong>There is One Administrator:</strong> The simplification of management responsibilities and control in distributed environments.</p></li><li><p><strong>Transport Cost is Zero:</strong> The underestimation of the resources required for data movement across the network.</p></li><li><p><strong>The Network is Homogeneous:</strong> The assumption that the network environment is uniform and consistent.</p></li></ol><h2>Fallacy 5: Topology Doesn't Change</h2><p>This one is a misconception in distributed computing that disregards the dynamic nature of network topologies. Network topology, the arrangement of various elements (links, nodes, etc.) in a computer network, is not static. Changes can occur due to network expansion, hardware upgrades, outages, or reconfigurations. Designing systems under the assumption of a static topology can lead to significant issues when inevitable changes occur.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!G82t!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!G82t!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png 424w, https://substackcdn.com/image/fetch/$s_!G82t!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png 848w, https://substackcdn.com/image/fetch/$s_!G82t!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png 1272w, https://substackcdn.com/image/fetch/$s_!G82t!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!G82t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png" width="1024" height="768" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:768,&quot;width&quot;:1024,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Topology Change in Scaling&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Topology Change in Scaling" title="Topology Change in Scaling" srcset="https://substackcdn.com/image/fetch/$s_!G82t!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png 424w, https://substackcdn.com/image/fetch/$s_!G82t!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png 848w, https://substackcdn.com/image/fetch/$s_!G82t!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png 1272w, https://substackcdn.com/image/fetch/$s_!G82t!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F24f9f397-1aae-4681-b3b3-b711de456584_1024x768.png 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><ol><li><p><strong>System Rigidity:</strong> Systems designed for a fixed topology may lack the flexibility to adapt to changes, leading to failures or suboptimal performance.</p></li><li><p><strong>Maintenance Challenges:</strong> Regular updates or modifications can become cumbersome and risky in a rigidly designed system.</p></li><li><p><strong>Scalability Issues:</strong> A system that doesn't account for changing topology might struggle to scale efficiently as the network grows or evolves.</p></li><li><p><strong>Inefficient Resource Utilization:</strong> Fixed-topology assumptions can lead to poor resource allocation, as the system cannot dynamically adjust to the most efficient paths or nodes.</p></li></ol><h3>Mitigation Strategies:</h3><ol><li><p><strong>Dynamic Configuration:</strong> Implement mechanisms that allow the system to automatically adapt to changes in network topology.</p></li><li><p><strong>Regular Monitoring and Updates:</strong> Continuously monitor network topology and perform regular updates to ensure the system aligns with the current network state.</p></li><li><p><strong>Decentralization:</strong> Avoid single points of failure by decentralizing functions and resources where feasible.</p></li><li><p><strong>Redundancy:</strong> Incorporate redundancy in network paths and nodes to maintain functionality even if parts of the network change or fail.</p></li><li><p><strong>Flexible Protocols:</strong> Use network protocols that can handle changes in topology without significant disruption.</p></li><li><p><strong>Testing for Variability:</strong> Regularly test the system under varying topological conditions to ensure robustness against changes.</p></li><li><p><strong>Documentation and Communication:</strong> Maintain clear documentation of the network topology and ensure effective communication among team members about changes.</p></li></ol><p>By acknowledging and preparing for the inevitability of changing network topologies, distributed systems can be made more adaptable, resilient, and efficient.</p><h2>Fallacy 6: There is One Administrator</h2><p>The belief that '<em>There is One Administrator</em>' is a fallacy in distributed computing that oversimplifies the management and control of distributed systems. In reality, distributed systems often span multiple administrative domains, each with its own policies, procedures, and management styles. Assuming a single administrative control point can lead to serious misjudgments in system design, particularly in areas related to governance, security, and resource sharing.</p><h3>Implications:</h3><ol><li><p><strong>Coordination Challenges:</strong> Multiple administrators mean coordination becomes more complex, and unilateral decisions are often impractical.</p></li><li><p><strong>Security Policy Conflicts:</strong> Differing security policies and practices across administrative domains can lead to inconsistencies and vulnerabilities.</p></li><li><p><strong>Resource Management Issues:</strong> Assumptions about resource control and allocation can be misguided when multiple administrators are involved.</p></li><li><p><strong>Compliance Complications:</strong> Adhering to various regulatory and policy requirements can be challenging in a multi-administrator environment.</p></li></ol><h3>Mitigation Strategies:</h3><ol><li><p><strong>Distributed Governance:</strong> Establish a governance model that accommodates input and decision-making from all administrative domains.</p></li><li><p><strong>Unified Security Standards:</strong> Work towards a common set of security standards and practices that are agreeable and applicable across all administrative areas.</p></li><li><p><strong>Flexible Resource Allocation:</strong> Implement resource management systems that are flexible and can adapt to the needs and policies of different administrators.</p></li><li><p><strong>Clear Communication Channels:</strong> Ensure clear and effective communication channels among various administrators to facilitate coordination and conflict resolution.</p></li><li><p><strong>Decentralized Control Mechanisms:</strong> Use decentralized control mechanisms where possible to allow for autonomy within different administrative domains.</p></li><li><p><strong>Comprehensive Documentation:</strong> Maintain detailed documentation of system policies, procedures, and agreements that involve multiple administrative domains.</p></li></ol><p>Recognizing the reality of multiple administrators in distributed systems and adopting these strategies can greatly enhance the management, security, and overall functionality of these complex environments.</p><h2>Fallacy 7: Transport Cost is Zero</h2><p>A common fallacy in distributed computing, which overlooks the resources required for data movement across a network. This fallacy ignores the costs associated with bandwidth usage, latency, and the energy required for data transmission. In reality, transporting data, especially large volumes over long distances, incurs significant costs and can impact system performance and efficiency.</p><h3>Implications:</h3><ol><li><p><strong>Resource Inefficiency:</strong> Ignoring transport costs can lead to inefficient use of network resources, such as bandwidth and energy.</p></li><li><p><strong>Increased Operational Costs:</strong> Overlooking the cost of data movement can result in unexpectedly high operational expenses, especially in cloud-based services where data transfer fees are involved.</p></li><li><p><strong>Performance Bottlenecks:</strong> Underestimating transport costs can cause bottlenecks in system performance, particularly when large data transfers are frequent.</p></li></ol><h3>Mitigation Strategies:</h3><ol><li><p><strong>Data Localization:</strong> Keep data as close as possible to its primary users to minimize unnecessary data movement.</p></li><li><p><strong>Bandwidth Management:</strong> Monitor and manage bandwidth usage to optimize data transfer processes and reduce costs.</p></li><li><p><strong>Data Compression:</strong> Employ data compression techniques to reduce the size of data being transported.</p></li><li><p><strong>Cost-Aware Architecture Design:</strong> Design system architectures with a focus on minimizing and optimizing data transport.</p></li><li><p><strong>Selective Data Movement:</strong> Be selective about what data needs to be moved and when, avoiding unnecessary data transfers.</p></li></ol><p>By acknowledging the real costs associated with data transport in distributed systems and implementing these mitigation strategies, it is possible to build more efficient, cost-effective, and environmentally friendly systems.</p><h2>Fallacy 8: The Network is Homogeneous</h2><p>The assumption that 'The Network is Homogeneous' is a fallacy in distributed computing that ignores the diversity in network environments. This fallacy leads to the expectation that all parts of a network will behave similarly and support the same protocols, performance levels, and features. In reality, networks are composed of a variety of devices, technologies, and configurations, each with its own characteristics and limitations.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!M3tR!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!M3tR!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg 424w, https://substackcdn.com/image/fetch/$s_!M3tR!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg 848w, https://substackcdn.com/image/fetch/$s_!M3tR!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!M3tR!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!M3tR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg" width="1391" height="912" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:912,&quot;width&quot;:1391,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;AWS Direct Connect vs VPN&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="AWS Direct Connect vs VPN" title="AWS Direct Connect vs VPN" srcset="https://substackcdn.com/image/fetch/$s_!M3tR!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg 424w, https://substackcdn.com/image/fetch/$s_!M3tR!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg 848w, https://substackcdn.com/image/fetch/$s_!M3tR!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!M3tR!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6ae15c75-133e-4948-b387-11a11de327ab_1391x912.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">AWS Direct Connect vs VPN</figcaption></figure></div><p>For instance, this image above taken from this <a href="https://jayendrapatil.com/aws-direct-connect-vs-vpn/">post</a> shows the various differences in performance, cost, time, and security between AWS VPN and Direct Connect.</p><h3>Implications:</h3><ol><li><p><strong>Compatibility Issues:</strong> A homogeneous network assumption can lead to compatibility problems when systems encounter different network technologies.</p></li><li><p><strong>Performance Variability:</strong> Disregarding network diversity can result in unpredictable performance, as different network segments may have varying capacities and speeds.</p></li><li><p><strong>Scalability Challenges:</strong> Scaling a system becomes more complex when it needs to adapt to diverse network environments.</p></li><li><p><strong>Inadequate Error Handling:</strong> Systems might not be equipped to handle the range of errors that can occur in a heterogeneous network.</p></li></ol><h3>Mitigation Strategies:</h3><ol><li><p><strong>Cross-Network Compatibility:</strong> Design systems and protocols to be compatible with a range of network technologies and standards.</p></li><li><p><strong>Adaptive Performance Tuning:</strong> Implement mechanisms that dynamically adjust performance based on the current network environment.</p></li><li><p><strong>Extensive Testing:</strong> Test systems in a variety of network conditions to ensure robustness and adaptability.</p></li><li><p><strong>Flexible Architecture:</strong> Build a flexible and modular architecture that can easily adapt to different network settings.</p></li><li><p><strong>Detailed Network Analysis:</strong> Regularly analyze the network to understand its composition and tailor the system accordingly.</p></li><li><p><strong>Robust Error Handling:</strong> Develop comprehensive error handling that can manage the diverse failures and issues that arise in heterogeneous networks.</p></li><li><p><strong>User-Aware Optimization:</strong> Optimize system performance based on the specific network characteristics of different user segments.</p></li><li><p><strong>Continuous Monitoring and Updates:</strong> Continuously monitor network performance and update the system to handle evolving network environments.</p></li></ol><p>Recognizing the diversity in network environments and adopting these strategies helps in building distributed systems that are more resilient, adaptable, and capable of operating efficiently across heterogeneous networks.</p><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">Thanks for reading Codereliant&#8217;s Substack! Subscribe for free to receive new posts and support our work.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><p></p>]]></content:encoded></item><item><title><![CDATA[Why Distributed Systems Fail? (part 1)]]></title><description><![CDATA[Distributed systems are tricky - it's easy to make wrong assumptions that lead to problems down the road.]]></description><link>https://www.codereliant.io/p/why-distributed-systems-fail-1</link><guid isPermaLink="false">https://www.codereliant.io/p/why-distributed-systems-fail-1</guid><dc:creator><![CDATA[Team CodeReliant]]></dc:creator><pubDate>Tue, 23 Jan 2024 16:01:52 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/1404e1c0-5f1d-4bfe-83b2-bbea88e27f11_2000x1333.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!8xEB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!8xEB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!8xEB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!8xEB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!8xEB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!8xEB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:null,&quot;width&quot;:null,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!8xEB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg 424w, https://substackcdn.com/image/fetch/$s_!8xEB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg 848w, https://substackcdn.com/image/fetch/$s_!8xEB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!8xEB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7b911d5-f109-4df6-bc52-df54b5442aff_2000x1333.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div></div></div></a><figcaption class="image-caption">Photo by <a href="https://unsplash.com/@nci?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">National Cancer Institute</a> / <a href="https://unsplash.com/?utm_source=ghost&amp;utm_medium=referral&amp;utm_campaign=api-credit">Unsplash</a></figcaption></figure></div><p>Distributed systems are tricky - it's easy to make wrong assumptions that lead to problems down the road. Back in the 90s, computer scientist L. Peter Deutsch <a href="https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing">identified</a> several common misconceptions, or "fallacies," that trip up engineers working on distributed systems. Surprisingly these fallacies are still relevant today:</p><ol><li><p><strong>The Network is Reliable:</strong> It's risky to assume networks are 100% reliable. Networks can and do fail in various ways.</p></li><li><p><strong>Latency is Zero:</strong> While we might wish our networks had no latency, that's simply not physically possible - even light takes time to travel distances. Ignoring the inevitable delay in data transmission can lead to unrealistic expectations of system performance.</p></li><li><p><strong>Bandwidth is Infinite:</strong> This overlooks the physical and practical limitations on data transfer rates.</p></li><li><p><strong>The Network is Secure:</strong> No wonder Security is a growing industry. Assuming inherent security can lead to vulnerabilities and oversight in protective measures.</p></li><li><p><strong>Topology Doesn't Change:</strong> This neglects the dynamic nature of network configurations.</p></li><li><p><strong>There is One Administrator:</strong> A simplification that fails to consider the complexity of managing distributed systems.</p></li><li><p><strong>Transport Cost is Zero:</strong> Overlooking the resources required for data movement.</p></li><li><p><strong>The Network is Homogeneous:</strong> Ignoring the diversity in network systems and standards.</p></li></ol><p>These fallacies, if not recognized and addressed, can lead to design flaws, performance issues, and security vulnerabilities in distributed systems. In the following sections, we will break down each of these misconceptions, exploring their implications and how to mitigate the risks they pose in real-world applications.</p><h2>Fallacy 1: The Network is Reliable</h2><p>The belief that '<em>The Network is Reliable</em>' is one of the most common and risky assumptions in the field of distributed computing. This fallacy leads to an underestimation of the likelihood and impact of network failures. In reality, networks are susceptible to a range of issues, from temporary outages and packet loss to more severe disruptions caused by hardware failures, software bugs, or external factors like natural disasters.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bnFA!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bnFA!,w_424,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif 424w, https://substackcdn.com/image/fetch/$s_!bnFA!,w_848,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif 848w, https://substackcdn.com/image/fetch/$s_!bnFA!,w_1272,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif 1272w, https://substackcdn.com/image/fetch/$s_!bnFA!,w_1456,c_limit,f_webp,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bnFA!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif" width="372" height="274" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:274,&quot;width&quot;:372,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;The Network is not Reliable&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="The Network is not Reliable" title="The Network is not Reliable" srcset="https://substackcdn.com/image/fetch/$s_!bnFA!,w_424,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif 424w, https://substackcdn.com/image/fetch/$s_!bnFA!,w_848,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif 848w, https://substackcdn.com/image/fetch/$s_!bnFA!,w_1272,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif 1272w, https://substackcdn.com/image/fetch/$s_!bnFA!,w_1456,c_limit,f_auto,q_auto:good,fl_lossy/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5cc2b075-0ee5-41e6-b072-9f668cb090b1_372x274.gif 1456w" sizes="100vw"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">The Network is not Reliable</figcaption></figure></div><h3><strong>Implications:</strong></h3><ol><li><p><strong>System Downtime:</strong> Relying on a flawless network can lead to significant system downtime when inevitable failures occur.</p></li><li><p><strong>Data Loss or Corruption:</strong> Without robust handling of network issues, data may be lost or corrupted during transmission.</p></li><li><p><strong>Security Vulnerabilities:</strong> Assuming network reliability might lead to neglecting necessary security protocols, potentially exposing the system to attacks.</p></li><li><p><strong>Poor User Experience:</strong> Applications that don't account for network unreliability can frustrate users with inconsistent performance.</p></li></ol><h3><strong>Mitigation Strategies:</strong></h3><ol><li><p><strong><a href="https://www.codereliant.io/p/reliability-foundations-redundancy">Redundancy</a>:</strong> Implement redundant network paths and failover mechanisms to maintain system functionality during network failures.</p></li><li><p><strong><a href="https://www.codereliant.io/p/retries-backoff-jitter">Retries and Timeouts</a>:</strong> Incorporate intelligent retry mechanisms with exponential backoff and sensible timeout settings to handle transient network issues.</p></li><li><p><strong>Acknowledgment Mechanisms:</strong> Use acknowledgment messages to confirm the successful reception of data.</p></li><li><p><strong>Monitoring and Alerting:</strong> Establish comprehensive monitoring and alert systems to detect and respond to network issues promptly.</p></li><li><p><strong><a href="https://www.codereliant.io/p/lets-build-loadbalancer-go">Load Balancing</a>:</strong> Utilize load balancers to distribute traffic evenly across the network, preventing overload on any single point.</p></li><li><p><strong>Caching:</strong> Employ caching strategies to provide users with immediate access to data during short network outages.</p></li><li><p><strong>Data Validation and Correction:</strong> Implement checksums and error correction protocols to ensure data integrity.</p></li><li><p><strong><a href="https://www.codereliant.io/p/failing-with-dignity">Graceful Degradation</a>:</strong> Design systems to degrade functionality gracefully in the face of network issues, maintaining a level of service where possible.</p></li></ol><p>By acknowledging and preparing for the inherent unreliability of networks, distributed systems can be made more robust, resilient, and user-friendly.</p><h2>Fallacy 2: Latency is Zero</h2><p>The assumption that '<em>Latency is Zero</em>' is a common oversight in distributed systems. This fallacy ignores the time taken for data to travel across the network. In reality, latency is affected by a multitude of factors, including physical distance, network bandwidth, router hops, and the quality of connections. Even in high-speed networks, latency can never be completely eliminated.</p><h3><strong>Implications:</strong></h3><ol><li><p><strong>Performance Issues:</strong> Applications designed without considering latency can suffer from poor performance, especially in scenarios requiring real-time data processing.</p></li><li><p><strong>User Experience Degradation:</strong> Interactive applications, such as online gaming or video conferencing, can become frustratingly slow, impacting user satisfaction.</p></li><li><p><strong>Inaccurate System Synchronization:</strong> Time-sensitive operations may fail or produce erroneous results due to unexpected delays.</p></li><li><p><strong>Inefficient Resource Utilization:</strong> Overlooking latency can lead to suboptimal resource allocation, as systems might wait unnecessarily for responses.</p></li></ol><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!s0vC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!s0vC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png 424w, https://substackcdn.com/image/fetch/$s_!s0vC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png 848w, https://substackcdn.com/image/fetch/$s_!s0vC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png 1272w, https://substackcdn.com/image/fetch/$s_!s0vC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!s0vC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png" width="1456" height="741" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:741,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;Latency numbers every programmers should know&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="Latency numbers every programmers should know" title="Latency numbers every programmers should know" srcset="https://substackcdn.com/image/fetch/$s_!s0vC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png 424w, https://substackcdn.com/image/fetch/$s_!s0vC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png 848w, https://substackcdn.com/image/fetch/$s_!s0vC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png 1272w, https://substackcdn.com/image/fetch/$s_!s0vC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0d1ed316-552f-4889-966d-4689703daf17_2082x1060.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3><strong>Mitigation Strategies:</strong></h3><ol><li><p><strong>Geographic Distribution:</strong> Place servers and data centers closer to the end-users to minimize physical distance and, consequently, network latency.</p></li><li><p><strong>Optimization of Protocols:</strong> Use efficient communication protocols that minimize overhead and are optimized for the specific use case.</p></li><li><p><strong>Asynchronous Communication:</strong> Implement asynchronous operations to prevent systems from stalling while waiting for responses.</p></li><li><p><strong>Caching Strategies:</strong> Employ caching closer to the user to reduce the need for frequent long-distance data retrieval.</p></li><li><p><strong>Load Balancing:</strong> Utilize smart load balancing that considers geographic location and current network latency.</p></li><li><p><strong>Predictive Fetching:</strong> Anticipate user needs and prefetch data to minimize perceived latency.</p></li><li><p><strong>Performance Testing:</strong> Regularly test the system under realistic network conditions to understand and optimize for latency impacts.</p></li><li><p><strong>User Interface Design:</strong> Design UIs to give immediate feedback to the user, masking underlying network latency.</p></li></ol><p>Acknowledging and accounting for network latency is crucial in designing responsive, efficient, and user-friendly distributed systems. By implementing these strategies, engineers can significantly mitigate the impact of latency on system performance and user experience.</p><h2>Fallacy 3: Bandwidth is Infinite</h2><p>This one leads to overlooking the limitations in data transmission capacity of networks. This misconception can result in designing systems that expect high data throughput regardless of the actual network capabilities. In reality, bandwidth is a limited resource, influenced by network infrastructure, traffic congestion, and the capabilities of end-user devices.</p><h3><strong>Implications:</strong></h3><ol><li><p><strong>Bottlenecks and Slowdowns:</strong> Systems designed without bandwidth constraints in mind can suffer from bottlenecks, leading to significant slowdowns.</p></li><li><p><strong>Inefficient Data Handling:</strong> Overestimating bandwidth can result in sending large amounts of data unnecessarily, wasting network resources and impacting other operations.</p></li><li><p><strong>Poor Scalability:</strong> Systems that don't account for bandwidth limitations may face challenges in scaling up to accommodate more users or data.</p></li><li><p><strong>User Experience Issues:</strong> Users on networks with limited bandwidth might experience delays, interruptions, or even service unavailability.</p></li></ol><h3><strong>Mitigation Strategies:</strong></h3><ol><li><p><strong>Data Optimization:</strong> Compress data to reduce size and optimize formats for efficient transmission.</p></li><li><p><strong>Adaptive Techniques:</strong> Implement adaptive streaming and data transfer techniques that adjust to available bandwidth.</p></li><li><p><strong>Load Balancing:</strong> Use load balancing to distribute network traffic efficiently across available paths.</p></li><li><p><strong>Bandwidth Throttling:</strong> Intelligently throttle bandwidth usage to avoid overwhelming network capacity.</p></li><li><p><strong>Prioritization of Traffic:</strong> Prioritize critical data traffic to ensure essential services remain unaffected during high load.</p></li><li><p><strong>Monitoring and Analytics:</strong> Continuously monitor network performance and use analytics to understand and manage bandwidth usage.</p></li><li><p><strong>Scalable Architecture:</strong> Design a system architecture that can gracefully adapt to varying bandwidth conditions.</p></li></ol><p>By considering the finite nature of bandwidth and implementing these strategies, distributed systems can be designed to be more efficient, reliable, and user-friendly, even under varying network conditions.</p><h2>Fallacy 4: The Network is Secure</h2><p>This fallacy leads to complacency in security measures, overlooking the myriad of threats present in network environments. Network security is not inherent but requires deliberate and continuous effort. Threats can arise from various sources, including external attacks, internal vulnerabilities, and even inadvertent user actions.</p><h3><strong>Implications:</strong></h3><ol><li><p><strong>Vulnerability to Attacks:</strong> Unsecured networks are prone to various types of cyberattacks like hacking, phishing, and DDoS attacks.</p></li><li><p><strong>Data Breaches:</strong> Insufficient network security can lead to unauthorized access and theft of sensitive data.</p></li><li><p><strong>Compliance Issues:</strong> Neglecting network security can result in non-compliance with regulatory standards, leading to legal and financial repercussions.</p></li><li><p><strong>Loss of Trust:</strong> Security incidents can damage the reputation of an organization and erode user trust.</p></li></ol><p><strong>Mitigation Strategies:</strong></p><ol><li><p><strong>Encryption:</strong> Use strong encryption for data in transit and at rest to protect against eavesdropping and data breaches.</p></li><li><p><strong>Authentication and Authorization:</strong> Implement robust authentication mechanisms and ensure strict authorization controls to regulate access.</p></li><li><p><strong>Regular Security Audits:</strong> Conduct regular security audits and vulnerability assessments to identify and rectify potential weaknesses.</p></li><li><p><strong>Firewalls and Intrusion Detection Systems:</strong> Deploy firewalls and intrusion detection systems to monitor and protect network traffic.</p></li><li><p><strong>Security Training:</strong> Educate employees and users about security best practices and the importance of safeguarding network resources.</p></li><li><p><strong>Up-to-date Software:</strong> Keep all network software, including operating systems and applications, updated to patch known vulnerabilities.</p></li><li><p><strong>Network Segmentation:</strong> Segment the network to contain breaches and limit access to sensitive areas.</p></li><li><p><strong>Incident Response Plan:</strong> Develop and maintain an incident response plan to quickly and effectively address security breaches.</p></li></ol><p>Acknowledging the inherent insecurity of networks and implementing these strategies is essential for maintaining the confidentiality, integrity, and availability of distributed systems and their data.</p><div><hr></div><p>In this blog post, we've explored the first four of the eight classic fallacies of distributed computing.</p><p>Subscribe to not miss the next part, where we'll continue to explain these concepts and provide insights into building more resilient distributed architectures.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.codereliant.io/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.codereliant.io/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item></channel></rss>