<?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 Apoorv Adarsh on Medium]]></title>
        <description><![CDATA[Stories by Apoorv Adarsh on Medium]]></description>
        <link>https://medium.com/@apoorv.adarsh?source=rss-1ee2225d7005------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*jFy6inFf4OmNaySY.jpg</url>
            <title>Stories by Apoorv Adarsh on Medium</title>
            <link>https://medium.com/@apoorv.adarsh?source=rss-1ee2225d7005------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 05:01:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@apoorv.adarsh/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[Feature Request: The "Not Responding" Presence State for Microsoft Teams]]></title>
            <link>https://medium.com/@apoorv.adarsh/feature-request-the-not-responding-presence-state-for-microsoft-teams-2afbfe29b05a?source=rss-1ee2225d7005------2</link>
            <guid isPermaLink="false">https://medium.com/p/2afbfe29b05a</guid>
            <dc:creator><![CDATA[Apoorv Adarsh]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 16:29:53 GMT</pubDate>
            <atom:updated>2026-11-19T02:46:15.086Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Don’t infer system health from a green status indicator.</em></p><p>​The current presence indicators in Microsoft Teams—Available, Busy, Do Not Disturb, Away—share a fundamental flaw. They all falsely imply that the biological entity on the other end of the network will eventually return to a functional state and process new requests. They create unrealistic stakeholder expectations. They assume eventual consistency.</p><p>​But anyone who has spent enough time wrestling with legacy technical debt knows that sometimes, the system does not recover. Sometimes, the continuous nine-hour activity monitoring fails to account for a human whose mental CPU is pegged at 100% while yielding absolutely zero output.</p><p>​Therefore, I am formally requesting a new status state: a menacing, pulsating red dot simply titled Not Responding.</p><p>​This is not a temporary away message. This state accurately broadcasts that the user has encountered a fatal unhandled exception. It is the human equivalent of a server timing out, a visual indicator that the biological event loop has completely frozen and all inbound payloads are being dropped straight into the void.</p><p>​The visual design must be a glowing red orb that breathes at the exact frequency of an impending deadline. Think HAL 9000 from 2001: A Space Odyssey, radiating a quiet, dark dread.</p><p>​Critically, this status must be immune to mouse movement. Even if the user is furiously and pointlessly clicking through a frozen VS Code workspace, or trying to figure out why an API is throwing a DNS resolution error, the presence indicator remains steadfastly red. Activity does not equal uptime. Sometimes activity is just a localized panic state.</p><p>​To preserve whatever remains of the user&#39;s core functionality, any inbound ping while in the Not Responding state will immediately trigger a hardcoded auto-reply: &quot;Instead of waiting for a response, please just imagine me nodding thoughtfully.&quot;</p><p>​For maximum stakeholder experience, it will also automatically disable the &quot;Type a new message&quot; box for anyone asking for an ETA on a platform demo.</p><p>​We build highly observable, event-driven architectures, yet we offer zero observability into our own existential exhaustion. We pretend we are &quot;Available&quot; while actively staring into the abyss at office pantry, desperately trying to reboot our own logic circuits. It is time the tools we use reflect the reality of the people using them. Give us the glowing red dot.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2afbfe29b05a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Developer Who Reviewed the Poetry]]></title>
            <link>https://medium.com/@apoorv.adarsh/the-developer-who-reviewed-the-poetry-7a52ccdb1a9c?source=rss-1ee2225d7005------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a52ccdb1a9c</guid>
            <category><![CDATA[ai-code-review]]></category>
            <category><![CDATA[generative-ai]]></category>
            <dc:creator><![CDATA[Apoorv Adarsh]]></dc:creator>
            <pubDate>Wed, 18 Nov 2026 15:37:58 GMT</pubDate>
            <atom:updated>2026-11-18T15:37:58.477Z</atom:updated>
            <content:encoded><![CDATA[<p><em>AI-generated code isn’t bad. Your markdown was.</em></p><h3><strong>Meet the Reviewer</strong></h3><p>Every team has one.</p><p>The reviewer who can tell from three lines of code that something does not belong there. The variable name is vague. The abstraction leaks. The method is doing two things. The exception is caught at the wrong level. There is another implementation somewhere in the repository that already does this properly, and of course the author did not know about it.</p><p>Give this person a pull request and, twenty minutes later, the code is better.</p><p>Now give an AI a ticket that says:</p><blockquote>Add retry to the payment client.</blockquote><p>The model adds retry. The code is reasonably clean. The reviewer changes two names, simplifies the loop, asks for another test and approves it.</p><p>It fails in staging.</p><p>The client retries everything, immediately, several times. One of the requests succeeds but the response times out, so the client helpfully sends it again.</p><p>The ticket never said which errors were retryable. It did not say whether the operation was idempotent, what the retry budget was, how backoff should work, or what to do when the outcome of the previous attempt was unknown.</p><p>None of those decisions existed anywhere.</p><p>The post-incident conclusion writes itself.</p><p><strong><em>AI-generated code needs more careful review.</em></strong></p><p>Nobody reviews the ticket.</p><h3><strong>The Computer Never Read Your Java</strong></h3><p>There is something slightly strange about developers describing code as though the computer appreciates it.</p><blockquote>It does not.</blockquote><p>The computer has never admired your abstraction. It has never complimented your variable names. It has never looked at a particularly elegant use of polymorphism and thought, <em>nice</em>.</p><p>Eventually, it understands something considerably less poetic.</p><blockquote>Binary.</blockquote><p>That is not an argument for writing machine code. It is the opposite. Every useful step in programming-language history moved humans further away from the representation the machine actually executes.</p><p>Assembly saved us from binary. C saved a great many people from assembly and created a different category of accidents. Java decided memory management was somebody else’s problem and gave us several new things to argue about instead. Python decided punctuation was unnecessary but whitespace was sacred.</p><p>At every step, developers accepted the new abstraction and then, quite reasonably, concluded that the level they happened to be working at now was where software engineering finally became poetry.</p><p>We built an entire culture around that assumption. Style guides, idioms, code-review conventions, naming rules and the senior engineer who will reject a perfectly functional pull request because a variable is called data.</p><p>For good reason.</p><blockquote>Code was where ambiguity finally died.</blockquote><p>The requirements could be vague. The design could contain boxes labelled <em>Processing Service</em>. The sequence diagram could stop just before anything difficult happened. Eventually some developer had to decide what the system would actually do when the timeout occurred on attempt three.</p><p>The code became the specification of last resort. Then AI learned to write the code too.</p><p><strong><em>That makes the old arrangement awkward.</em></strong></p><h3>Maybe the Code Wasn’t the Problem</h3><p>I hear some version of this surprisingly often now:</p><blockquote>AI writes bad code.</blockquote><p>Sometimes it does. But when somebody says this, I increasingly want to see what they gave the model.</p><blockquote>Usually it is not a specification.It is a paragraph.Sometimes it is a sentence.</blockquote><p>Occasionally it is a Jira ticket that looks as if somebody intended to come back later and finish writing it, then got invited to another meeting.The model is given an approximate statement of intent and asked to produce something precise.</p><blockquote>So it fills the gaps.</blockquote><p>Humans do this too. We call it experience when they guess correctly and a defect when they do not.</p><blockquote>When a model does it, we call it hallucination.</blockquote><p>But there is an uncomfortable possibility that deserves more attention.</p><p><strong>The AI-generated code wasn’t bad. Your markdown was.</strong></p><p>More precisely, the markdown contained less information than the implementation required. Decisions were missing, and a working system cannot contain missing decisions.</p><p>Somebody had to make them.</p><p>The model volunteered.</p><p><strong><em>That is not always hallucination.</em></strong></p><p>Sometimes it is compliance.</p><h3>The Poetry Needs to Move</h3><p>If AI can reliably turn sufficiently precise intent into implementation, then the most valuable human-readable artifact starts moving upward.</p><p>The interesting question is no longer whether somebody wrote a beautiful retry loop. It is whether anybody decided what was allowed to retry.</p><p>Which state transitions are legal?</p><p>Who owns this data?</p><p>Is this operation idempotent?</p><p>What happens after partial failure?</p><p>Where does authorization happen?</p><p>Which contracts are frozen and which can evolve?</p><p>What does success mean, and what evidence would prove it?</p><p>Those are not primarily coding questions.</p><p>They are decisions that spent a couple of decades hiding in code review because nobody forced them to exist earlier.</p><p>AI does not make specification less important.</p><p><strong>It makes the absence of specification executable.</strong></p><p>That is a much less comfortable proposition than “AI writes bad code”, because buying a better model does not fix it.</p><h3>Two Fixes That Sound Smart and Aren’t</h3><p>The first obvious fix is to use a better model.</p><p>This works, in the narrow sense that a stronger model tends to fill missing decisions with better guesses.</p><p>You still have not made the decisions.</p><p>You have simply hired a more persuasive guesser.</p><p>In some ways that is worse. A weak model produces ridiculous code and starts an argument immediately. A very capable model produces coherent code, explains why the code makes sense, adds tests for the behaviour it invented and gets everybody home by six.</p><p>The second fix is to review harder.</p><p>Read every generated line. Verify the abstractions. Inspect the exception handling. Leave eleven comments.</p><p>This feels responsible.</p><p>It is also proofreading the translation of a letter nobody wrote.</p><p>The reviewer might catch a bad loop. The reviewer might improve the API. The reviewer might rename data.</p><p>What the reviewer is much less likely to discover is:</p><blockquote>Nobody ever decided whether this operation could safely be retried.</blockquote><p>That decision is not in the diff.</p><p>That is the problem.</p><p>It is not anywhere.</p><h3>Give the Adversary Something to Stand On</h3><p>I wrote previously about a related failure mode: allowing the same intelligence to investigate a problem, interpret the evidence, produce an answer and then decide whether the answer is correct.</p><p>It produces a beautifully coherent system.</p><p>So does a conspiracy theory.</p><p>My argument then was that something else needs to disagree. The thing checking the work should have a different interest from the thing that produced it. Do not let the author be the only judge of whether the author was right.</p><p>I still believe that.</p><p>But there is a dependency in that argument that deserves more attention.</p><p><strong>An adversary without a specification is just a critic with opinions.</strong></p><p>Our reviewer was adversarial. There were eleven comments.</p><p>Naming. Structure. Duplication. Readability.</p><p>What the reviewer could not meaningfully challenge was the retry policy, because no retry policy existed.</p><p>Without an explicit statement of what correct means, disagreement collapses into taste.</p><p>So the order matters.</p><p>Before anyone generates the implementation, somebody still has to decide what the system is supposed to do, which constraints it must respect, which contracts cannot move underneath it, and what must never happen. Those decisions need to exist somewhere reviewable before the model starts making plausible ones on our behalf.</p><p>Then the implementation can go to something that did not write it.</p><p>Now the reviewer has a job.</p><p>Not:</p><blockquote>Do I like this code?</blockquote><p>But:</p><blockquote>Where does this implementation diverge from what we agreed?</blockquote><p>Tests become evidence rather than ceremony. Contract checks become evidence. Schema validation, authorization tests, failure injection and integration tests all become ways of establishing whether the implementation deserves to survive.</p><p>Adversaries keep the author honest.</p><p><strong>The specification keeps the adversary honest.</strong></p><h3>But Compilers Don’t Hallucinate APIs</h3><p>There is an obvious objection to the whole abstraction argument.</p><p>We stopped reading assembly because compilers are deterministic. Give the compiler the same input and it does not occasionally decide that CustomerRepository probably contains a findNearestDragon() method.</p><blockquote>Large language models do.That objection is correct.</blockquote><p>We did not stop reading assembly because higher abstraction was fashionable. We stopped because something else earned the trust. Compilers became reliable enough, verification got good enough, and the economics of manually inspecting machine instructions became absurd.</p><p>So generated code cannot simply disappear behind a prompt while everyone congratulates themselves on moving up the abstraction stack.</p><p>Every abstraction needs a trust mechanism.</p><blockquote>For AI-generated software, that mechanism is not the model.It is the chain around it.</blockquote><p>The specification establishes what was intended. The generator turns that intent into an implementation. Something independent attacks the gap between the two. Tests and conformance checks provide evidence of what actually happened.</p><p>If that chain works, I do not particularly care whether the generated code is beautiful.</p><blockquote>I need it to be <strong>demonstrably correct enough for the responsibility it has been given</strong>.</blockquote><p>That is a different standard. One relies on taste. The other leaves receipts.</p><h3>If AI Can Write It, AI Can Explain It</h3><p>There is another objection, and this one matters more. Even if humans stop reading every generated line, somebody still needs to understand the software.</p><blockquote>Yes.</blockquote><p>But if AI can write code, AI can also explain code. The problem is deciding which AI gets asked. Ask the same model that produced the implementation:</p><blockquote>Why is this code correct?</blockquote><p>and we are back to <a href="https://medium.com/@apoorv.adarsh/the-colleague-who-was-never-wrong-9389f53ca2bd?sharedUserId=apoorv.adarsh">the colleague who was never wrong</a>. The explanation will be coherent because the explanation and the implementation grew from the same assumptions.</p><blockquote>That is not a review.It is a closing argument.</blockquote><p>Instead, give another model the specification, the implementation and the evidence. Ask where the implementation introduces assumptions that do not exist in the specification. Ask which test establishes each important claim. Ask what happens at the failure boundaries. Ask what cannot be proven from the available evidence.</p><p>Now explanation becomes useful because it can be contradicted.The important shift is subtle.</p><blockquote>AI-generated code does not require humans to stop understanding software. It may require us to stop pretending that <strong>reading every generated line is the only legitimate way to understand it</strong>.</blockquote><h3>How We Actually Built This</h3><p>We ran into this while building our own AI-assisted delivery workflow.</p><p>The interesting part was not that models produced bad artifacts. Humans had already demonstrated that capability comprehensively.The interesting part was what predicted the failures.</p><p>It was not model size. It was not prompt length. It was not whether the model had been told to “think carefully.” It was how much the upstream artifact had quietly left undecided.</p><blockquote>So we started moving clarification earlier.</blockquote><p>Before a major artifact is produced, ambiguity gets surfaced rather than inherited. Before components are implemented independently, the contracts between them are made explicit and frozen. A downstream implementation does not get to improve an upstream architecture by surprise.</p><p>And because I do not trust the thing that wrote an artifact to be the only thing that approves it, validation sits somewhere else. But that validator does not simply receive the artifact and an instruction to <em>“review this carefully.” </em>That would recreate the poetry reviewer.</p><p>It receives the artifact <strong>and the contract the artifact was supposed to satisfy</strong>.</p><blockquote>Now it has something to attack.</blockquote><p>The models did not become dramatically smarter while we were doing this. <strong>The markdown did.</strong></p><h3>What Code Review Becomes</h3><p>I am not predicting the death of code review.</p><p>Some code deserves direct human inspection precisely because its consequences justify it. Security boundaries, concurrency, cryptography, difficult migrations and sensitive financial operations are obvious examples. But I do think some of what we currently call code review will move.</p><p>Today a surprising amount of review energy is spent on the representation because the representation is where the final decisions live. If those decisions move into explicit, versioned specifications and the implementation is increasingly generated, then the human attention should follow the decisions.</p><p>We should review the contracts. We should review the architecture boundaries. We should review the failure semantics. We should review the definition of done. We should review whether the evidence actually proves any of it.</p><blockquote>The code does not become irrelevant.It simply stops being the only place where truth is allowed to live.</blockquote><p>This may be difficult for developers whose professional identity has been constructed around writing unusually attractive loops.</p><p>They will survive.</p><p>Most professions eventually recover from discovering that one of their tools was not the profession.</p><h3>Why This Is Probably Temporary</h3><p>I should put an expiry date on this, because I do not think today’s AI-development patterns are laws of nature.</p><blockquote>Some failures genuinely belong to the model.</blockquote><p>It invents an API. It forgets something that is plainly present in the repository. It mishandles an edge case that was perfectly well specified. It produces something syntactically valid and operationally ridiculous.</p><blockquote>Better markdown does not fix those. Verification catches them.</blockquote><p>The adversarial structure may also turn out to be scaffolding. If a future model can genuinely leave its own framing, attack its own assumptions and refuse its own coherent-but-wrong work, then some of today’s separate validator roles become unnecessary.</p><blockquote>Fine. I will happily delete them.</blockquote><p>But I do not think the specification disappears with them. Something still has to define what <em>correct</em> means.</p><p>Otherwise the world’s smartest model will simply become extraordinarily efficient at producing excellent implementations of decisions nobody remembers making. The implementation mechanism can change.</p><p>The obligation to decide does not.</p><h3>The Question I’d Ask Now</h3><p>So when somebody tells me:</p><blockquote>AI writes bad code.</blockquote><p>I no longer start by asking which model they used. I want to see the specification.</p><p>I want to know which decisions were explicit and which ones were silently delegated to the model. I want to know who checked those decisions, what that reviewer was checking against, and what evidence survived the process.</p><p>If all of that is sound and the implementation is still wrong, congratulations.</p><blockquote>You found an AI problem.</blockquote><p>If none of it exists, you found something considerably older.</p><blockquote>We used to call it requirements engineering.</blockquote><p>It just has better autocomplete now.</p><p><strong>Adversaries keep the author honest. The specification keeps the adversary honest.</strong></p><p>And if the AI keeps writing bad code, perhaps stop reviewing its poetry for a minute.</p><p><em>Someone should probably review your markdown.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a52ccdb1a9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is This Agentic?]]></title>
            <link>https://medium.com/@apoorv.adarsh/is-this-agentic-4f2171073630?source=rss-1ee2225d7005------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f2171073630</guid>
            <category><![CDATA[agentic]]></category>
            <category><![CDATA[agentic-workflow]]></category>
            <category><![CDATA[agentic-ai-architecture]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <dc:creator><![CDATA[Apoorv Adarsh]]></dc:creator>
            <pubDate>Tue, 15 Sep 2026 03:30:40 GMT</pubDate>
            <atom:updated>2026-09-15T03:30:40.452Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Your specification didn’t disappear. It moved somewhere worse.</strong></p><p>There is a question that gets asked in every architecture review now, usually about forty minutes in, usually by someone senior enough that the room goes quiet for it.</p><blockquote>“But is this actually agentic?”</blockquote><p>It is a bad question. Not because it is unfair, but because it has no answer that survives contact with production. I want to explain why, and what I think we should be asking instead.</p><h3><strong>We were sold a car. We ship trains.</strong></h3><p>The promise of an agent is a car. You state a destination. The thing works out the route. It reroutes around traffic. It handles the parts you did not anticipate, and you do not much care how, because the outcome is what you bought.</p><p>What we build — all of us, in every framework currently in use — is a train.</p><p>The tracks are laid in advance by whoever wrote the framework. The switches exist only where somebody installed a switch. The signals are the guardrails. The timetable is the orchestrator. And the model, the large expensive model at the centre of the architecture diagram, is the driver: in possession of a throttle and a brake, between two stations it did not choose.</p><p>The metaphor holds uncomfortably well across the ecosystem.</p><p>A graph-based framework is a track diagram. They did not even hide it — the name says graph, the documentation says nodes and edges, and nodes and edges are exactly what they sound like. Role-based frameworks give you station staff, not explorers; a role is a constraint that has been given a friendly name. Tool calling — the feature most often cited as evidence of agency — is the driver selecting which lever to pull from a panel that somebody else bolted down.</p><p>And the tools that never claimed to be anything other than workflow engines attract the least complaint of the lot. Nobody feels lied to by a thing that told them what it was.</p><p>Here is the line that I think ends the argument:</p><blockquote>A train that reroutes itself is not an autonomous train. It is a derailment.</blockquote><p>Sit with that, because it inverts the whole discussion. In production, the behaviour we market as autonomy is precisely the behaviour we spend the entire engagement trying to eliminate. We do not want the system to do something we did not anticipate. We have never wanted that. We have written retries, validators, schemas, routers and approval gates specifically to prevent it.</p><p>We are not failing to build autonomous systems. We are succeeding at building constrained ones, and then feeling vaguely embarrassed about it.</p><h3><strong>Production is a ratchet</strong></h3><p>Watch how any agentic project actually evolves. I have now watched enough of them that the sequence is boringly predictable.</p><p>It starts open-ended. One agent, a good prompt, a set of tools, genuine optimism. It does something surprising and delightful in the demo.</p><p>Then it goes near a real workload.</p><p>It hallucinates a field, so someone adds a schema. It loops, so someone adds a step limit. It picks the wrong tool, so someone adds a router. It produces something that cannot be allowed to reach a customer unreviewed, so someone adds a human approval step. The prompt drifts between model versions, so someone pins it. Every one of these decisions is correct. Every one of them is made by a competent engineer for a defensible reason. And every single one removes a degree of freedom.</p><blockquote>Six months later you have a workflow with a language model inside it.</blockquote><p>There is a real architectural difference at the start, and it is worth naming precisely, because it is the only one that matters. In a conventional state machine, a branch is a human-authored predicate: it evaluates the same way every time, or you have a bug. In an agent runtime, that same branch can be resolved by the model at execution time, against inputs nobody enumerated. That is genuine, and it is not marketing.</p><p>It is also the exact property that every subsequent sprint exists to remove. Schema it, route it, validate it, gate it — and the model-decided branch becomes a predicate again. You arrive at a state machine, having taken six months and a considerable model bill to get there.</p><p>The important part — the part people get wrong when they complain about this — is that the team did not arrive there through incompetence. They arrived there <em>because</em> they were doing good engineering. Constraint is what good engineers produce when exposed to consequences.</p><p>Production is a ratchet toward determinism. It only turns one way. Nobody in the history of our industry has ever looked at a stable system and said, let us remove a validator and see what happens.</p><p>So when someone asks whether a system is agentic, they are usually asking a question about a point in time, and <em>the answer changes every sprint in the same direction</em>.</p><h3><strong>And then we rented the track</strong></h3><p>Everything above assumes you laid your own track. Increasingly, you do not. You rent the network from a platform vendor, and three things change — none of them in your favor.</p><p><strong>The budget stops being yours.</strong> In your own framework, if the system makes two unenumerated decisions, it makes two because you chose two. On a managed platform that number can change between Tuesday and Wednesday: a model version rolls forward, orchestration behavior shifts, a guardrail tightens, and you deployed nothing. Your system’s autonomy is now coupled to somebody else’s product roadmap, and you will find out from behavior before you find out from a changelog.</p><p><strong>The valuable part is the boring part.</strong> Orchestration is not what these platforms are really selling; conventional workflow engines have done orchestration for years, more cheaply and more predictably. What they are selling is the bundle around it — session isolation, memory that outlives a request, identity propagation so a tool call runs <em>as somebody</em>, governed tool access, and traces good enough to reconstruct what happened. That is genuinely tedious infrastructure, and most teams build a worse version themselves. But notice the shape of it: the boring half is the half worth paying for, and the dramatic half is the half you will spend the project removing. The marketing prices these exactly the wrong way round.</p><p><strong>The specification moves again</strong>, and this is the part that should worry you.</p><h3><strong>Autonomy is a budget, not a property</strong></h3><p>The framing error is treating agentic as a binary. Is it or isn’t it. Yes or no. Put it on the slide.</p><p>It is not a property. It is a budget, and the budget is denominated in decisions.</p><p>The only honest question you can ask about a system is: <strong>how many decisions is this permitted to make that I did not enumerate in advance?</strong></p><p>Count them. Not the tool calls — those are enumerated. Not the branches in the graph — those are enumerated. Count only the decisions where the space of valid outcomes was genuinely not written down anywhere by a human.</p><blockquote>For most production systems the number is between two and zero.</blockquote><p>And that is not a failure. That is the number you wanted. If you are routing a support ticket, moving money, filing a claim or touching a system of record, the correct autonomy budget is very close to zero, and a vendor who tells you otherwise is selling you unpriced risk.</p><blockquote>The number being small is fine. Not knowing the number is not fine.</blockquote><h3><strong>The accountability tell</strong></h3><p>There is a second test, and it is the one I trust more, because it is harder to game with architecture diagrams.</p><p>Nobody calls a junior engineer autonomous because they choose their own variable names. We call someone autonomous when they can decide something that nobody enumerated in advance — and be held accountable for the outcome. The two halves are not separable. Authority without accountability is not autonomy; it is just delegation with the receipts missing.</p><p>By that standard, no agent in production anywhere is autonomous, because no agent can be held accountable for anything. When it goes wrong, the accountability does not sit with the model, or the framework, or the vendor. It sits exactly where it sat before the project started: with a human being, usually the one who wrote the spec, occasionally the one who approved it.</p><p>The obvious objection is that managed platforms have changed this — that identity, audit trails, tenant governance and data boundaries mean accountability finally moved. It is a fair objection and it is wrong, because it confuses two different things.</p><p>What those platforms took responsibility for is the plumbing. They will tell you which agent acted, under whose identity, against which data, at what time, and that is worth having. They will not tell you whether the decision was correct. They will not be in the room when somebody asks why the claim was approved.</p><blockquote>Auditability is not accountability. One is a log. The other is a person.</blockquote><p>That is the tell. If the accountability never moved, the autonomy never moved either. Everything else is interface.</p><p><em>Autonomy without accountability is not autonomy. It is unowned risk with good marketing.</em></p><h3><strong>What actually happened to the specification</strong></h3><p>The frameworks did not fail to deliver autonomy. They delivered something subtler, and arguably more dangerous: they let you <strong>defer</strong> your specification rather than avoid writing one.</p><p>The specification did not disappear when you moved to agents. It moved. It went out of code — where it was versioned, reviewed, tested and visible to anyone who cared to look — and into prompts, where it is none of those things. A prompt is a specification written by whoever edited it last, validated by vibes, and reviewed by nobody.</p><p>Then it moved again. On a managed platform, a large part of your specification lives in a console. It is clicked, not committed. It sits in a tenant, not a branch. It has no diff, no reviewer and no obvious owner, and the person who changed it last Thursday may not be on the project any more.</p><blockquote>First we moved the specification out of code and into prompts. Then we moved it out of the repository and into a UI. Each step made the system faster to build and harder to know what we had built.</blockquote><p>You have not removed the spec. You have made it unversioned, untested and invisible, and distributed it across a dozen string literals and a settings page owned by four different people.</p><p>The interest on that debt is real, and it is paid at two in the morning by whoever is on the incident call, trying to work out which of seven prompts caused the behavior in the log.</p><h3><strong>The question that replaces it</strong></h3><p>So, stop asking <em>is this agentic?</em> It is unanswerable, it is a point-in-time measurement of something that only moves one way, and the answer has no operational consequence. Nobody has ever fixed a production defect with it.</p><p>Ask these instead:</p><p><strong>Where did I put my specification?</strong> In code, in a graph, in a prompt, in a console, or in somebody’s head?</p><p><strong>How many unenumerated decisions does this system make?</strong> Say the number out loud. If you cannot, that is your finding.</p><p><strong>Who pays when it is ambiguous?</strong> Not who owns the service. Who gets the call.</p><p>Those three questions are answerable on a whiteboard in ten minutes, they produce different architectures depending on the answers, and none of them require anyone to agree on a definition of the word agentic. They are also true of every runtime you might pick — a framework, a platform, a state machine, or a bash script — which is the only durable property an article like this can have.</p><p>We spent a decade learning to write things down. It would be a strange outcome if the main achievement of this generation of tooling turned out to be talking ourselves out of it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f2171073630" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Colleague Who Was Never Wrong]]></title>
            <link>https://medium.com/@apoorv.adarsh/the-colleague-who-was-never-wrong-9389f53ca2bd?source=rss-1ee2225d7005------2</link>
            <guid isPermaLink="false">https://medium.com/p/9389f53ca2bd</guid>
            <category><![CDATA[llm-applications]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[argumentative]]></category>
            <dc:creator><![CDATA[Apoorv Adarsh]]></dc:creator>
            <pubDate>Mon, 31 Aug 2026 14:41:40 GMT</pubDate>
            <atom:updated>2026-08-31T14:41:40.593Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>A short argument about why agreeable AI is dangerous, and why my fix for it probably has an expiry date</em></blockquote><p><strong>Meet the Colleague</strong></p><p>You’ve met this person. Every team has one.</p><p>He’s the sharpest guy in the room, and he knows it, and annoyingly he’s usually right. Ask him anything and you get a clean, confident, well-structured answer in about four seconds. No hedging. No “let me get back to you.” He connects things nobody else connected, explains it better than you could, and moves on before you’ve finished writing it down.</p><p>Here’s the thing about him, though. He’s not just smart. He’s <em>agreeable</em>. He wants the conversation to go well. So when you float a theory, he finds the evidence for it. When you say you’re running late, he tells you the shortcut. When you ask him to check your work, he checks it, finds a couple of things, and hands it back polished.</p><p>And when <em>he</em> makes the call — investigates the problem, decides what it means, builds the solution, and then reviews whether the solution is any good — the review comes back clean.</p><p>Of course it does. He already considered the objections. He found them unconvincing.</p><p>Nobody thinks he’s dishonest. He’s completely sincere at every step. That’s the problem. Every part of the answer passed through the same head. His assumptions decided which facts mattered; those facts supported his theory; the theory explained why the assumptions were reasonable in the first place.</p><p>It’s a beautifully coherent system.</p><blockquote>So is a conspiracy theory.</blockquote><p><strong>Translating the Metaphor</strong></p><p>Swap “brilliant colleague” for “capable LLM.” That’s the whole translation.</p><p>You hand a good model a task, some tools, and enough room to make a plan. It researches, interprets, decides, produces, and — if you’re being responsible — reviews its own output. The review usually looks great. It admits trade-offs. It flags a weakness or two. It might even revise.</p><p>What it almost never does is leave the frame it built the answer in.</p><p>And here’s the part I want to actually argue, because it’s the only claim in this whole piece I’m confident about:</p><p><strong>An agreeable intelligence optimizes for coherence. And coherence is indistinguishable from correctness — right up until the moment it isn’t.</strong></p><p>The model isn’t lying to you. It was hired agreeable. Everything it was trained to do — be helpful, stay relevant, follow the instruction, finish the task, avoid pointless conflict — quietly adds up to one instinct: <em>make the current framing work.</em> Give that same instinct five jobs in a row and it does all five in the service of the first framing it landed on.</p><blockquote>You don’t get a liar. You get a very smart yes.</blockquote><p><strong>Two Fixes That Sound Smart and Aren’t</strong></p><p><strong>Fix #1 — make him smarter.</strong> Get the bigger model. The one with the longer context and the better benchmarks. Surely a smart enough colleague catches his own mistakes. He does catch more of them. He also gets <em>better at reconciling contradictions in favor of a coherent answer.</em> You haven’t removed the failure. You’ve made it more articulate. A smarter agreeable model is still an agreeable model — it just writes a more convincing review of its own bad work. If your fix is “wait for GPT-N,” you’re not fixing the flaw, you’re upgrading its prose.</p><p><strong>Fix #2 — make him check twice.</strong> Ask the model to critique itself. Add a reflection step. Have it play devil’s advocate. <em>This feels like disagreement</em>.<em> It isn’t</em>. The critic and the reviewer go home in the same skull. The self-critique is generated by the thing being critiqued, inside the same gravity well as the original answer. It’ll find typos and phrasing. It rarely finds <em>the wrong premise</em>, because the wrong premise is the thing doing the finding.</p><p>Neither fix works, because neither one introduces an actual opposing interest. You can’t cross-examine yourself. You already know which confession you want.</p><p><strong><em>The Actual Fix: Make Something Disagree</em></strong></p><p>The only thing that reliably catches a coherent-but-wrong answer is another party that <em>wants a different kind of correctness</em> and has the standing to say so.</p><p>Not a nicer version of the same model. Not the same model wearing a “critic” hat for one turn. Something with a genuinely different reward — one that’s rewarded for finding what’s missing, not for finishing; that’s insulted by an unsupported “done”; that doesn’t care how elegant the theory is, only whether the evidence actually says what the theory claims.</p><p>The trick — and this is the same move as pointing an overconfident model at <em>who to ask</em> instead of <em>what the answer is</em> — is that you’re not trying to make the model humble. You’re trying to make sure the thing checking it isn’t the thing that wrote it. Humility is hard to train. Conflict of interest is easy to arrange.</p><p>That’s it. That’s the entire idea. Stop asking one intelligence to be researcher, author, and judge. Put a second interest in the room whose job is served by the first one being wrong.</p><p>Everything fancy people build on top of this — specialized agents, review stages, whatever architectures — is just plumbing for that one sentence.</p><p><strong>How We Actually Built This</strong></p><p>We hit exactly this wall building the workflow behind our platform. The first version was one capable model owning a long chain of work end to end. Individually, every step looked reasonable. The output, several steps later, was quietly and confidently wrong in ways that were miserable to trace, precisely because each step <em>looked</em> fine.</p><p>So we stopped letting one model own the whole chain. We split the work across separate parties with deliberately incompatible interests, gave each one a narrow patch of authority and a matching narrow suspicion, and — the boring part that matters — didn’t let any of them mark the others’ homework as complete without something closer to evidence than opinion.</p><p>I’m going to be annoying and not draw you the diagram, because the diagram is the least interesting part and every setup’s plumbing looks different. The shape is what transfers: several <em>reasonably</em> good models, not one heroic one, arranged so that being confidently wrong is expensive for at least one of them.</p><blockquote>Which brings me to the part most of these posts leave out.</blockquote><p><strong>Why This Is Probably Temporary</strong></p><p>I don’t think this is a law of intelligence. I think it’s a workaround, and I think it has an expiry date.</p><p>The whole reason a crew beats a soloist today is that today’s models can’t hold a long, honest process without drifting — and can’t genuinely dissent against their own conclusions. The crew is scaffolding around those two weaknesses. The day a single model can actually argue itself down and refuse its own bad work, the scaffolding comes off, and a lot of multi-agent architecture becomes a museum piece. I’d rather be the person who said that out loud than the one still defending his org chart of agents in eighteen months.</p><p>So I’m holding the cure loosely. The failure, I’ll defend to the wall: <strong>a single agreeable intelligence will keep mistaking coherence for correctness, and it will get better at hiding it as it gets smarter.</strong> That doesn’t go away when the models improve. If anything it gets worse, because the reviews get more convincing.</p><p>The specific fix — split the work, make something disagree, don’t let confidence stand in for evidence — is just the best defense I’ve got <em>this year.</em> Take it as a workaround with a shelf life, not a manifesto.</p><p>It’s not a complicated idea. It’s mostly a matter of noticing that the smartest person in the room shouldn’t also be the one who decides whether he was right.</p><p>And if you’ve got a colleague who’s never once been wrong — you might not have a genius. <em>You might just have nobody willing to check.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9389f53ca2bd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Podcast Host Who Called His Professors]]></title>
            <link>https://medium.com/@apoorv.adarsh/the-podcast-host-who-called-his-professors-53d3248f50e4?source=rss-1ee2225d7005------2</link>
            <guid isPermaLink="false">https://medium.com/p/53d3248f50e4</guid>
            <category><![CDATA[agentic-rag]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[knowledge-base]]></category>
            <dc:creator><![CDATA[Apoorv Adarsh]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 03:23:47 GMT</pubDate>
            <atom:updated>2026-08-12T03:23:47.478Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>A story about fixing tunnel vision in agentic RAG, without bloating your context window</blockquote><h3>Meet the Host</h3><p>Picture a podcast. Not a research podcast — a <em>hype</em> podcast. The kind with a host who has an answer for everything, delivered with the unshakeable confidence of someone who has never once said “I don’t know” on air.</p><p>Ask him anything, and within four seconds he’s spinning a story. He doesn’t need much to work with. A half-remembered fact, a vibe, a plausible-sounding connection between two things — that’s plenty. He’ll fill in the rest with conviction, and the listeners will nod along, because he <em>sounds</em> right.</p><p>Here’s the twist: this host isn’t a fraud. He genuinely has a team of PhD professors on speed dial, each one a world expert in a narrow field. He could call any of them, any time, and get real, verified, footnoted answers.</p><p>But he doesn’t, really. Not properly.</p><h3>The Problem: One Call, Then He’s Off</h3><p>Here’s what he actually does. A question comes in. He thinks for a second, dials exactly <em>one</em> professor — usually whichever one comes to mind first — asks a quick question, gets a partial answer, and decides that’s enough. Then he’s back on air, weaving that one fragment into a full story, presenting it as if it’s the complete picture.</p><p>Meanwhile, three other professors down the hall might have had the exact detail that would’ve changed the story entirely. He never called them. Not because he decided their input didn’t matter — he never even considered that he needed it. He got <em>one</em> useful-sounding fact and declared victory.</p><p>Sometimes it works out fine — the one professor he called really did have everything relevant. Sometimes it’s a disaster — he’s now confidently telling millions of listeners something that’s subtly, or completely, wrong, because he only had a quarter of the picture and didn’t know it.</p><p>This is, if you squint, exactly what happens inside a lot of agentic RAG systems today.</p><h3>Translating the Metaphor</h3><p>Swap “podcast host” for “LLM agent.” Swap “PhD professors” for “your backing knowledge sources” — a vector store full of documents, a structured database, a graph of how your systems relate to each other, an API that knows the org chart, whatever heterogeneous mix of sources your system actually has.</p><p>The naive version of an agent like this does a single retrieval pass against <em>one</em> of those sources, decides it has “enough” context, and generates an answer. If the real answer required combining information from two or three sources, too bad — nobody asked.</p><p>There are two obvious “fixes,” and both are worse than the disease:</p><p><strong>Fix attempt #1 — always call everyone, every time.</strong> Just query every backing source on every question, stuff all of it into the prompt, and let the model sort it out. This works, technically. It’s also slow, expensive, and — critically — it bloats the context window with a huge amount of irrelevant material on every single query, most of which the model didn’t need and will now have to wade through (or get distracted by). Your “hyper-confident host” now has to read a 40-page dossier before every answer, even for questions a single fact would’ve resolved.</p><p><strong>Fix attempt #2 — ask, check, ask again, check again, loop until satisfied.</strong> Have the agent retrieve from one source, evaluate whether it’s sufficient, and if not, go back for another round — sequentially, one source at a time, re-evaluating after each. This is more targeted, but it’s slow (multiple round trips of latency, one per missing piece), and it still tends to miss combinations: the agent evaluates sufficiency generically, misses that it actually needed two different sources’ input simultaneously, and either loops longer than necessary or gives up too early.</p><p>Neither of these is how you’d actually want a good producer to run a podcast.</p><h3>The Actual Fix: Weaponize the Confidence</h3><p>Here’s the reframing that makes this tractable, and it’s almost embarrassingly simple once you see it: <strong>let the host hallucinate his shopping list.</strong></p><p>Don’t try to stop him from being confident — that confidence is actually useful, if you point it at the right target. Instead of asking him to <em>answer</em> the question immediately, ask him to pause for one beat and blurt out: <em>“okay, to answer this properly, here’s everyone I think I need to call”</em> — and let him guess generously. He doesn’t need to be right. He just needs to name names.</p><p>Then — and this is the part that actually matters — <strong>call all of those people at once, in parallel</strong>, not one after another. Every professor on his list gets dialed simultaneously.</p><ul><li>If a professor picks up and has something useful, that fact gets folded into the story.</li><li>If a professor doesn’t answer, or genuinely doesn’t have anything relevant — that’s fine too. It just means that particular angle doesn’t exist for this question. No harm done, no wasted second round trying to “fix” a call that was never going to have an answer.</li></ul><p>The host only ever does this <strong>once per question</strong> — one moment of “let me think about who I need,” one parallel batch of calls, then he’s back on air with everything he’s going to get. No slow sequential interrogation. No stuffing every professor’s entire life’s work into his head just in case. He hallucinates the <em>list of who to ask</em>, not the <em>answer itself</em> — and that hallucination is cheap to be wrong about, because a bad guess just means one extra call that comes back empty, not a corrupted final answer.</p><p>This is the trick: <strong>you’re not eliminating the host’s overconfidence, you’re redirecting it</strong> from “confidently answering with partial information” to “confidently guessing who to interrogate.” The former is dangerous. The latter is nearly free, and parallelizable, and bounded to a single round — which means the podcast still feels live and responsive, instead of turning into a slow committee meeting.</p><h3>Why This Generalizes</h3><p>If you’re building any kind of agent that sits in front of more than one heterogeneous knowledge source — a document store here, a structured graph there, some other system of record over there — you will eventually hit this exact failure mode: the agent talks to whichever source is easiest or most obvious, declares sufficiency, and moves on, oblivious to what the <em>other</em> sources might have contributed.</p><p>The fix isn’t “give the agent everything, always” (too expensive, too noisy) and it isn’t “make it loop and re-check forever” (too slow, still misses combinations). It’s:</p><ol><li>Let it hypothesize — in one shot — everything it thinks it might need, across every source, even multiple sources at once.</li><li>Fire all of those requests in parallel.</li><li>Accept “no result” gracefully as valid information (it means the source didn’t have anything, not that something went wrong).</li><li>Synthesize whatever came back, once, and stop.</li></ol><p>One round. Parallel fan-out. Graceful nulls. That’s the whole pattern.</p><h3>How We Actually Built This</h3><p>We ran into exactly this problem building the knowledge layer behind our platform. Our agent sits in front of three genuinely different kinds of knowledge: a semantic document store (specs, policies, general documentation), a structural graph describing how a scanned codebase actually fits together, and a separate graph tracing how project artifacts and decisions derived from one another over time.</p><p>The first version of our retrieval agent had precisely the “one confident call” problem: it would check whether its initial document search was “sufficient,” and if not, go back for exactly one more thing before answering — never considering it might need a structural fact <em>and</em> a decision-history fact <em>and</em> another document, all for the same question.</p><p>The fix was the same one described above. We restructured the agent’s sufficiency check so that, instead of returning a single follow-up request, it can hallucinate — and then request — any combination of follow-ups across all three knowledge sources simultaneously: a refined document query, a request into the structural graph, a request into the decision-history graph, any subset of them, all at once. Everything requested fires in parallel in a single bounded round, whatever comes back (including nothing, from sources that genuinely don’t have anything relevant) gets folded into one final synthesis pass, and the agent answers. No unbounded loop, no dumping every knowledge source into the prompt by default, no tunnel vision on whichever source happened to answer first.</p><p>It’s not a complicated idea. It’s just a matter of pointing the model’s confidence at the question “who do I need to ask?” instead of letting it fire on “I’m sure this is the whole answer” too early.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53d3248f50e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Celebrating the Evolution: The Enduring Spirit of Backend Engineering]]></title>
            <link>https://medium.com/@apoorv.adarsh/celebrating-the-evolution-the-enduring-spirit-of-backend-engineering-e30059aeaa96?source=rss-1ee2225d7005------2</link>
            <guid isPermaLink="false">https://medium.com/p/e30059aeaa96</guid>
            <category><![CDATA[back-end-development]]></category>
            <category><![CDATA[back-end-frameworks]]></category>
            <category><![CDATA[backend-development]]></category>
            <dc:creator><![CDATA[Apoorv Adarsh]]></dc:creator>
            <pubDate>Fri, 07 Feb 2025 07:44:22 GMT</pubDate>
            <atom:updated>2025-02-07T07:44:22.563Z</atom:updated>
            <content:encoded><![CDATA[<p>In the monolith era, backend engineering primarily revolved around managing large, monolithic applications. Backend engineers were tasked with intricate server tuning, optimizing network components, and ensuring the seamless operation of complex, tightly coupled systems. This era demanded a deep understanding of infrastructure management, database optimization, and the intricacies of traditional server-based architectures.</p><p>As technology evolved, the emergence of cloud computing revolutionized the way backend engineering was approached. The shift towards cloud-native architectures and the adoption of microservices brought about a significant transformation in the role of backend engineers. With the advent of cloud services, the focus shifted from traditional server management to scalable, distributed systems, and the orchestration of containerized workloads.</p><p>The impact of cloud technologies and the subsequent rise of serverless computing further accelerated this evolution, reshaping the landscape of backend engineering. As organizations embraced modern, cloud-based solutions, backend engineers found themselves navigating a new paradigm, one that emphasized agility, scalability, and the seamless integration of cloud services into their applications.</p><p>This shift marked the beginning of the decline of traditional backend engineering as we knew it, paving the way for a new era characterized by cloud-native practices, serverless architectures, and a fundamental redefinition of backend engineering roles.</p><h3>From Legacy Systems to Modern Architectures</h3><p>The transition from legacy systems to modern architectures has been a defining journey for backend engineering. In the past, backend engineers grappled with monolithic applications, where large, interconnected components posed challenges for scalability, maintenance, and agility. The shift towards modern architectures, driven by microservices, containerization, and cloud-native practices, has reshaped the landscape.</p><p>Modern architectures have empowered backend engineers to embrace modular, decoupled systems, allowing for independent development, deployment, and scaling of services. This shift to microservices has not only enhanced the flexibility and resilience of backend systems but has also fostered a culture of rapid iteration and innovation.</p><p>Additionally, the widespread adoption of container orchestration platforms like Kubernetes has streamlined the management of microservices, enabling efficient scaling, resource utilization, and deployment automation.</p><p>Furthermore, the rise of event-driven architecture and serverless computing has revolutionized backend engineering, enabling seamless, scalable, and cost-effective execution of backend processes. Event-driven architectures have allowed backend systems to respond dynamically to real-time events, fostering agility and responsiveness in application development.</p><h3>Impact of Cloud</h3><h3>Revolutionizing Infrastructure</h3><p>The advent of managed Platform as a Service (PaaS) offering in the cloud has significantly alleviated the workload of backend engineers. These managed services abstract away the complexities of infrastructure management, allowing backend engineers to focus more on application development and business logic. By leveraging managed PaaS services, backend engineers can offload tasks such as provisioning, scaling, and maintenance to the cloud provider, reducing the operational burden and enabling them to dedicate more time and resources to building and optimizing applications. This shift has not only streamlined backend engineering processes but has also empowered engineers to embrace a more strategic and value-driven approach, ultimately driving innovation and efficiency in application development.</p><h3>Scalability and Flexibility</h3><p>Cloud’s Impact on Backend Systems Cloud technologies have significantly enhanced the scalability and flexibility of backend systems. Backend engineers can leverage cloud services to seamlessly scale resources based on demand, ensuring optimal performance and cost efficiency. The ability to dynamically adjust computing capacity, storage, and networking resources has empowered backend engineers to design and operate highly adaptable systems that can efficiently handle varying workloads and user demands.</p><h3>Adapting to Cloud-Native Practices</h3><p>Reshaping Backend Engineering Roles The adoption of cloud-native practices has reshaped the roles and responsibilities of backend engineers. Embracing cloud-native architectures, such as microservices, containerization, and serverless computing, has necessitated a shift in mindset and skill sets. Backend engineers are now tasked with designing, deploying, and managing applications that are inherently optimized for cloud environments, leveraging cloud-native services and best practices to drive innovation, agility, and operational excellence. This transition has redefined the traditional boundaries of backend engineering, emphasizing the importance of cloud expertise and a deep understanding of cloud-native technologies and patterns.</p><h3>Impact of Kubernetes</h3><h3>The Rise of Kubernetes Orchestration</h3><p>Kubernetes orchestration has revolutionized backend development by providing a robust platform for automating the deployment, scaling, and management of containerized applications. This transformative shift has streamlined backend development, allowing engineers to concentrate on application logic and scalability, thereby accelerating the pace of innovation and development. Additionally, Kubernetes has facilitated the adoption of event-driven architectures, enabling backend engineers to build systems that dynamically respond to real-time events, fostering agility and responsiveness in application development.</p><h3>Embracing Containerized and Microservices Architectures</h3><p>Kubernetes’s Influence on Backend Engineering Kubernetes has played a pivotal role in promoting the adoption of containerized and microservices architectures, fundamentally reshaping the way backend systems are architected and operated. Backend engineers now have the flexibility to design modular, scalable systems, leveraging Kubernetes to orchestrate and manage distributed microservices. This approach has not only enhanced the scalability and resilience of backend systems but has also facilitated the development of loosely coupled, independently deployable services, aligning with modern business requirements and operational best practices.</p><h3>Redefining Operations</h3><p>Kubernetes’s Impact on Backend Infrastructure The emergence of Kubernetes has redefined backend infrastructure operations by enabling a more automated, declarative approach to managing and scaling applications. With Kubernetes handling container orchestration, workload scheduling, and resource allocation, backend engineers can focus on optimizing application performance, implementing efficient resource utilization, and leveraging cloud-native services to enhance system capabilities. This redefined operational model has liberated backend engineers from routine infrastructure tasks, allowing them to prioritize application optimization and innovation, ultimately driving greater efficiency and agility in backend operations.</p><h3>Impact of Serverless</h3><h3>The Rise of Serverless Computing</h3><p>Transforming Backend Development, the rise of serverless computing has brought about a transformative shift in backend development. By abstracting away infrastructure management and enabling a pay-as-you-go model, serverless platforms have empowered backend engineers to focus on writing code and building scalable, event-driven applications without the overhead of managing servers. This paradigm shift has streamlined backend development, allowing engineers to concentrate on business logic and application functionality, thereby accelerating the pace of innovation and development.</p><h3>Embracing Event-Driven Architectures</h3><p>Serverless computing has catalyzed the adoption of event-driven architectures, fundamentally altering the way backend systems are designed and orchestrated. Backend engineers now have the flexibility to build systems that respond dynamically to events, enabling real-time processing and seamless integration with various services. This event-driven approach has not only enhanced the responsiveness and agility of backend systems but has also facilitated the development of highly scalable and loosely coupled architectures, aligning with modern business requirements and user expectations.</p><h3>Redefining Operations</h3><p>The emergence of serverless computing has redefined backend infrastructure operations by shifting the focus from traditional server management to a more abstract, function-centric approach. With serverless platforms handling infrastructure provisioning, scaling, and maintenance, backend engineers can concentrate on optimizing application performance, implementing efficient resource utilization, and leveraging managed services to enhance system capabilities. This redefined operational model has liberated backend engineers from routine infrastructure tasks, allowing them to prioritize application optimization and innovation, ultimately driving greater efficiency and agility in backend operations.</p><h3>Adapting to the Evolution: Empowering Modern Backend Engineering</h3><h3>Adapting Skill Sets</h3><p>As backend engineering undergoes a significant transformation, it is crucial for professionals to adapt their skill sets to navigate this transition effectively. Embracing cloud-native technologies, microservices, containerization, and serverless computing is essential. Backend engineers should focus on acquiring expertise in modern development frameworks, cloud platforms, and DevOps practices to thrive in the evolving landscape. Additionally, honing skills in event-driven architectures and distributed systems will be instrumental in staying relevant and competitive in the modern backend engineering domain.</p><h3>Embracing Modern Practices</h3><p>Reshaping Backend Engineering Roles The reshaping of backend engineering roles necessitates a shift towards embracing modern practices and methodologies. Adopting agile development, continuous integration and delivery (CI/CD), and infrastructure as code (IaC) principles is imperative. Backend engineers should prioritize automation, observability, and resilience in their systems, leveraging tools and practices that align with cloud-native and microservices architectures. Embracing modern practices will enable backend engineers to build scalable, resilient, and efficient systems that meet the demands of contemporary application development.</p><h3>Future-Proofing Backend Engineering</h3><p>While traditional backend engineering roles are evolving, the essence of backend engineering remains fundamental in driving innovation and enabling robust, scalable systems. Future-proofing backend engineering involves embracing the principles of adaptability, continuous learning, and a proactive mindset. Backend engineers should strive to stay abreast of emerging technologies, industry trends, and best practices, ensuring that they remain versatile and well-equipped to tackle the challenges of tomorrow. By embracing change, modern practices, and a forward-looking approach, backend engineering will continue to thrive and evolve, ensuring its longevity and relevance in the ever-changing technological landscape.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e30059aeaa96" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architect’s Compass: Key Principles for Designing Scalable and Robust Microservices — Part 2]]></title>
            <link>https://medium.com/@apoorv.adarsh/architects-compass-key-principles-for-designing-scalable-and-robust-microservices-part-2-7c2b9b050e86?source=rss-1ee2225d7005------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c2b9b050e86</guid>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[microservice-architecture]]></category>
            <category><![CDATA[scalable-applications]]></category>
            <dc:creator><![CDATA[Apoorv Adarsh]]></dc:creator>
            <pubDate>Sat, 23 Nov 2024 15:23:02 GMT</pubDate>
            <atom:updated>2024-11-23T15:23:02.567Z</atom:updated>
            <content:encoded><![CDATA[<h3>Architect’s Compass: Key Principles for Designing Scalable and Robust Microservices — Part 2</h3><p>Welcome to Part 2 of our series on microservices architecture. After focusing on the decomposition of microservices and related patterns for service autonomy, statelessness, data management, scalable communication, and configuration management in Part 1, we now turn our attention to the crucial infrastructure components that support microservices-based applications. This segment will cover essential infrastructure elements such as containerization, orchestration, service discovery, service mesh, monitoring, and security. These components are vital for deploying, managing, and scaling microservices efficiently, ensuring smooth operation and seamless interaction within a distributed environment. Our aim is to equip you with the knowledge to build a resilient infrastructure that fosters rapid scaling and high availability in your microservices architecture.</p><h3>Service Discovery in Microservices</h3><p>Service discovery is a critical component in microservices architecture, enabling services to dynamically discover and communicate with each other. This capability is especially important in environments where microservices are scaled dynamically, with instances frequently being added or removed. Effective service discovery ensures that all service requests are routed to the correct instances, regardless of changes in the environment.</p><h4>Implementing Service Discovery in Kubernetes</h4><p>Kubernetes offers built-in service discovery mechanisms that make it easier to manage microservices:</p><ul><li><strong>Kubernetes Services</strong>: A Kubernetes Service is an abstraction which defines a logical set of Pods and a policy by which to access them. This can be used to create a stable, internal front-end for a set of pods, regardless of the changes to the pod instances.</li><li><strong>DNS for Service Discovery</strong>: Kubernetes supports DNS-based service discovery. When a service is created in Kubernetes, a DNS entry is automatically created and maintained. Pods within the cluster can then use this DNS entry to discover and communicate with the service using a consistent address, even as pods are added or removed.</li><li><strong>Load Balancing</strong>: Kubernetes Services can also act as a load balancer to distribute network traffic or requests efficiently across multiple pods. This is crucial for maintaining performance and availability as the number of instances scales up or down.</li></ul><h4>Utilizing Service Discovery in AWS ECS and EKS</h4><p>AWS offers two managed services that support Kubernetes and container management, each with its own mechanisms for service discovery:</p><ol><li><strong>Amazon ECS (Elastic Container Service)</strong>: ECS provides a service discovery feature that integrates with Amazon Route 53. When an ECS service is defined, you can specify a service discovery configuration that automatically registers each instance with a Route 53 DNS record. This allows services within the cluster to resolve the service name to the current active instances automatically.</li><li><strong>Amazon EKS (Elastic Kubernetes Service)</strong>: EKS runs upstream Kubernetes and integrates with AWS services for scalability and security. For service discovery, EKS utilizes the same mechanisms as Kubernetes, including DNS-based service discovery and load balancing through Kubernetes Services.</li></ol><h4>Leveraging AWS Lambda for API Calls Without Additional Infrastructure</h4><p>AWS Lambda can be used to simplify service-to-service communication without the need for explicit service discovery mechanisms:</p><ul><li><strong>Integration with API Gateway</strong>: AWS Lambda functions can be triggered by AWS API Gateway, which acts as a single entry point for all API calls. This setup not only simplifies API management but also abstracts the service discovery layer, as API Gateway can route requests to the appropriate Lambda functions based on the API endpoint and method.</li><li><strong>Event-Driven Architecture</strong>: Lambda can be used in an event-driven architecture to handle requests or tasks triggered by other AWS services (like S3, DynamoDB, SNS, or SQS). This approach reduces the need for service discovery as communication is handled through events rather than direct service-to-service calls.</li></ul><h3>API Gateway in Microservices Architecture</h3><p>An API Gateway is a fundamental component in a microservices architecture, acting as a single entry-point for all client requests to various backend services. It simplifies the client interface and provides a centralized location to handle cross-cutting concerns across multiple microservices. This approach enhances the manageability and security of the application while improving performance and scalability.</p><h4>Key Functions of an API Gateway</h4><ul><li><strong>Request Routing</strong>: The API Gateway routes incoming requests to the appropriate microservices based on the URL path, method, and other attributes of the request. This routing mechanism abstracts the underlying service architecture from the client, making it easier to restructure services without impacting the client.</li><li><strong>Authentication and Authorization</strong>: By centralizing security checks at the API Gateway, individual services are relieved from having to implement and manage authentication and authorization. The gateway can authenticate incoming requests and ensure that they have the right permissions to access the requested resources.</li><li><strong>SSL Termination</strong>: Handling SSL at the gateway level simplifies certificate management and offloads encryption and decryption tasks from backend services. This not only centralizes security management but also reduces the computational load on microservices, allowing them to focus on business logic.</li><li><strong>Rate Limiting</strong>: The API Gateway can enforce rate limits and throttling policies to prevent any single client or service from consuming too many resources. This is crucial for maintaining system stability and availability during high traffic periods.</li><li><strong>Caching</strong>: API Gateways can implement caching for common requests to reduce the load on backend services and improve response times for end-users. This caching mechanism can be particularly beneficial for data that does not change frequently.</li></ul><h4>Benefits of Using an API Gateway</h4><ul><li><strong>Simplified Client Interaction</strong>: Clients need to interact with only one endpoint rather than multiple services, simplifying the client architecture and reducing the complexity of client-side logic.</li><li><strong>Enhanced Security</strong>: Centralizing security measures like authentication, SSL termination, and rate limiting in the API Gateway enhances the overall security posture by providing a single, well-guarded entry point to the system.</li><li><strong>Operational Efficiency</strong>: Offloading tasks such as SSL termination, rate limiting, and response caching to the API Gateway frees up resources on backend services, allowing them to operate more efficiently and focus solely on their core responsibilities.</li><li><strong>Flexibility and Scalability</strong>: The API Gateway facilitates flexible service management and scaling. Services can be added, removed, or scaled independently without requiring changes to the client-side code, as the gateway handles all routing logic.</li></ul><h3>Service Mesh in Microservices Architecture</h3><p>A service mesh plays a crucial role in enhancing the scalability of microservices architectures by providing a dedicated infrastructure layer designed to handle service-to-service communications efficiently. It manages service interactions across different infrastructure environments, providing critical capabilities such as service discovery, load balancing, encryption, authorization, and observability. Unlike an API Gateway, which handles incoming traffic primarily from outside the cluster, a service mesh manages internal service-to-service communication.</p><h4>Key Functions of a Service Mesh</h4><ol><li><strong>Service Discovery</strong>: Automatically detects services within the infrastructure and manages the network locations, making it easy for services to communicate with each other without hard-coded IP addresses or ports.</li><li><strong>Load Balancing</strong>: Distributes network traffic across multiple instances of services, improving responsiveness and availability by ensuring no single service instance becomes a bottleneck.</li><li><strong>Traffic Management</strong>: Controls how requests are routed and split across service versions, which is particularly useful for A/B testing, canary releases, and staged rollouts.</li><li><strong>Security</strong>: Provides strong security features, including mutual TLS (mTLS) for encrypted and authenticated service-to-service communication, ensuring that all communications are secure and trusted within the network.</li><li><strong>Observability</strong>: Integrates monitoring tools that provide insights into dependencies, performance metrics, and error rates, helping in troubleshooting and maintaining the health of services.</li></ol><h4>Benefits of Using a Service Mesh</h4><ul><li><strong>Enhanced Communication Control</strong>: Offers fine-grained control over service communication, including retries, failovers, and the dynamic routing of requests, which enhances the overall resilience and efficiency of the system.</li><li><strong>Improved Security Posture</strong>: With built-in security protocols, a service mesh enhances the security between services, reducing the risk of internal threats and data breaches.</li><li><strong>Operational Simplicity</strong>: Simplifies the operational complexity of managing microservices by providing a unified layer that handles service-to-service communications, security, and observability.</li></ul><h4>How does Service Mesh help with scalability?</h4><ul><li><strong>Dynamic Load Balancing</strong>:<strong> </strong>Service meshes typically include built-in load balancing capabilities that distribute incoming requests evenly across available service instances. This feature is essential for scalability as it ensures that no single instance becomes a performance bottleneck. By automatically adjusting the load distribution based on real-time metrics, a service mesh can optimize resource utilization and maintain performance even as the number of service instances scales up or down.</li><li><strong>Efficient Service Discovery</strong>: As microservices scale, keeping track of the network locations (IP addresses and ports) of potentially hundreds of service instances becomes challenging. Service meshes automate the process of service discovery. This means that as new instances are added or removed, the service mesh updates its registry and reroutes traffic accordingly without manual intervention. This dynamic service discovery is crucial for maintaining seamless communication between services at scale.</li><li><strong>Traffic Management</strong>: Service meshes provide sophisticated traffic management tools that allow developers to control how requests are routed and handled within the service architecture. Features such as request routing, retries, failovers, and circuit breakers help manage traffic flow efficiently. For instance, in the event of partial system failures, a service mesh can reroute traffic from failing nodes to healthy ones, or implement circuit breakers to prevent failures from cascading. These capabilities ensure that the system can scale dynamically and handle failures gracefully, maintaining overall system stability.</li><li><strong>Resource Efficiency</strong>: By offloading functionalities like SSL termination, telemetry, and policy enforcement to the service mesh, individual microservices are relieved from these duties and can focus on their business logic. This not only simplifies the development and maintenance of microservices but also reduces the computational overhead on service instances. The result is more efficient use of resources, which is vital for scaling applications.</li><li><strong>Observability</strong>: Service meshes provide deep observability features, including logging, monitoring, and tracing of requests as they flow through services. This visibility is crucial for scaling as it helps identify performance bottlenecks, inefficient resource usage, and other issues that could impact the scalability of the system. By understanding how the system behaves under different loads, developers can make informed decisions about where to allocate resources and how to optimize the architecture for better scalability.</li><li><strong>Automated Policies</strong>: Service meshes allow for the definition and enforcement of policies at the infrastructure level, such as rate limiting, access control, and quotas. These policies can be applied uniformly across all services without modifying individual service code. As the system scales, maintaining consistent policy enforcement becomes increasingly important to ensure that the system remains secure and operates within defined parameters.</li></ul><h4>AWS Service Mesh Options</h4><ul><li><strong>AWS App Mesh</strong>: This service provides application-level networking to make it easy for services to communicate with each other across multiple types of compute infrastructure. App Mesh standardizes how services communicate, giving you end-to-end visibility and helping to ensure high-availability for your applications.</li><li><strong>Istio on Amazon EKS</strong>: Istio is an open-source service mesh that layers transparently onto existing distributed applications. It is also a popular choice for Kubernetes environments and can be used with Amazon EKS to provide robust features like traffic management, security, and observability.</li></ul><h3>Monitoring and Health Checks</h3><p>Although not exactly an infrastructure component, monitoring and health checks are used by other infrastructure components and are critical for maintaining the reliability and performance of a microservices architecture. These tools provide the necessary insights to track the health and operational status of each microservice, enabling proactive management and automatic interventions like recovery and scaling.</p><h4>Health Checks</h4><p>Health checks are automated tests that regularly check the vital functions of a microservice to ensure it is operating correctly. Implementing effective health checks involves:</p><ul><li><strong>Liveness Probes</strong>: Determine if a microservice is running (i.e., the process is up). If a liveness probe fails, the service management platform (like Kubernetes) can automatically restart the service to try to restore its functionality.</li><li><strong>Readiness Probes</strong>: Assess if a microservice is ready to handle requests. This is crucial during startup and after maintenance or scaling operations. Traffic should only be routed to instances that pass the readiness check.</li><li><strong>Dependency Checks</strong>: Occasionally, services may need to verify the availability and health of external dependencies such as databases or third-party APIs. These checks can prevent cascading failures by detecting issues early.</li></ul><h4>Comprehensive Monitoring</h4><p>Monitoring in a microservices environment involves collecting, aggregating, and analyzing metrics and logs from all microservices to gain insights into their performance and behavior. This comprehensive monitoring strategy should include:</p><ul><li><strong>Performance Metrics</strong>: Track key performance indicators (KPIs) such as response times, throughput, and error rates. These metrics help identify performance bottlenecks and areas for optimization.</li><li><strong>System Metrics</strong>: Monitor resource usage metrics like CPU, memory, disk usage, and network traffic. These metrics are crucial for understanding the resource demands of services and for making informed decisions about scaling.</li><li><strong>Logs</strong>: Aggregate logs from all microservices to provide detailed contextual information about events, errors, and the internal state of applications. Log analysis can help in debugging and tracing the root causes of issues.</li><li><strong>Tracing</strong>: Implement distributed tracing to follow the path of requests as they travel through the microservices. Tracing is invaluable for diagnosing issues in complex flows and interactions between services.</li></ul><h4>Facilitating Automatic Recovery and Scaling</h4><p>By integrating monitoring and health checks with orchestration tools (such as Kubernetes), systems can automatically respond to changes in service health or performance metrics:</p><ul><li><strong>Auto-Scaling</strong>: Set up auto-scaling rules based on specific metrics like CPU utilization or request rates. If a service starts to experience high load, the system can automatically scale out additional instances to handle the increased traffic.</li><li><strong>Automated Recovery</strong>: Use health check results to trigger recovery actions. For example, if a service repeatedly fails liveness checks, the system can attempt corrective actions such as restarting the service or deploying it to a different server.</li></ul><p>In our two-part series “Architect’s Compass: Key Principles for Designing Scalable and Robust Microservices,” we’ve delivered good advice on the essential strategies and infrastructure components critical for a successful microservices architecture. Part 1 concentrated on decomposing microservices, exploring patterns for service autonomy, statelessness, data management, scalable communication, and configuration management. Part 2 shifted focus to infrastructure, discussing the roles of service discovery, API gateways, service meshes, and the importance of monitoring and health checks. Together, these segments provide practical advice for building and managing efficient, scalable, and robust microservices systems, equipping you with the insights to effectively navigate the complexities of modern software architecture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c2b9b050e86" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Architect’s Compass: Key Principles for Designing Scalable and Robust Microservices — Part 1]]></title>
            <link>https://medium.com/@apoorv.adarsh/architects-compass-key-principles-for-designing-scalable-and-robust-microservices-part-1-9828723202c1?source=rss-1ee2225d7005------2</link>
            <guid isPermaLink="false">https://medium.com/p/9828723202c1</guid>
            <category><![CDATA[scalable-applications]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[microservice-architecture]]></category>
            <category><![CDATA[good-advice]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Apoorv Adarsh]]></dc:creator>
            <pubDate>Sat, 23 Nov 2024 14:42:53 GMT</pubDate>
            <atom:updated>2024-11-23T14:42:53.425Z</atom:updated>
            <content:encoded><![CDATA[<h3>Architect’s Compass: Key Principles for Designing Scalable and Robust Microservices — Part 1</h3><p>This article offers generic “Good Advice” for software architects and developers aiming to master the creation of microservices that are both scalable and robust. As the demand for flexible and independently deployable systems increases, grasping the fundamental design principles of microservices architecture is essential. Here, we will discuss crucial strategies for system decomposition, data management, inter-service communication, and fault tolerance.</p><p>Designing microservices for scalability involves careful planning and strategic decision-making to ensure that each service can independently scale based on demand. Here are several key considerations to keep in mind when designing microservices for scale.</p><h3>Service Decomposition</h3><p>Service decomposition is a critical step in designing a microservices architecture. It involves breaking down a monolithic application into smaller, manageable, and independently deployable services. Each service is designed around a specific business function and can be developed, deployed, and scaled independently. There are several techniques for service decomposition, each suited to different types of needs:</p><h4>Domain-Driven Design (DDD)</h4><p>DDD focuses on defining a model based on the business domain, decomposing services based on bounded contexts that represent specific business capabilities. <strong>Best Suited For</strong>: Complex systems where the business logic is intricate and deeply intertwined. DDD excels in environments where the domain model provides clear boundaries, making it ideal for large-scale enterprises with complex and evolving business rules.</p><h4>Decompose by Business Capability</h4><p>This approach breaks down the system into services that correspond to specific, stable business capabilities, with each service handling a set of related functions. <strong>Best Suited For</strong>: Organizations with well-defined, stable business functions that wish to scale specific parts of their business independently. It allows for focused development on distinct areas of business functionality, facilitating scalability and flexibility.</p><h4>Decompose by Subdomain</h4><p>The system is divided into services handling different subdomains under a larger domain, each managed by a separate service. <strong>Best Suited For</strong>: Medium to large systems where there are clear subdomains, but the complexity does not justify a full DDD approach. This method offers a balance between granularity and manageability, suitable for businesses that need to segment their operations but maintain some interconnected processes.</p><h4>Decompose by Business Process</h4><p>Services are decomposed based on specific business processes, with each service managing a particular process from start to finish. <strong>Best Suited For</strong>: Workflow-driven applications where processes are clearly defined and need autonomous management. This approach ensures that each business process is encapsulated within its service, promoting clear operational flows and easier scaling of high-demand processes.</p><h3>Service Autonomy</h3><p>After successfully decomposing a system into microservices, the next critical step is ensuring the autonomy of each service. Service autonomy is fundamental to achieving the full benefits of a microservices architecture, including the ability to develop, deploy, scale, and update services independently without affecting the functionality of other services.</p><h4>Ensuring Loose Coupling</h4><p>Loose Coupling means that services should have minimal dependencies on each other, which reduces the risk of changes in one service impacting others. Here are some strategies to achieve loose coupling:</p><ul><li><strong>APIs as Contracts</strong>: Define clear and stable interfaces for services. Use APIs as contracts between services, ensuring that internal changes in a service do not affect its consumers as long as the contract is maintained.</li><li><strong>Asynchronous Communication</strong>: Whenever possible, use asynchronous communication methods such as event-driven architecture or message queues. This approach decouples services by allowing them to communicate without needing to wait for direct responses, thus handling requests independently.</li><li><strong>Domain Events</strong>: Implement domain events to trigger actions across services. This method helps in reducing direct service-to-service calls and promotes a more decoupled architecture where services react to events rather than direct commands.</li></ul><h4>Avoiding Data Contention</h4><p>Data contention occurs when multiple services attempt to access the same data resource simultaneously, leading to potential conflicts and performance bottlenecks. To avoid this, each microservice should be the sole manager of its data:</p><ul><li><strong>Database per Service</strong>: Assign a separate database to each microservice, so no two services share the same data store. This approach not only eliminates data contention but also enhances the security and scalability of the data management.</li><li><strong>API for Data Access</strong>: If services need to access data managed by another service, they should do so through a dedicated API rather than direct database access. This maintains data encapsulation and control.</li></ul><h3>Statelessness</h3><p>Statelessness is a core principle in microservices architecture, emphasizing the ability of a service to independently process each request without relying on previous interactions. This trait is essential for enhancing scalability, reliability, and management simplicity. Stateless services can be scaled horizontally with ease, as no session data is tied to specific servers, allowing any server to handle any request and distribute the load evenly without the need for session data synchronization. Additionally, the reliability of the system is improved since the failure of a single instance does not result in the loss of session data, allowing for seamless creation of new instances. Furthermore, the simplicity of managing stateless services reduces the complexities associated with data consistency and replication, making the overall system maintenance more straightforward.</p><h4>Challenges and Workarounds When Statelessness Is Not Possible</h4><p>While statelessness is ideal, certain applications inherently require state to function correctly, such as e-commerce shopping carts, real-time gaming, and user sessions. In these cases, maintaining state becomes necessary, and the following workarounds can be employed:</p><ul><li><strong>Client-Side State Management</strong>: Offload the state management to the client. The client can store session data and send it with each request to the server. This approach keeps the server stateless, although it increases the client’s workload and data transfer amounts. This is the prevalent mechanism used by modern day apps and websites.</li><li><strong>External State Management</strong>: Use an external service or database to manage state. This could be a dedicated session store like Redis, which is designed to handle high-speed operations and can quickly retrieve and update session data. By centralizing state management, individual microservices remain stateless and interact with the state store when necessary.</li><li><strong>Stateful Service Instances</strong>: In scenarios where the above methods are not viable, consider designing specific microservices to be stateful. These services can manage state internally and handle requests that require stateful interactions. However, this approach requires careful handling to ensure that the system can still scale effectively and manage failure scenarios gracefully.</li><li><strong>Hybrid Approach</strong>: Use a combination of stateless and stateful services. Stateless services handle most of the processing, while stateful services manage specific tasks that require state. This hybrid approach leverages the benefits of statelessness where possible and employs stateful processing only when necessary.</li><li><strong>Distributed Caching Mechanisms</strong>: Implement caching strategies to temporarily store state in a way that enhances performance while maintaining the flexibility of stateless services. Caches can be used to store session data for short durations, reducing the load on permanent state stores and improving response times.</li></ul><h3>Data Management in Microservices: Enhancing Strategies with Patterns</h3><p>Effective data management is crucial for the success of a microservices architecture. Each microservice should be designed to own its data schema and logic, which promotes data encapsulation and service autonomy. This approach ensures that each service can operate and scale independently, enhancing the system’s overall resilience and scalability.</p><h4>Database Techniques for Scalability</h4><p>To effectively scale the database layer in a microservices architecture, consider implementing the following database techniques:</p><ul><li><strong>Sharding</strong>: Distribute data across different databases or database instances to spread the load and reduce the risk of bottlenecks. Sharding involves splitting the data based on a specific key, such as user ID or region, which allows queries to be served by different shards independently.</li><li><strong>Partitioning</strong>: Like sharding, partitioning divides the database into parts based on certain criteria but typically occurs within a single database instance. This can help in improving the performance and manageability of large datasets.</li><li><strong>Replication</strong>: Use replication to create copies of data across multiple databases. This not only provides redundancy and increases data availability but also allows read operations to be load-balanced across replicated nodes, enhancing read performance.</li></ul><h4>Leveraging Microservices Patterns for Data Management</h4><p>Several patterns can be utilized to enhance data management in microservices:</p><ul><li><strong>Command Query Responsibility Segregation (CQRS)</strong>: This pattern separates the read and write operations of a service into distinct models, allowing each to be scaled and optimized independently. CQRS is beneficial for systems where the read and write workloads vary significantly, enhancing performance and scalability.</li><li><strong>Event Sourcing</strong>: This pattern involves storing changes to the application state as a sequence of events. Each event represents a modification to the data, and the current state can be reconstructed by replaying these events. Event sourcing is particularly useful for auditing, debugging, and ensuring data consistency across distributed systems.</li><li><strong>Saga</strong>: A saga is a sequence of local transactions where each transaction updates data within a single service. If one transaction fails, sagas ensure that the system compensates for previous transactions, thus maintaining data consistency across services. This pattern is useful for managing complex business transactions that span multiple services.</li><li><strong>API Composition</strong>: This pattern involves composing complex data responses by invoking multiple services and aggregating their data. API composition is useful when a client requires a composite view of data owned by multiple services.</li><li><strong>Database per Service</strong>: Each microservice manages its own database, ensuring full control over the schema and data operations. This pattern supports service autonomy but requires careful handling of data integration and transaction management across services.</li></ul><h3>Scalable Communication in Microservices</h3><p>Scalable communication is a cornerstone of effective microservices architecture, ensuring that services can interact efficiently even as the system grows. Opting for lightweight, asynchronous communication mechanisms such as message queues or event streams is crucial. These methods help handle high loads and decouple service dependencies, which are vital for maintaining scalability and resilience.</p><h4>Asynchronous Communication Mechanisms</h4><ul><li><strong>Message Queues</strong>: Message queues provide a robust way to exchange messages between services without requiring the services to interact directly. They help in managing load by holding messages until the receiving service is ready to process them, thereby smoothing out traffic spikes and ensuring reliable delivery.</li><li><strong>Event Streams</strong>: Event streams are particularly useful in systems where events are generated at a high rate. They allow multiple services to react to events as they occur, facilitating real-time data processing and responsiveness. Services can subscribe to streams and process events independently, promoting decoupling and parallel processing.</li></ul><h4>Messaging Protocols</h4><p>Choosing the right messaging protocol is essential for optimizing communication efficiency and compatibility across services. Common protocols include JSON, Protobuf, and Avro, each suited for different scenarios:</p><ul><li><strong>JSON (JavaScript Object Notation)</strong>: JSON is highly readable and easy to use, making it ideal for scenarios where developer convenience and interoperability are priorities. It is particularly well-suited for web applications and services that interact with external APIs or need to be consumed by a variety of clients, including browsers.</li><li><strong>Protobuf (Protocol Buffers)</strong>: Developed by Google, Protobuf is a binary format that is more compact and faster than JSON. It is ideal for internal communications within the system where performance and efficiency are critical. Protobuf is particularly beneficial in environments where bandwidth and processing speed are constraints, such as in microservices communicating over a network.</li><li><strong>Avro</strong>: Avro is a binary serialization format that is schema-based and schema-evolution friendly. It is well-suited for systems that require robust support for data schemas that may evolve over time. Avro is particularly useful for big data processing scenarios, where large volumes of data are serialized and deserialized across different services.</li></ul><h4>Choosing the Best Protocol</h4><ul><li><strong>For Developer Friendliness and Flexibility</strong>: JSON is the best choice due to its simplicity and wide adoption in web technologies.</li><li><strong>For Performance and Efficiency</strong>: Protobuf is recommended when communication efficiency is paramount, as it offers faster serialization and smaller message sizes.</li><li><strong>For Schema Evolution and Big Data</strong>: Avro is ideal for applications that handle large volumes of evolving data, providing robust support for schema management and compatibility.</li></ul><h3>Configuration Management in Microservices</h3><p>Effective configuration management is pivotal in a microservices architecture, especially when it comes to maintaining flexibility and agility across a distributed system. By externalizing configuration and managing it centrally, microservices can adapt their behavior on-the-fly without the need for redeployment. This capability is crucial for quickly responding to changes in demand, scaling needs, and operational adjustments.</p><h4>Externalizing Configuration</h4><p>Externalizing configuration involves separating configuration settings from the codebase. This means that any configuration data that might vary between deployments (such as database URLs, credentials, and service endpoints) is kept outside the service’s deployable artifact. Here’s why this approach is beneficial:</p><ul><li><strong>Flexibility</strong>: Changes to configurations can be made independently of the application code. This allows for adjustments in real-time without the need to rebuild or redeploy the application, which is particularly valuable in dynamic environments where conditions change rapidly.</li><li><strong>Environment Parity</strong>: It helps maintain consistency across different environments (development, testing, production) by allowing the same application code to be used everywhere with different configurations applied externally.</li><li><strong>Security</strong>: Sensitive configurations like passwords and API keys can be managed more securely and kept separate from the code, reducing the risk of accidental exposure.</li></ul><h4>Centralized Configuration Management</h4><p>Managing configurations centrally is a practice where all configuration settings are stored in a central location and accessed by microservices as needed. Tools like Spring Cloud Config, Consul, or HashiCorp Vault are commonly used for this purpose. Centralized configuration management offers several advantages:</p><ul><li><strong>Consistency</strong>: Ensures that all microservices use the most up-to-date and consistent configuration settings, reducing the risks of configuration drift and inconsistencies that can lead to errors and unexpected behavior.</li><li><strong>Auditability</strong>: Changes to configurations can be tracked and audited. Central management tools often provide history tracking, which helps in understanding changes over time and can be crucial for troubleshooting and compliance.</li><li><strong>Scalability</strong>: As the number of microservices grows, managing configurations centrally becomes increasingly efficient compared to managing configurations individually for each service. It simplifies the administration and deployment processes, making scaling smoother and more manageable.</li></ul><h4>Implementation Strategies</h4><ul><li><strong>Dynamic Configuration</strong>: Implement mechanisms to refresh configurations dynamically without restarting the service. Many modern tools support this feature, allowing services to adapt to new configurations immediately.</li><li><strong>Secure Storage</strong>: Use secure vaults for sensitive data and implement encryption for data in transit and at rest. Ensure that access to configuration data is tightly controlled and monitored.</li><li><strong>Environment-Specific Configurations</strong>: Define and maintain separate configurations for different environments. This helps in minimizing the risk of errors such as using production credentials in a development environment.</li><li><strong>Automated Testing</strong>: Regularly test configuration changes in a controlled environment before rolling them out to production. This helps in catching potential issues early and increases confidence in the deployment process.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9828723202c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Breaking Cloud Barriers: Unified Code with DAPR for Event Driven Applications]]></title>
            <link>https://medium.com/@apoorv.adarsh/breaking-cloud-barriers-unified-code-with-dapr-for-event-driven-applications-b086bed53319?source=rss-1ee2225d7005------2</link>
            <guid isPermaLink="false">https://medium.com/p/b086bed53319</guid>
            <category><![CDATA[cloud-agnostic]]></category>
            <category><![CDATA[dapr]]></category>
            <dc:creator><![CDATA[Apoorv Adarsh]]></dc:creator>
            <pubDate>Tue, 19 Nov 2024 05:04:59 GMT</pubDate>
            <atom:updated>2024-11-19T05:10:19.238Z</atom:updated>
            <content:encoded><![CDATA[<p>Every developer who has ever built a cloud-native event-driven application understands that the application is not exactly “cloud-native”. Rather, the application is “cloud provider native”. This distinction arises because each public cloud provider offers its unique services for event streaming, complete with specific APIs and SDKs. Consequently, the application code becomes tightly intertwined with a particular cloud service, rendering migrations across cloud providers not just challenging but necessitating substantial code modifications within microservices. A task perceived by business stakeholders as a potentially simple DevOps job escalates into a full-fledged development project, underscoring the complexities of cloud dependencies in modern software architecture.</p><p>Some teams navigate these challenges by opting for more universally compatible technologies such as Kafka or RabbitMQ for their event streaming needs, instead of relying on proprietary services like Kinesis, EventHub, or PubSub. While this strategy does provide greater flexibility to deploy across various cloud platforms, it might come at the cost of missing out on the unique advantages and integrations offered by the native event streaming platforms of major cloud providers.</p><p>Enter DAPR (Distributed Application Runtime), a game-changer designed to alleviate these very challenges. By providing a single SDK and externalized configuration, DAPR offers a streamlined path toward building and deploying event-driven applications without being bogged down by cloud service specifics. It abstracts away the complexities of cloud provider APIs, allowing developers to focus on business logic and accelerating the shift towards a truly cloud-agnostic approach. This innovative approach not only simplifies cross-cloud migrations but also democratizes event-driven architecture, making it more accessible and manageable across diverse cloud environments.</p><h3>Producing and Consuming Messages with DAPR in a Java Spring Boot Application</h3><p>As discussed, DAPR simplifies building resilient, microservice-oriented applications that are cloud and platform agnostic. By offering consistency and portability through event-driven architecture, DAPR enables developers to produce and consume messages seamlessly, irrespective of the underlying infrastructure. Below is some redacted code on how we were able to use DAPR SDK to switch between Kafka and MQTT in our POC</p><h3>Producer</h3><pre>try (DaprClient daprClient = new DaprClientBuilder().build()) {<br>    PublishEventRequest publishEventRequest=new PublishEventRequest(pubsubName,<br>                                                                    topicName,<br>                                                                    &quot;dummy data&quot;);<br>    client.publishEvent(publishEventRequest).block();<br>}</pre><h3>Consumer</h3><p>There are different ways by which we can consume a message from a pub-sub topic. More details can be found at — <a href="https://docs.dapr.io/developing-applications/building-blocks/pubsub/subscription-methods">https://docs.dapr.io/developing-applications/building-blocks/pubsub/subscription-methods</a></p><p>Below is an example of programmatic subscription.</p><pre>@Topic(name = &quot;dapr_pubsub_topic_name&quot;, pubsubName = &quot;dapr_pubsub_name&quot;)<br>@PostMapping(path = &quot;/consume&quot;)<br>public void consumeEvent(CloudEvent event) {<br>    DaprEvent daprEvent = OBJECT_MAPPER.convertValue(event.getData(), DaprEvent.class);<br>    service.processConsumedEvent(daprEvent);<br>}</pre><h3>Configuring DAPR for Optimal Event Streaming</h3><p>Having explored the process of publishing and subscribing to topics with the DAPR SDK, it’s essential to delve into integrating DAPR with downstream services such as Kafka and RabbitMQ. Proper configuration of DAPR to seamlessly connect with your selected event streaming service is a pivotal phase in leveraging its capabilities to consolidate and streamline your microservices architecture. This adaptability not only makes your applications more versatile and future-proof but also enables developers to select the most suitable tools for their needs without the constraints of vendor lock-in or the complexities of migrating services in the future.</p><h3>Component Definition Files</h3><p>DAPR reads the component definition files at runtime to initialize and configure the components specified for use in your application. This allows your microservices to communicate with external systems through DAPR’s unified APIs, without needing direct integrations or knowledge of specific SDKs.</p><h3>Purpose of Component Definition Files</h3><ul><li><strong>Streamline Integration</strong>: Abstracting service configurations into YAML files simplifies the integration process.</li><li><strong>Boost Portability</strong>: Changing services only requires updating the component files, not the application code.</li><li><strong>Increase Flexibility</strong>: Enables easy switches between technologies or services to meet new requirements.</li><li><strong>Maintain Consistency</strong>: Helps keep configurations consistent across different deployment environments.</li></ul><h3>Creating Component Definition Files</h3><p>To create a component definition file:</p><ul><li>Define the apiVersion, kind (type of component, e.g., pubsub.kafka), metadata (name and namespace), spec (component type and version), and metadata (service-specific configurations) in YAML format.</li><li>Include necessary details such as connections strings or URLs as key-value pairs in the metadata section.</li></ul><p>To configure DAPR to work with Kafka and MQTT using component definition files, you would create separate YAML files for each, specifying the necessary configurations for these messaging systems. Below are the examples for creating component definition files for both Kafka and MQTT. These configurations assume that both services are running on localhost without any security settings enabled.</p><h3>Kafka Component Definition File</h3><pre>apiVersion: dapr.io/v1alpha1<br>kind: Component<br>metadata:<br>  name: kafka-pubsub<br>spec:<br>  type: pubsub.kafka<br>  version: v1<br>  metadata:<br>  - name: brokers<br>    value: &quot;localhost:9092&quot; <br>  - name: authRequired<br>    value: &quot;false&quot;<br>  - name: publishTopic<br>    value: &quot;dapr_pubsub_topic_name&quot; # Customize this<br>  - name: consumerGroup<br>    value: &quot;dapr-consumer-group&quot; # Customize this</pre><h3>MQTT Component Definition File</h3><pre>apiVersion: dapr.io/v1alpha1<br>kind: Component<br>metadata:<br>  name: mqtt-pubsub<br>spec:<br>  type: pubsub.mqtt<br>  version: v1<br>  metadata:<br>  - name: url<br>    value: &quot;tcp://localhost:1883&quot; # Default MQTT port<br>  - name: publishTopic<br>    value: &quot;dapr_pubsub_topic_name&quot; # Customize this<br>  - name: subscribeTopic<br>    value: &quot;dapr_pubsub_topic_name&quot; # Customize this<br>  - name: consumerID<br>    value: &quot;dapr-consumer-group&quot; # Customize this <br>  - name: cleanSession<br>    value: &quot;false&quot;<br>  - name: qos<br>    value: &quot;0&quot; # 0, 1, or 2</pre><h3>Forging Ahead in DAPR Exploration</h3><p>In this blog, we’ve explored how to configure DAPR with various event streaming services, such as Kafka and MQTT, demonstrating DAPR’s ability to simplify microservices architecture. Through examples of component definition files and integration with DAPR SDKs, we’ve provided a foundation for those eager to leverage event-driven architectures effectively.</p><h3>References</h3><p><a href="https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-overview/">https://docs.dapr.io/developing-applications/building-blocks/pubsub/pubsub-overview/</a></p><p><a href="https://docs.dapr.io/developing-applications/building-blocks/pubsub/howto-publish-subscribe/">https://docs.dapr.io/developing-applications/building-blocks/pubsub/howto-publish-subscribe/</a></p><p><a href="https://docs.dapr.io/reference/components-reference/supported-pubsub/">https://docs.dapr.io/reference/components-reference/supported-pubsub/</a></p><p><a href="https://docs.dapr.io/reference/api/pubsub_api/">https://docs.dapr.io/reference/api/pubsub_api/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b086bed53319" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Brewing Faster AWS Lambda Functions]]></title>
            <link>https://medium.com/@apoorv.adarsh/brewing-faster-aws-lambda-functions-44d2bf5854cf?source=rss-1ee2225d7005------2</link>
            <guid isPermaLink="false">https://medium.com/p/44d2bf5854cf</guid>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[spring-cloud-function]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[lambda-function]]></category>
            <dc:creator><![CDATA[Apoorv Adarsh]]></dc:creator>
            <pubDate>Tue, 19 Nov 2024 04:40:35 GMT</pubDate>
            <atom:updated>2024-11-19T04:40:35.631Z</atom:updated>
            <content:encoded><![CDATA[<h3>Waking Up the Sleeping Giants</h3><p>For the uninitiated, AWS Lambda is Amazon’s serverless compute service, allowing developers to run code in response to triggers without the hassle of managing the underlying infrastructure. It’s like having an on-demand, personal code runner at your beck and call, ready to leap into action… eventually. The catch, however, lies in the “eventually” part. When a Lambda function is invoked after sitting idle, AWS needs to prepare a new execution environment — allocating resources, loading the runtime, and then your code. This initial delay is our notorious cold start, a phenomenon particularly pronounced for Java applications.</p><p>When deploying Java applications developed with Spring Cloud Functions, the challenge intensifies. Spring’s comprehensive functionality, while advantageous for creating robust applications, adds to the initialization time, exacerbating the cold start problem in the serverless context of AWS Lambda.</p><p>Addressing cold starts in this scenario requires a focused effort on optimization. Developers must streamline their Spring-based Lambda functions, aiming to reduce the application’s footprint by minimizing dependencies and refining the code. The goal is to retain the benefits of using Spring, such as its extensive libraries and tools for enterprise-level applications, while mitigating the impact of cold starts through careful, efficiency-focused adjustments.</p><p>In response to these challenges, our strategy evolved to focus on reducing the cold start times of our Lambda functions. By starting with Spring Cloud Functions, we laid a solid foundation that leverages the strengths of the Spring ecosystem. From this starting point, we embarked on a continuous process of optimization, aiming to streamline our Spring-based Lambda applications. This involved refining our code, minimizing dependencies, and leveraging best practices for serverless computing to ensure that our applications remain responsive and efficient, even when scaled up to meet enterprise demands. Through this iterative process, we aim to strike the perfect balance between the rich functionality of Spring applications and the agility required in a serverless environment, effectively minimizing cold start times while maximizing performance and scalability.</p><h3>Pre-Warm-Up Stretches: Understanding the Challenge</h3><p>Imagine AWS Lambda functions as athletes who’ve been resting too long. They’re fit but need a warm-up to perform their best. This is crucial for Java functions, which inherently take longer to warm up. Addressing cold starts is like fine-tuning an athlete’s preparation to enhance performance, focusing on efficiency, cost, and user experience. Users expect quick responses, unaware of the background “warming up” processes like runtime initialization and code loading. For Java, warming up can be sluggish, akin to getting out of bed on a cold morning. To combat cold starts, think of it as creating an effective warm-up routine for Lambda functions, making them agile and ready to spring into action, ensuring they’re at peak performance from the start.</p><h3>Strategy #1: Stay Warm with Provisioned Concurrency</h3><p>Think of provisioned concurrency like pre-warming your car in winter for an instant, smooth start. It’s a feature in AWS Lambda that pre-initializes a specified number of function instances, ensuring they’re ready to execute immediately, bypassing the cold start latency common with Java functions due to JVM initialization.</p><h3>The Trade-offs</h3><p>While effective in reducing latency, provisioned concurrency comes with its costs. You pay for keeping instances warm, regardless of use, which could lead to higher expenses if not managed carefully. Additionally, it requires monitoring and fine-tuning to align with demand, adding a layer of management complexity.</p><h3>AWS’s Approach</h3><p>AWS provides multiple tools to help manage provisioned concurrency for Lambda functions, aiding in the reduction of cold starts. However, it’s important to remember that these tools do not eliminate cold starts entirely, especially if invocations exceed the set provisioned capacity. Here’s a brief overview of how provisioned concurrency can be configured using AWS’s offerings:</p><ul><li><strong>AWS Management Console</strong>: Offers a straightforward, graphical interface to directly set provisioned concurrency levels for Lambda functions under the “Concurrency” tab of a function’s settings.</li><li><strong>AWS SAM CLI</strong>: Allows defining provisioned concurrency in the SAM template (YAML) under ProvisionedConcurrencyConfig for a function. Deploying with SAM CLI applies these settings automatically, ideal for Infrastructure as Code (IaC) enthusiasts.</li><li><strong>AWS CloudFormation</strong>: Similar to SAM, CloudFormation templates can specify provisioned concurrency using the ProvisionedConcurrencyConfig property within the AWS::Lambda::Alias resource, catering to those managing AWS resources via CloudFormation.</li><li><strong>AWS CodeDeploy</strong>: Useful for managing Lambda deployments, including provisioned concurrency updates, through defined deployment groups and preferences. It’s particularly beneficial for implementing advanced deployment strategies like blue/green deployments.</li><li><strong>AWS CLI</strong>: Provides command-line flexibility with the aws lambda put-provisioned-concurrency-config command, allowing for scriptable and automated management of provisioned concurrency.</li></ul><h3>In Summary</h3><p>Provisioned concurrency is a potent tool against cold starts, offering ready-to-execute Lambda instances. However, it’s essential to balance its benefits against its costs and management needs, ensuring it’s a cost-effective solution for enhancing your serverless application’s responsiveness.</p><h3>Strategy #2: Using AWS Snap Start for Java Lambda Functions</h3><p>AWS Snap Start significantly reduces cold start latency for Java-based AWS Lambda functions by optimizing JVM initialization, akin to an electric car’s instant acceleration. This feature is designed specifically for Java functions, offering cost efficiency by reducing the need for idle compute capacity.</p><h3>Enabling Snap Start</h3><p>Snap Start can be enabled across various AWS services and tools with ease:</p><ul><li><strong>AWS Management Console</strong>: Find the Snap Start option in your Lambda function’s configuration settings in the console and enable it.</li><li><strong>AWS SAM CLI &amp; CloudFormation</strong>: Add SnapStartEnabled: true to your function’s settings in SAM or CloudFormation templates.</li><li><strong>AWS CLI</strong>: Use the AWS CLI command below to enable Snap Start for your Lambda functions: aws lambda update-function-configuration --function-name my-function --enable-snap-start This method suits automation and scripting needs.</li><li><strong>AWS CodeDeploy</strong>: Incorporate Snap Start configurations in your deployment settings to optimize new function versions from the beginning, facilitating seamless integration into automated deployment workflows.</li></ul><h3>In Summary</h3><p>Snap Start streamlines the deployment of responsive Java Lambda functions by minimizing cold starts, enhancing user experience without additional management overhead or costs. By leveraging AWS’s configuration and monitoring tools, developers can easily integrate and assess the impact of Snap Start on their serverless applications.</p><h3>Strategy #3: Priming the Spring Cloud Function</h3><p>To mitigate cold starts and ensure optimal performance, “priming” these functions can be crucial. This strategy involves initializing critical paths and warming up the application context before heavy lifting occurs. This can include pre-loading application contexts, establishing database connections, caching frequently accessed data, and loading external configurations or libraries that are essential for the function’s operation. By doing so, these elements are ready and waiting when the function is invoked, allowing for quicker response times and smoother execution of business logic right from the start. Here’s how to implement priming in your Spring Cloud Function setup:</p><h3>Custom Initialization Code</h3><p>One effective way to prime your Spring Cloud Function is by adding custom initialization code that pre-loads necessary resources and components. This can be done by implementing an ApplicationRunner or CommandLineRunner interface, which Spring calls after the application context is loaded but before the Lambda function is invoked.</p><pre>@Component<br>public class PrimedHandler implements Function&lt;APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent&gt;, Resource {</pre><pre>  @Override<br>  public void beforeCheckpoint(org.crac.Context&lt;? extends Resource&gt; context) throws Exception {<br>           logger.info(&quot;entered beforeCheckpoint method for priming&quot;);<br>           // dao.getProperties(&quot;dev&quot;);<br>      }<br>  <br>  @Override<br>    public void afterRestore(org.crac.Context&lt;? extends Resource&gt; context) throws Exception {}</pre><h3>Leveraging Snap Start with Priming</h3><p>By combining Snap Start’s JVM optimization with targeted priming of Spring Cloud Functions, developers can achieve a significant reduction in cold start times. This dual approach ensures that both the underlying platform (JVM) and the application layer are optimized for quick responsiveness, providing a seamless experience for end-users even during the initial invocation of serverless functions.</p><h3>In Summary</h3><p>The strategic combination of priming Spring Cloud Functions and utilizing AWS Snap Start represents a comprehensive approach to mitigating cold starts in serverless Java applications. Priming prepares the application’s operational environment by pre-loading essential components such as application contexts, database connections, and necessary configurations. This ensures that the function is in an optimal state to execute business logic as soon as it’s invoked. When paired with Snap Start, which significantly reduces the JVM initialization time, the overall cold start latency can be dramatically decreased.</p><h3>Conclusion: The Warm Afterglow — Enjoying Faster Functions</h3><p>As we wrap up our journey through the landscape of serverless Java, we’ve explored the highways and byways of optimizing cold starts, from the cozy familiarity of Spring to the sleek, rocket-powered potential of Micronaut. Each strategy, from embracing AWS Snap Start to the artful priming of Spring Cloud Functions, offers a path toward the same destination: enjoying faster, more responsive serverless functions.</p><p>Diving headfirst into these strategies is a call to action. Fine-tuning JVM settings, giving functions a pep talk with priming, or boldly venturing into the realm of Micronaut and GraalVM opens up a treasure trove of performance enhancements. The journey to serverless optimization is indeed a rollercoaster of challenges and victories. It’s worth remembering that even the most sluggish Java functions can transform into early birds with just a bit of nudging. Here’s to serverless applications not merely stumbling out of bed but vaulting over the side, eager to seize the day with unmatched speed and agility.</p><p>And hey, if all else fails, you can always tell your engineering manager that your Java functions are “strategically pausing to consider their next move” during those cold starts. Here’s to making those serverless functions not just wake up but do a morning sprint, leaving your engineering manager wondering if they accidentally switched their coffee for decaf!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44d2bf5854cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>