<?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 Ali Ahsan on Medium]]></title>
        <description><![CDATA[Stories by Ali Ahsan on Medium]]></description>
        <link>https://medium.com/@aliahsan?source=rss-6b92a53cdbaf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*uZycfS9yG57VcuuO.</url>
            <title>Stories by Ali Ahsan on Medium</title>
            <link>https://medium.com/@aliahsan?source=rss-6b92a53cdbaf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 09:29:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aliahsan/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[GraphQL at Ordergroove: From API Layer to Agent Interface for Relationship Commerce]]></title>
            <link>https://medium.com/ordergroove-engineering/graphql-at-ordergroove-from-api-layer-to-agent-interface-for-relationship-commerce-ced908aed67d?source=rss-6b92a53cdbaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/ced908aed67d</guid>
            <category><![CDATA[headless]]></category>
            <category><![CDATA[subscription]]></category>
            <category><![CDATA[graphql-vs-rest]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Ali Ahsan]]></dc:creator>
            <pubDate>Wed, 25 Mar 2026 21:33:55 GMT</pubDate>
            <atom:updated>2026-03-26T18:27:59.339Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tQRy32bY832UAGSG9jxiOg.png" /></figure><h3><strong>Why GraphQL</strong></h3><p>Subscription commerce has a REST problem: over-fetching, under-fetching, and cascading round trips that compound as programs scale across web, SMS, in-store, and AI agents. GraphQL fixes the tradeoff. One query, exact data, no waste.</p><p>For Ordergroove merchants specifically, it unlocks three things: <strong>performance</strong> at the moments subscribers decide to stay or go; <strong>flexibility</strong> for the full range of headless and custom builds on our platform; and <strong>composability</strong> for the LLM-powered agents that increasingly need to traverse a well-typed schema, not guess at fixed REST endpoints.</p><p>Subscriptions are a dynamic, personalized, multi-channel relationship between a brand and its best customers. The infrastructure needs to match.</p><p>REST APIs are designed around resources, while real world subscription experiences in commerce, and increasingly, intelligent systems, operate across relationships between those resources. Even when individual REST endpoints were performant, assembling a complete view required orchestration across multiple calls, introducing latency, complexity, and fragmented data access patterns. If a merchant offers bundle or box products, you could easily end up with 10+ calls.</p><h3>Our Vision: How Ordergroove Is Approaching GraphQL</h3><p>GraphQL allows us to shift from endpoint orchestration to graph traversal. Instead of teaching merchant developers how to navigate our system through expandable REST APIs, we decided to expose a unified, strongly-typed graph that mirrors the underlying relationships in subscription commerce. This is not just a performance improvement, it is a structural change in how data is accessed, composed, and reasoned about. Especially for headless architecture, this abstraction allows merchants to build across web, mobile, and SMS channels without coupling to backend implementation details.</p><p>Critically, this same foundation positions us for AI-agent readiness through our MCP. Unlike human developers, agents optimize for token efficiency, predictability, and discoverability. GraphQL provides all three. Through schema introspection, an agent can “discover” capabilities without hardcoded knowledge of endpoints. Strong typing reduces ambiguity and hallucination risk. Field-level selection ensures agents retrieve only the data they need, avoiding the “context window tax” of over-fetching large payloads.</p><p>In contrast to REST, where agents must chain calls and filter noisy responses, GraphQL enables a single, precise query that returns complete context. This simplifies planning, reduces token usage, and increases reliability in agent-driven workflows.</p><p>GraphQL is not just a better API for developers, it is a machine native interface that enables both humans and AI agents to interact with Ordergroove in a more efficient, predictable, and scalable way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_tz4TUnMQEjM7z-omop8cQ.png" /></figure><h3>Near-Term: What We’re Shipping</h3><p>GraphQL at Ordergroove is already live in Early Access and purpose-built for fast, reliable data retrieval. Merchants are using it to power page loads and complex UI states, while continuing to rely on REST for transactional updates. This hybrid model is working well in practice, delivering significant performance gains without requiring a full migration.</p><p>Early adopters, including enterprise merchants, are already running their Subscription Manager and other customer-facing surfaces on GraphQL, seeing up to 55% improvement in page load times. What previously required 10+ REST calls can now be resolved in a single query</p><p>Here’s a representative example, fetching a customer’s recent orders with line items and product details:</p><pre>query {<br>  orders(customer: &quot;JohnDoeID&quot;, first: 10) {<br>    edges {<br>      node {<br>        publicId<br>        status<br>        subTotal<br>        total<br>        place<br>        created<br>        items {<br>          nodes {<br>            quantity<br>            product {<br>              name<br>              externalProductId<br>            }<br>          }<br>        }<br>      }<br>    }<br>  }<br>}</pre><p>Over the next month or so, we’re working closely with our Early Access partners and rapidly iterating on the schema, refining query patterns and expanding capabilities based on real production usage. We will also be re-implementing Ordergroove’s Subscription Manager on GraphQL to leverage these performance gains and deliver a faster, simpler experience for merchants using our out of the box solution, before taking it to Open Beta.</p><p>The subscription platforms that define the next era of commerce won’t win on features alone, they’ll win on infrastructure. GraphQL is a foundational bet on that future. If you want early access to our GraphQL layer, please reach out to your CSM to learn more. And if you want to build this kind of infrastructure, learn more about <a href="https://www.ordergroove.com/careers/">Careers at Ordergroove.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ced908aed67d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ordergroove-engineering/graphql-at-ordergroove-from-api-layer-to-agent-interface-for-relationship-commerce-ced908aed67d">GraphQL at Ordergroove: From API Layer to Agent Interface for Relationship Commerce</a> was originally published in <a href="https://medium.com/ordergroove-engineering">Ordergroove Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Guaranteeing High Availability — how we do it at OrderGroove]]></title>
            <link>https://medium.com/ordergroove-engineering/guaranteeing-high-availability-how-we-do-it-at-ordergroove-c3cf3371c3f5?source=rss-6b92a53cdbaf------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3cf3371c3f5</guid>
            <category><![CDATA[akamai]]></category>
            <category><![CDATA[high-availability]]></category>
            <category><![CDATA[disaster-recovery]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Ali Ahsan]]></dc:creator>
            <pubDate>Fri, 22 Jun 2018 13:01:26 GMT</pubDate>
            <atom:updated>2018-06-22T13:01:26.286Z</atom:updated>
            <content:encoded><![CDATA[<p>Even the most robust systems experience outages from time to time. They can occur due to routine maintenance operations or sudden system crashes. Fortunately, however, there are steps you can take to mitigate the downtime risk in both planned and unplanned situations.</p><p>In this post, I will introduce the concept of availability, explain why and how we implement high availability at OrderGroove, and share some learnings from our experience that might be helpful for anyone considering to undertake a similar journey.</p><p><em>Availability</em> is generally measured and expressed as an uptime percentage of a system over a period of time (a month or a year).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*_AcDhvfZpUqNvCI-Lx89DQ.png" /><figcaption>Translation of common availability percentages to downtime in mintues</figcaption></figure><p>Availability requirements for a system are determined by analyzing the cost of downtime of that service to the business. e.g. For an online retailer, 30 minute of downtime to its checkout flow would likely result in a significant loss of revenue, but a 60 minute outage of an email delivery service will be less critical.</p><p><strong>High Availability Setup at OrderGroove</strong></p><p>We have done rigorous downtime cost analysis for different services in our platform. For business critical services, our SLA guarantees 99.95% availability. We achieve this by implementing an Active-Passive setup that spreads our infrastructure across three geographically distinct regions. Our active data center setup is in Chicago, our failover or passive data center is in Virginia, and a third, light weight, internal use only cluster is setup in Dallas. A simplified version of the architecture is shown in the diagram below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*r470WLLWwLaHdiMriAFkjg.png" /><figcaption>OrderGroove highly availability architecture</figcaption></figure><h4><strong>Part 1: Routing traffic to the appropriate target data center</strong></h4><p>At the top most layer our DNS record resolves to an <a href="https://developer.akamai.com/learn/Overview/Client_Edge_Servers_Origin.html">Akamai Edge server</a>. The edge server internally uses another Akamai component called the <a href="https://www.akamai.com/us/en/products/web-performance/global-traffic-management.jsp">Global Traffic Management (GTM)</a>, to determine the appropriate traffic target from which to serve a request. It directs all end user traffic to the primary data center unless that fails, in which case all traffic will be directed to the failover data center. GTM pings health check endpoints on both data centers continuously to keep track of target availability.</p><p>There are a few configuration variables to watch out for when configuring GTM:</p><ul><li><em>Time to live</em> (TTL): This determines how long a DNS record will be cached for so that, in case of failover, an already cached record will still keep pointing to the older record.</li><li><em>Failover delay:</em> This determines how long the GTM will wait for before switching over to the backup data center once it detects a failure on the active data center.</li><li><em>Fail back delay:</em> When in a failover mode, this determines how long GTM will wait before routing the traffic back to the active data center, after sensing it has returned to a healthy state.</li></ul><p>Too small of a value for any of these variables risks false positives where GTM will switch traffic between the data centers at random blips, while a bigger value risks a larger time window during which traffic is not being routed to the preferred data center.</p><h4><strong>Part 2: Database replication</strong></h4><p>High availability setup requires redundancy in the data layer. Multiple copies of databases on separate servers within a data center provide fault tolerance against failure of a single machine. Similarly replicating data across data centers mitigates risk of a data center outage.</p><p>The particular service taken as an example uses <a href="https://www.mongodb.com/">MongoD</a>B as its data store. Due to the large volume of data, this service uses a <a href="https://docs.mongodb.com/manual/sharding/#sharded-cluster">sharded</a> MongoDB cluster comprising of 5 shards. Each shard is a replica set consisting of five nodes.</p><p>There is one primary node that gets all the write operations and maintains a log of all operations in a collection called the <a href="https://docs.mongodb.com/manual/core/replica-set-oplog/">oplog</a>. There are multiple <a href="https://docs.mongodb.com/manual/core/replica-set-members/#secondaries">secondary</a> nodes that replicate data from the primary by applying all operations from the primary’s oplog. In the case where the primary node goes down, any of the secondary nodes is capable of becoming a primary. There is also a non data-bearing node in the replica set called the <a href="https://docs.mongodb.com/manual/core/replica-set-members/#arbiter">arbiter</a>. An arbiter does not have a copy of data and it cannot become a primary. Its only purpose is to participate in the election process to help elect a new primary. All members periodically exchange heartbeats, in the form of simple pings, with each other to stay up to date on the accessibility of other replica set members.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LycY0cW1Tt2MJrIT1tj8hQ.png" /><figcaption>Communication between replica set members</figcaption></figure><p>In order to elect a new primary, the election process in a MongoDB replica set requires a majority of the nodes to be available. Therefore to protect against data center failure we have to distribute replica set members strategically so as to maximize the likelihood that remaining members of the replica set can still form a majority.</p><p>At OrderGroove, we keep the same number of data-bearing nodes in our active and failover data centers. Finally, we keep an arbiter in a third data center. This makes the total number of nodes in the replica set to be odd and thus making sure that there is never a tie of votes in the process to elect a primary. This distribution also allows us to mitigate the risk of data center failure. In case of any one data center failing, a majority of the nodes (more than half) will still be available and therefore will be able to elect a new primary.</p><p>While setting up a high availability MongoDB replica set, it is important to set an appropriate <a href="https://docs.mongodb.com/manual/core/replica-set-elections/#member-priority">priority</a> for each of the replica set members. The priority setting defines both timing and outcome of the election for a primary. Higher priority nodes are more likely to call an election and are more likely to win. We set the highest priority for the nodes in our primary data center. This ensures that a primary node is always elected from this data center first as long as one of these nodes is still available. The nodes in the failover data center have lower priority, making these nodes the backup only in the event that all the nodes in the primary data center are unavailable.</p><h3>Key learnings</h3><p>Here are a few takeaways from our high availability implementation work that might be helpful for someone with similar service availability concerns. Each of these warrants a separate blog post of its own but I will highlight them here:</p><ul><li>Carefully select the actions that should be executed synchronously, and be on the lookout for opportunities where tasks can be deferred to asynchronous execution. This will drive the infrastructure footprint requiring high availability to a bare minimum. Consider, for example, a service that captures checkouts. It creates orders and sends a confirmation email to the customer. Instead of implementing high availability for the entire workflow, it might be acceptable to only guarantee capture of the incoming requests. As long as requests are successfully queued up, the rest of the workflow can happen asynchronously as it is less time critical.</li><li>If you don’t keep the backup data center warmed up, when failover is triggered, you can possibly experience higher than usual latency. One way to address this cold start problem is to set the failover data center to rerun read queries from the active data center so that caches and databases are primed for efficient query response.</li><li>Finally, you should develop a cadence for testing your high availability setup via a forced failover. <a href="https://github.com/Netflix/chaosmonkey">Chaos monkey</a> is a great tool to facilitate this exercise, but periodically doing a manual forced failover can be a good starting point as well.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3cf3371c3f5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/ordergroove-engineering/guaranteeing-high-availability-how-we-do-it-at-ordergroove-c3cf3371c3f5">Guaranteeing High Availability — how we do it at OrderGroove</a> was originally published in <a href="https://medium.com/ordergroove-engineering">Ordergroove Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>