<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by sowmya m p on Medium]]></title>
        <description><![CDATA[Stories by sowmya m p on Medium]]></description>
        <link>https://medium.com/@sowmya.gowda6316?source=rss-1c8cd9ba9e7a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LoARn5hCxwU7OqydGxHagA.jpeg</url>
            <title>Stories by sowmya m p on Medium</title>
            <link>https://medium.com/@sowmya.gowda6316?source=rss-1c8cd9ba9e7a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 04:17:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sowmya.gowda6316/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How a Small Query Change Unlocked Massive Performance Gains in Azure Cognitive Search]]></title>
            <link>https://medium.com/@sowmya.gowda6316/how-a-small-query-change-unlocked-massive-performance-gains-in-azure-cognitive-search-0d7d952ea837?source=rss-1c8cd9ba9e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d7d952ea837</guid>
            <category><![CDATA[microsoft-azure]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[azure-search]]></category>
            <dc:creator><![CDATA[sowmya m p]]></dc:creator>
            <pubDate>Wed, 26 Nov 2025 18:00:05 GMT</pubDate>
            <atom:updated>2025-11-26T18:00:05.072Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Sometimes the biggest performance wins come from the smallest architectural decisions.<br> This is the story of one such decision.</em></p><p>A few months ago, I was reviewing a search performance issue in a high-traffic product platform. The team had invested in replicas, partitions, auto-scaling, and even query optimizations — but a particular search endpoint remained slow and inconsistent.</p><p>Every attempt to tune it made things… slightly better, but never great.<br> You know that feeling — the “we’re close, but not quite there” kind.</p><p>Then, during a deeper dive into query patterns, one detail stood out:</p><p>👉 The endpoint didn’t need full-text relevance at all.<br> 👉 It only needed to return items whose IDs matched a list.<br> 👉 And yet, we were still performing a full query + filters.</p><p><strong>That was the moment everything clicked.</strong></p><p>A single architectural shift — replacing the normal text query with:</p><ul><li>An <strong>empty search string</strong>, and</li><li>A <strong>search.in() filter for exact matching</strong></li></ul><p>resulted in a dramatic performance improvement.The kind of improvement that makes you stop and ask:<br> <em>“Why didn’t we do this sooner?”</em></p><p>This article breaks down why this works, when to use it, and how to implement it correctly.</p><h3>🔥 Key Takeaways (TL;DR)</h3><ul><li><strong>Empty search strings bypass the query engine</strong> and rely solely on filters — reducing CPU, improving latency, and lowering cost.</li><li><strong>search.in() is optimized for exact matching</strong> and performs significantly faster than performing a full-text query + post-filter.</li><li><strong>Simple QueryType is faster than Full QueryType</strong> when no text search is required.</li><li><strong>This pattern is ideal for ID-based lookups, enrichment APIs, or any search that doesn’t require scoring or relevance.</strong></li><li><strong>Using </strong><strong>SearchMode or complex query parsing is wasted overhead</strong> when you already know the exact items you want.</li></ul><h3>✨ The Turning Point: Empty Query + search.in()</h3><p>When you call this:</p><pre>_azureSearchService.Search(&quot;&quot;, options);</pre><p>Azure Cognitive Search skips:</p><p>❌ Tokenization<br> ❌ Query parsing<br> ❌ Scoring<br> ❌ Ranking<br> ❌ Linguistic analysis</p><p>And instead runs <strong>only the filter</strong>, using the filtering engine — which is extremely efficient.</p><p>Combined with:</p><pre>search.in(fieldName, &#39;value1,value2,value3&#39;, &#39;,&#39;)</pre><p>Azure Search performs <strong>direct match filtering</strong> inside the index structure, which is far faster than evaluating text queries.</p><p>This simple architectural insight was the missing piece.</p><h3>🔍 Code Comparison: Before vs After</h3><p>Below is the exact comparison that led to the performance breakthrough.</p><h3>❌ Before: Full Query Engine, Full Query Parsing</h3><p>This version tells Azure Search:</p><blockquote><em>“Run a full-text search, then filter the results.”</em></blockquote><pre>return new SearchOptions<br>{<br>    SearchMode = SearchMode.All,<br>    QueryType = SearchQueryType.Full,<br>    Size = pageSize,<br>    Skip = (pageNo - 1) * pageSize,<br>    IncludeTotalCount = true<br>};</pre><p>Because the query text is non-empty, Azure:</p><ul><li>parses the query</li><li>tokenizes</li><li>scores</li><li>applies ranking</li><li>applies filters after</li></ul><p>Even if the endpoint doesn’t actually <em>need</em> text relevance.</p><h3>✅ After: Filter-Only Query Using search.in()</h3><p>This version tells Azure Search:</p><blockquote><em>“Do NOT run the text query engine.<br> Just return items that match these exact IDs, respecting our standard filters.”</em></blockquote><pre>var searchRequests = GetDistinctRequestIds();<br>string joined = string.Join(&quot;,&quot;, searchRequests);<br>string idFilter = $&quot;search.in(id, &#39;{joined}&#39;, &#39;,&#39;)&quot;;</pre><pre>var defaultFilter = AdvancedSearch.GetStaticDefaultFilters(<br>    false,<br>    account,<br>    settings.UseSubscriptionFiltering,<br>    settings.AllowedStates<br>);</pre><pre>string combined = string.IsNullOrWhiteSpace(defaultFilter?.ToString())<br>    ? idFilter<br>    : $&quot;({defaultFilter}) and ({idFilter})&quot;;</pre><pre>var sp = new SearchOptions<br>{<br>    QueryType = SearchQueryType.Simple,<br>    Filter = combined,<br>    IncludeTotalCount = true,<br>    Select = { &quot;*&quot; }<br>};</pre><pre>var results = _azureSearchService.Search(&quot;&quot;, sp);</pre><p>What changed:</p><ul><li><strong>QueryType = Simple</strong><br> → Faster because we aren’t parsing any text.</li><li><strong>Empty search string </strong><strong>&quot;&quot;</strong><br> → Skips the query engine entirely.</li><li><strong>search.in()</strong><br> → Highly efficient exact-match filtering.</li></ul><p>The endpoint instantly became:</p><ul><li><strong>faster</strong></li><li><strong>more stable</strong></li><li><strong>cheaper</strong></li><li><strong>easier to reason about</strong></li></ul><p>All without touching infrastructure.</p><h3>🏎️ Why Is This So Much Faster? (Architect Explanation)</h3><p>Full-query mode invokes:</p><ul><li>analyzers</li><li>tokenizers</li><li>scoring models</li><li>ranking profiles</li><li>text normalization</li><li>multi-term query expansion</li><li>fuzzy matching logic</li></ul><p>That’s a <em>lot</em> of compute for a query that doesn’t even require text relevance.</p><p>search.in() avoids all of that.</p><p>It converts your list into something like a hash lookup inside the index’s inverted structure — lightweight, predictable, and optimized.</p><p>This is why:✔ Less CPU✔ Less memory pressure✔ Less query latency✔ More stable P99 response times✔ Lower cost per request</p><p>The difference is especially noticeable under heavy concurrency.</p><h3>📈 When Should You Use This Pattern?</h3><p>Use this pattern whenever the search:</p><ul><li>doesn’t require text relevance</li><li>doesn’t require ranking</li><li>is really just a lookup</li><li>has an exact set of items to retrieve</li><li>needs predictable millisecond-level performance</li></ul><p>Examples:</p><ul><li>enrichment by ID</li><li>item detail hydration</li><li>lookup endpoints</li><li>correlation services</li><li>microservices that need quick index access</li></ul><h3>⚠️ When Not to Use It</h3><p>Avoid search.in() when you need:</p><ul><li>full-text relevance</li><li>semantic matching</li><li>fuzzy search</li><li>prefix / wildcard search</li><li>linguistic analysis</li><li>scoring profiles</li></ul><p>This optimization is perfect for lookups — not discovery.</p><h3>🎯 Closing Thoughts (Call-to-Action)</h3><p>This experience reminded me of something every architect eventually learns:</p><blockquote>Architectural performance doesn’t always come from bigger machines or more replicas.<br> Often, it comes from understanding how your tools really work — and using them the way they were meant to be used.</blockquote><p>Let’s build better systems together. 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d7d952ea837" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Innocent LINQ One-Liner That Exploded at 40,000 Keys]]></title>
            <link>https://medium.com/@sowmya.gowda6316/the-innocent-linq-one-liner-that-exploded-at-40-000-keys-856812c59839?source=rss-1c8cd9ba9e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/856812c59839</guid>
            <dc:creator><![CDATA[sowmya m p]]></dc:creator>
            <pubDate>Wed, 26 Nov 2025 11:18:27 GMT</pubDate>
            <atom:updated>2025-11-26T11:18:27.066Z</atom:updated>
            <content:encoded><![CDATA[<p>This quick read shows how a common LINQ pattern turns into O(N²), and how switching to a HashSet avoids it.</p><p>Every engineering team has that one piece of code nobody wants to touch.</p><p>You know the one:</p><ul><li>It works fine “for now”</li><li>It’s old enough to vote</li><li>Everyone assumes someone else wrote it</li><li>And it smells faintly of technical debt and Starbucks coffee</li><li>In my case, that code powered a key-lookup pipeline that processed thousands of customer IDs through an API.</li></ul><p>It was smooth… for a while.</p><p>Then one day, product asked:</p><blockquote><em>“Can we run this for 40,000 keys instead of 400?”</em></blockquote><blockquote>I said, confidently — foolishly:</blockquote><blockquote><em>“Sure, how bad can it be?”</em></blockquote><p>And then everything exploded.<br> API failures. Timeouts. Delays. CPU spikes.<br> Our logs were basically screaming.</p><p>Turns out we had a silent killer in our code.</p><h3>💀 The Culprit: A Cute LINQ Statement With Murderous Intent</h3><p>Buried deep in the batching logic was this line:</p><pre>.Where(key =&gt; !output.Any(o =&gt;<br>    o.SelectToken(keyLookupConfig.KeyColumnJsonPath)?.ToString() == key))</pre><p>At first glance, it seems innocent.</p><ul><li>“Just filtering keys.”</li><li>“Just making sure we don’t process duplicates.”</li><li>“Looks pretty readable.”</li><li>Yes… and also:</li></ul><p>❌ It performs a full linear scan of the output list</p><p>❌ Inside another linear scan over the key list</p><p>❌ With dynamic JSON parsing in the middle</p><p>❌ For every. single. key.</p><p>This is a classic <strong>O(N²)</strong> trap.</p><p>It was basically saying:</p><blockquote><em>“For every new key, check every object we’ve processed so far, and while you’re at it, re-run JSON parsing each time.”</em></blockquote><p>A 40,000-key job suddenly becomes:</p><pre>40,000 keys × 40,000 output items = 1.6 BILLION comparisons</pre><p>That’s not code.<br> That’s a distributed denial-of-service attack…<br> …on yourself.</p><h3>🤕 How Bad Was It?</h3><p>Let me illustrate the performance difference.</p><p>Imagine two developers:</p><h3>🐌 Developer A: Using .Any() inside .Where()</h3><p>Runs like:</p><pre>for each key:<br>    scan entire output list<br>        parse JSON<br>            compare string</pre><p>Illustration:</p><pre>key1 → [1 2 3 4 5 6 ... 40,000]<br>key2 → [1 2 3 4 5 6 ... 40,000]<br>key3 → [1 2 3 4 5 6 ... 40,000]<br>...</pre><p>Time complexity: <strong>O(N²)</strong><br> Speed: like a sloth solving a sudoku puzzle underwater.</p><h3>🚀 Developer B: Using a HashSet</h3><pre>var returnedKeys = new HashSet&lt;string&gt;();</pre><p>This turns membership checks into O(1):</p><pre>.Where(k =&gt; !returnedKeys.Contains(k))</pre><p>Time complexity: <strong>O(N)</strong><br> Speed: like a cheetah on an electric scooter.</p><h3>🧬 The Fix</h3><p>Here’s the corrected version:</p><pre>// BEFORE: O(N²)<br>var filteredKeyChunk = keyChunk<br>    .Where(key =&gt; !output.Any(o =&gt;<br>        o.SelectToken(jsonPath)?.ToString() == key))<br>    .ToArray();</pre><pre>// AFTER: O(N)<br>var dedupedBatch = keyChunk<br>    .Where(k =&gt; !returnedKeys.Contains(k))<br>    .ToArray();</pre><p>And when adding results:</p><pre>foreach (var obj in parsedBody.Data)<br>{<br>    var key = obj.SelectToken(jsonPath)?.ToString();<br>    if (key != null)<br>        returnedKeys.Add(key);<br>    output.Add(obj);<br>}</pre><p>This is 20x cleaner and 1000x faster.</p><h3>📊 Performance Illustration</h3><p>Let’s visualize this.</p><p>With LINQ .Any() (O(N²)):</p><pre>Keys: 40,000<br>Comparisons: 1.6 billion<br>Time: 30–60 seconds or worse<br>CPU: 100%<br>Logs: “Timeout… retrying… error… help”</pre><h3>With HashSet (O(1) membership):</h3><pre>Keys: 40,000<br>Comparisons: 40,000<br>Time: 50–100 ms<br>CPU: relaxed<br>Logs: “Batch processed in 200ms”</pre><p>HashSet didn’t just improve performance.<br> It <strong>saved the architecture</strong>.</p><h3>🧠 How to Avoid Falling Into the LINQ Trap</h3><h3>✔ NEVER do nested LINQ scans</h3><p>.Where(x =&gt; collection.Any(...)) → danger sign</p><h3>✔ If you’re testing for membership — use a HashSet</h3><p>HashSet is your friend. Your <em>best</em> friend.</p><h3>✔ Be wary of JSON parsing inside loops</h3><p>Even if it looks pretty.</p><h3>✔ Big O matters</h3><p>Even in clean-looking C# code.</p><h3>😂 A Little Humor: Signs You Accidentally Wrote O(N²)</h3><ul><li>Your CPU sounds like it’s about to take off</li><li>Logs appear on a delay, like you’re debugging through a wormhole</li><li>Your batch job starts to feel… batchy</li><li>Someone from DevOps messages you:<br> <em>“Hey… everything okay over there?”</em></li></ul><h3>🎉 Conclusion</h3><p>LINQ is beautiful.<br> LINQ is expressive.<br> LINQ is dangerous.</p><p>Sometimes the shortest code hides the worst performance trap.</p><p>The fix?<br> Use the right data structure.</p><p><strong>HashSet over LINQ </strong><strong>.Any()</strong> — especially when dealing with 40k+ items.</p><p>Your future self will thank you.<br> Your CPU will thank you.<br> Your team will thank you.</p><p>And your retry logs will finally stop screaming.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=856812c59839" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Taming Angular PWA on Azure: Refresh Without the 404 Drama]]></title>
            <link>https://medium.com/@sowmya.gowda6316/taming-angular-pwa-on-azure-refresh-without-the-404-drama-2ae6bf57fade?source=rss-1c8cd9ba9e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ae6bf57fade</guid>
            <dc:creator><![CDATA[sowmya m p]]></dc:creator>
            <pubDate>Tue, 02 Sep 2025 17:05:13 GMT</pubDate>
            <atom:updated>2025-09-02T17:05:13.337Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve ever hit refresh on your Angular app deployed to Azure Web Apps and been greeted with a <strong>404 Page Not Found</strong>, congratulations — you’ve met the classic <em>SPA refresh problem</em>.</p><p>This post is about fixing that problem end-to-end — from <strong>SPA routing</strong>, to <strong>PWA service workers</strong>, to <strong>Azure Web Apps (Windows &amp; Linux)</strong> deployment quirks. And yes, we’ll also talk about <strong>breadcrumbs</strong> (the UI kind, not the ones in your lunch).</p><p>Here’s the end-to-end solution</p><h3>Why Refresh Breaks in Angular SPA</h3><p>When you hit refresh on /dashboard/123, the server thinks you’re asking for a real file at that path. Since it doesn’t exist, boom—<strong>404 error</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xn1eqGDronXiXH5wFiKbjQ.png" /></figure><h3>Fixing Routes with Rewrite Rules</h3><p>On <strong>Windows hosting</strong>, we solve this using web.config rewrite rules.</p><pre>&lt;rule name=&quot;Angular Routes&quot; stopProcessing=&quot;true&quot;&gt;<br>  &lt;match url=&quot;.*&quot; /&gt;<br>  &lt;conditions logicalGrouping=&quot;MatchAll&quot;&gt;<br>    &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsFile&quot; negate=&quot;true&quot; /&gt;<br>    &lt;add input=&quot;{REQUEST_FILENAME}&quot; matchType=&quot;IsDirectory&quot; negate=&quot;true&quot; /&gt;<br>  &lt;/conditions&gt;<br>  &lt;action type=&quot;Rewrite&quot; url=&quot;/index.html&quot; /&gt;<br>&lt;/rule&gt;</pre><p>On <strong>Linux hosting</strong>, Azure expects a routes.json:</p><pre>{<br>  &quot;routes&quot;: [<br>    {<br>      &quot;route&quot;: &quot;/*&quot;,<br>      &quot;serve&quot;: &quot;/index.html&quot;,<br>      &quot;statusCode&quot;: 200<br>    }<br>  ]<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*QKenST36S6WzB3tMUiW41w.png" /></figure><p>Think of it as telling the server:<br> <em>“Hey buddy, don’t worry about the path, just give me </em><em>index.html and let Angular figure it out.&quot;</em></p><h3>Dynamic Breadcrumbs with Re-solvers</h3><p>We also wanted breadcrumbs to show <strong>friendly names</strong> (instead of cryptic IDs). For that, we used <strong>Angular Re-solvers</strong>.</p><p>Example resolver:</p><pre>resolve(route: ActivatedRouteSnapshot): Observable&lt;{ name: string }&gt; {<br>  const id = route.paramMap.get(&#39;id&#39;);<br>  if (!id) return throwError(() =&gt; new Error(&#39;Missing ID&#39;));<br><br>  return this.dataService.getNameById$(id).pipe(<br>    map(name =&gt; ({ name })),<br>    catchError(() =&gt; throwError(() =&gt; new Error(&#39;Not found&#39;)))<br>  );<br>}</pre><p>Breadcrumb Flow:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*qWwL36o9LyAIy8VuCAYGTg.png" /></figure><h3>Making it a PWA</h3><p>PWAs bring offline support, but caching adds complexity.<br> We added these to ngsw-config.json:</p><pre>&quot;navigationUrls&quot;: [<br>  &quot;/**&quot;,<br>  &quot;!/**/*.*&quot;,<br>  &quot;!/**/*__*&quot;<br>]</pre><p>This tells the service worker:</p><ul><li>Cache app routes (/**)</li><li>Ignore static assets (!/**/*.*)</li><li>Ignore dev helper files (!/**/*__*)</li></ul><h3>Handling Service Worker Updates</h3><p>Nobody likes being stuck on old code. We wired up auto-reload when a new version was ready:</p><pre>if (this.swUpdate.isEnabled) {<br>  this.swUpdate.versionUpdates.subscribe((event) =&gt; {<br>    if (event.type === &#39;VERSION_READY&#39;) {<br>      console.log(&#39;New version available:&#39;, event);<br>      window.location.reload(); // Or prompt user nicely<br>    }<br>  });<br>}</pre><p>Update lifecycle:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*__4N0kTSw7Bv4mT7QOlQCw.png" /></figure><p>DevOps + Azure Deployment</p><p>Build command</p><pre>ng build --configuration production --base-href /</pre><h3>Windows (IIS/Azure Web Apps)</h3><ul><li>Add web.config with rewrite rules</li><li>Deploy with static assets</li></ul><h3>Linux (Azure App Service for Linux)</h3><ul><li>Add routes.json in root</li><li>Deploy the build folder</li></ul><h3>Bonus: Do You Really Need --base-href?</h3><p>By default, Angular apps assume they’re hosted at the root (/).<br> But in reality, your app might live under a sub-path, like:</p><pre>https://mydomain.com/myapp/</pre><p>In that case, Angular needs to know where to look for main.js, polyfills.js, and all your lovely bundles. That’s where --base-href comes in:</p><pre>ng build --configuration production --base-href /myapp/</pre><p>This tells Angular to prefix all script and asset URLs with /myapp/.</p><p><strong>Optional Shortcut:</strong><br> If your app is deployed at the root (https://mydomain.com/), then you can skip --base-href entirely — Angular defaults to /.</p><p>But here’s the fun part:</p><ul><li>You can also hardcode &lt;base href=&quot;/&quot;&gt; in your index.html.</li><li>Or configure &quot;baseHref&quot;: &quot;/&quot; in your angular.json.</li><li>Or override it only at build time with the flag.</li></ul><p>So yes, <strong>--base-href is optional</strong>, but knowing when it’s required is the difference between:<br> ✅ <em>“It works on prod!”</em> vs ❌ <em>“Why is Angular looking for </em><em>http://domain.com/main.js when my app is at </em><em>/myapp/?”</em></p><h3>Deployment Notes</h3><ul><li><strong>Windows App Service:</strong> Ensure web.config is copied to dist/.</li><li><strong>Linux App Service:</strong> Add routes.json.</li><li><strong>DevOps Pipelines:</strong> Build command can remain simple:</li></ul><pre>- script: |<br>    npm ci<br>    npm run build -- --configuration production<br>  displayName: &quot;Build Angular App&quot;</pre><h3>Final Thoughts</h3><p>Deploying Angular on Azure is like raising a toddler:</p><ul><li>It refuses to listen (404s everywhere).</li><li>It forgets things (storage isn’t ready yet).</li><li>And sometimes it just throws tantrums (service workers).</li></ul><p>But with a bit of <strong>rewrite magic</strong>, <strong>resolvers for breadcrumbs</strong>, <strong>PWA caching</strong>, and <strong>auto-update handling</strong>, you’ll have a smooth, modern, resilient app.</p><p>Now when someone hits refresh, instead of 404ing, your app will calmly say:<br> <em>“Relax, I got this.”</em></p><p>👉 Don’t forget to test with:</p><pre>npx http-server dist/app -p 8080 -P http://127.0.0.1:8080</pre><h3>TL;DR</h3><ul><li>Angular apps break on refresh in Azure Web Apps because the server looks for /dashboard/123 as a real file.</li><li>Fix it with a <strong>rewrite rule a&gt; Windows hosting</strong> → web.config rewrite to index.html. <strong>b&gt;Linux hosting</strong> → routes.json (Azure App Service) with SPA fallback.</li><li>--base-href in ng build is optional unless your app runs under a subpath.</li><li>Service Worker + ngsw-config.json navigation URLs make your <strong>PWA offline-ready</strong>.</li><li>Added auto-update logic: when a new version is available, reload the app.</li><li>Breadcrumbs powered by <strong>resolver</strong> make routes feel dynamic (and less like plain old paths).</li></ul><p>👉 Result: a <strong>refresh-proof, PWA-ready Angular app</strong> that behaves nicely on Azure without eating your breadcrumbs.</p><p>With the right config, Angular stops acting like a diva on Azure — and your users keep their breadcrumbs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ae6bf57fade" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Killing the Logout Flicker: A Deep Dive into Angular Architecture and Clean Separation of Concerns]]></title>
            <link>https://medium.com/@sowmya.gowda6316/killing-the-logout-flicker-a-deep-dive-into-angular-architecture-and-clean-separation-of-concerns-ae9ecd89d87c?source=rss-1c8cd9ba9e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae9ecd89d87c</guid>
            <dc:creator><![CDATA[sowmya m p]]></dc:creator>
            <pubDate>Sat, 24 May 2025 19:56:59 GMT</pubDate>
            <atom:updated>2025-05-24T19:56:59.564Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>By Sowmya — Senior Software Architect</strong></p><h3>The Problem That Seemed So Small, Yet Felt So Wrong</h3><p>During a routine logout flow in one of my Angular applications, I encountered a subtle but maddening UI glitch — a flicker.</p><p>The sequence was simple:</p><ul><li>User clicks <strong>Logout</strong></li><li>Tokens are cleared</li><li>App navigates to the login page</li></ul><p>Yet, right before the login page appeared, the previous page briefly flashed on screen — like a ghost from the past refusing to let go.</p><p>No errors. No console warnings. Just a tiny UI hiccup that could easily undermine user trust.</p><h3>Initial Diagnosis: Just Angular Being Angular?</h3><p>When dealing with odd UI artifacts, the usual suspects come to mind:</p><ul><li>Misconfiguration route guards</li><li>Component state not resetting properly</li><li>Browser caching quirks</li><li>Race conditions in asynchronous logout flows</li></ul><p>I ran through extensive debugging sessions — console logs, state inspections, route event tracking — but none explained the flicker.</p><p>That’s when I realized the root cause was not purely technical, but architectural.</p><h3>Where Things Went Wrong</h3><p>Buried in one of our services was this method:</p><pre>openEntityView(<br>  entityId: string,<br>  isEditInProgress?: boolean,<br>  isPendingApproval?: boolean,<br>  activeTab?: string<br>): void {<br>  this.router.navigate([&#39;your-base-path/manage-entities&#39;], {<br>    queryParams: {<br>      activeTab: activeTab ?? &#39;defaultTab&#39;,<br>      entity: entityId,<br>      action: isPendingApproval<br>        ? &#39;pending-approval&#39;<br>        : isEditInProgress<br>        ? &#39;edit-in-progress&#39;<br>        : activeTab?.includes(&#39;shared&#39;)<br>        ? &#39;view-use&#39;<br>        : &#39;view&#39;,<br>    },<br>    queryParamsHandling: &#39;merge&#39;,<br>  });<br>}</pre><h3>Why Injecting Angular Components Into Services Is an Anti-Pattern — And How It Killed My Logout UX 🚨</h3><p>Angular is a powerful framework with a well-defined architecture that encourages a clean separation of concerns: <strong>Components</strong> handle UI, <strong>Services</strong> handle business logic and state.</p><p>But sometimes, in the rush of building features, it’s tempting to take shortcuts — like injecting a component directly into a service.</p><p>I recently made this mistake, and it caused a perplexing UI flicker issue during logout in my app’s notification system. Here’s what went wrong, why it’s a critical anti-pattern, and how you can avoid the same trap.</p><h3>The Problem: Injecting a Component as a Singleton Service</h3><p>In my notification feature, I wanted to open a location management drawer from the notification service — so I injected the EntityShellComponent directly:</p><pre>constructor(<br>  private router: Router,<br>  private entityShell: EntityShellComponent // 🚩 Problem here<br>) {}</pre><p>At first glance, this seemed like a neat shortcut: call a component method from the service and show UI immediately.</p><p>But Angular wasn’t designed for this.</p><h3>Why This Is an Anti-Pattern — The Deep Dive</h3><h4><strong>Components Are View Layer, Managed by Angular Lifecycle</strong></h4><p>Angular components are dynamically created and destroyed by the framework as the UI changes. They are <strong>not</strong> designed to be long-lived singletons.</p><p>Injecting a component directly into a service forces it into a singleton scope — meaning:</p><ul><li>The component never gets destroyed by Angular</li><li>Lifecycle hooks like ngOnDestroy() are never called</li><li>The component stays alive long after it should be gone</li></ul><p><strong>Memory Leaks and Zombie DOM References</strong><br> Since the component instance sticks around indefinitely:</p><ul><li>Event handlers, subscriptions, or DOM references inside it can become “zombies”</li><li>Memory isn’t freed, leading to leaks</li><li>UI inconsistencies arise from stale state or hidden DOM nodes</li></ul><p><strong>UI Flickers and Conflicts on Logout or Navigation</strong><br> For modals, drawers, or overlays rendered by the injected component, this causes:</p><ul><li>Conflicting UI elements that don’t clean up properly</li><li>Flickering or “ghost” UI during route changes or logout</li><li>An overall degraded user experience that’s hard to debug</li></ul><h3>How to Fix It — Embrace Angular’s Architecture</h3><h3>Use a Shared Service to Control UI State</h3><p>Instead of injecting the component, create a dedicated service that:</p><ul><li>Maintains observable s representing UI state (e.g., whether the drawer should be open)</li><li>Emits events when UI needs to change</li></ul><p>The component subscribes to this service and reacts accordingly, opening or closing itself based on emitted state.</p><h3>Refactor Example</h3><p><strong>EntityShelfService.ts</strong></p><pre>@Injectable({ providedIn: &#39;root&#39; })<br>export class EntityShelfService {<br>  constructor(private router: Router) {}  openEntityView(<br>    entityId: string,<br>    isEditInProgress?: boolean,<br>    isPendingApproval?: boolean,<br>    activeTab?: string<br>  ): void {<br>    this.router.navigate([&#39;your-base-path/manage-entities&#39;], {<br>      queryParams: {<br>        activeTab: activeTab ?? &#39;defaultTab&#39;,<br>        entity: entityId,<br>        action: isPendingApproval<br>          ? &#39;pending-approval&#39;<br>          : isEditInProgress<br>          ? &#39;edit-in-progress&#39;<br>          : activeTab?.includes(&#39;shared&#39;)<br>          ? &#39;view-use&#39;<br>          : &#39;view&#39;,<br>      },<br>      queryParamsHandling: &#39;merge&#39;,<br>    });<br>  }<br>}</pre><p><strong>NotificationService.ts</strong></p><pre>constructor(private entityShelfService: EntityShelfService) {}<br><br>redirectToDetail(locationId: string) {<br>  this.entityShelfService.openEntityView(entityId);<br>}</pre><h3>Why This Works Better</h3><ul><li><strong>Lifecycle is respected:</strong> The component is created and destroyed by Angular as needed.</li><li><strong>Loose coupling:</strong> Services manage state; components manage UI.</li><li><strong>Memory safety:</strong> No hidden or zombie references hanging around.</li><li><strong>Clear, testable logic:</strong> Services are easier to mock and test independently.</li></ul><h3>Takeaway for Angular Developers</h3><p>If you’re tempted to inject components into services — pause and rethink. Angular’s design encourages separation of concerns:</p><ul><li>Services are for logic, state, and data</li><li>Components are for rendering and UI interaction</li></ul><p>Respecting this separation will save you from tricky bugs, memory leaks, and subtle UI glitches.</p><h3>Final Thought</h3><p>Angular’s magic lies in its lifecycle management and clear architectural patterns. Bending those rules — like injecting components as services — breaks that magic and leads to bugs that can cost hours to debug.</p><p>If you want your Angular app to be scalable, maintainable, and bug-free, embrace its architecture fully. Your users (and your future self) will thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae9ecd89d87c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Efficient Cloud Configuration Management-With Azure Part 1]]></title>
            <link>https://medium.com/@sowmya.gowda6316/efficient-cloud-configuration-management-with-azure-part-1-7a1e4c492f98?source=rss-1c8cd9ba9e7a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a1e4c492f98</guid>
            <category><![CDATA[chicken-and-egg-problem]]></category>
            <category><![CDATA[configuration-management]]></category>
            <category><![CDATA[external-configuration]]></category>
            <category><![CDATA[azure-key-valut]]></category>
            <category><![CDATA[azure-app-configuration]]></category>
            <dc:creator><![CDATA[sowmya m p]]></dc:creator>
            <pubDate>Mon, 23 Sep 2024 12:01:32 GMT</pubDate>
            <atom:updated>2024-09-23T12:01:32.358Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*o-eoyaUWy-fdo3dKuSW85Q.png" /></figure><p>Snoopy he’s the real master of simplifying complex ideas. he will help us understand things clearly and keep us on track!</p><p>Let’s Understand some basic</p><p><strong>Separating configuration from code</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*OZRBFZ_88bbtByBpMCKsoQ.png" /></figure><p>We all seen above code snippet ,When we started our coding journey . Whats wrong with above code ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/1*NjJTxMJH8k4sv89DwaV22w.png" /><figcaption>Above snippet code in real world application is ticking bomb</figcaption></figure><p>Hey Snoopy help us</p><p>Configuration should not be part of the code base but managed <strong>externally</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*mA_yBBxXGJNKQKsdI4Fjiw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*5gpULy0Ef2hTlCk2Ojh05w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*pmoDRDjLXH72zwIWFWAqCg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*4HTTLqn6FfvWBf8xAOHZmQ.png" /></figure><p>Did We really resolve the issue ? lets check</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*PfgTDkbi5tKZ_nD-PE4nBQ.png" /></figure><p>Yes Secrets still are on Application Configuration File, we use</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*32uXBHrDcmaaZnWH8pS4aw.png" /><figcaption>Like Azure Key Vault,AWS Secrets Manager,HashiCorp Vault ..</figcaption></figure><p>A <strong>Secret Management tool</strong> is a software or service designed to securely store, manage, and access sensitive data like API keys, passwords, certificates, and other credentials. It ensures that secrets are protected from unauthorized access while making them easily accessible for applications and users that need them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*hPLRb6_yHVocdJknYhqM3w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*UYE5B4167BCg-vk0sorl1w.png" /><figcaption>Example :Managed Identities are typically used to authenticate Azure services (e.g., Azure VMs, App Services) with Azure resources like Key Vault, Azure SQL Database, and Azure Storage without managing credentials in the application code</figcaption></figure><p>We have resolved issue in the developer perspective , Lets Ask Operations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*hZ0Gae3R6x-nLYop_6Nl-Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*2kRmtoD7bWxAdtnBd5nopQ.png" /></figure><p><strong>Example</strong>:In one environment, an API timeout might be set to 30 seconds, while in another, it’s set to 60 seconds, causing unpredictable behavior or performance issues.</p><p>Impact: Debugging and troubleshooting become harder because configurations differ across environments, making it difficult to identify the source of problems.</p><p>If a new database connection string is introduced, ops teams must update it in all the services using that database, leading to hours or days of repetitive work.</p><p>Impact: Operational overhead increases significantly, reducing team productivity and delaying release</p><p>A production issue caused by an outdated configuration would require operations teams to sift through many individual config files or systems, consuming valuable time.</p><p>Impact: Troubleshooting becomes cumbersome, leading to longer downtime and slower issue resolution.</p><p>If an API URL changes, the operations team must update every application that depends on it, increasing the risk of missing a service or introducing inconsistencies.</p><p>Impact: Change management becomes slow, and updates take longer to propagate, leading to delays and potential downtime.</p><p>Managing configurations for a monolithic app might be feasible manually, but as you adopt micro-services, each service requires separate configuration management, making manual updates unsustainable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MRVA0o3qZ3oeSFJ6AxkZFw.png" /></figure><p><strong>Centralizing configuration management</strong> is a practice that involves storing and managing application configuration settings in a central, easily accessible location. This approach simplifies configuration handling across environments (development, testing, production) and allows for consistent and secure management of settings like database connection strings, API keys, and feature flags.</p><h3>Key Benefits of Centralizing Configuration Management:</h3><ol><li><strong>Consistency Across Environments</strong>: A central configuration store ensures that the same configuration is applied across all environments (development, testing, production), reducing the risk of configuration drift.</li><li><strong>Security</strong>: Sensitive information, such as API keys and connection strings, is securely managed in a centralized platform, often with encryption, access control, and auditing capabilities.</li><li><strong>Simplified Updates</strong>: Changes to configuration can be made in one place and automatically propagated to all applications, reducing the complexity of managing settings for multiple services.</li><li><strong>Separation of Concerns</strong>: Application code is decoupled from configuration, making the app more portable and easier to deploy across different environments.</li><li><strong>Dynamic Configuration</strong>: Some centralized systems support dynamic configuration, allowing apps to reload settings without restarting the service.</li></ol><p>Tool for Centralized Configuration Management we discuss is <strong>Azure App Configuration .</strong></p><p>Azure App Configuration is a service designed to manage application configuration across environments in a centralized and secure way. It supports:</p><ul><li><strong>Key-value pairs</strong> for configuration settings.</li><li><strong>Labeling</strong> to differentiate settings across different environments (e.g., dev, test, prod).</li><li><strong>Dynamic configuration updates</strong> using sentinel keys, which enable applications to refresh configuration without downtime.</li><li><strong>Integration with Azure Key Vault</strong> for securely storing secrets alongside other configuration values.</li></ul><p><strong>Typical Workflow</strong>:</p><ol><li>Store configuration settings in Azure App Configuration.</li><li>Use labels to differentiate settings for environments like dev, test, or production.</li><li>Integrate with Azure services and applications, which fetch configuration at runtime.</li></ol><p>We will deep dive to Azure App Configuration in Part 2</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a1e4c492f98" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>