<?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 Priyaraman on Medium]]></title>
        <description><![CDATA[Stories by Priyaraman on Medium]]></description>
        <link>https://medium.com/@priyaraman.nov07?source=rss-90baf3691e8f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FSzoQQ17D7IlUjX80unoFA.jpeg</url>
            <title>Stories by Priyaraman on Medium</title>
            <link>https://medium.com/@priyaraman.nov07?source=rss-90baf3691e8f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 16:20:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@priyaraman.nov07/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[Scaling Beyond 1 Million Records Without Designing for a Fixed Limit]]></title>
            <link>https://medium.com/@priyaraman.nov07/scaling-beyond-1-million-records-without-designing-for-a-fixed-limit-2ed6aff1cbd5?source=rss-90baf3691e8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ed6aff1cbd5</guid>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[amazon-ecs]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Priyaraman]]></dc:creator>
            <pubDate>Mon, 30 Nov 2026 11:31:01 GMT</pubDate>
            <atom:updated>2026-11-30T11:31:01.618Z</atom:updated>
            <content:encoded><![CDATA[<p>In performance engineering, we often start with a simple question:</p><blockquote><strong><em>How much load can the system handle?</em></strong></blockquote><p>But sometimes performance testing uncovers something more valuable than a number. It exposes an architectural limitation and leads to a design that removes the limitation altogether.</p><p>Recently, during one of our performance validations, we discovered exactly that.</p><h4>The Problem: The Pipeline Hit a Wall at 100K</h4><p>During performance testing of a data-processing pipeline, we gradually increased the input data volume.</p><p>Everything worked as expected until we crossed approximately <strong>100,000 records</strong>.</p><p>Beyond that point, the pipeline started running into stability and resource-related challenges.</p><p>Then came the business requirement:</p><blockquote><strong><em>The pipeline should support more than 1 million records.</em></strong></blockquote><p>Increasing capacity from <strong>100K to 1M+</strong> is already a significant jump.</p><p>But there was an even bigger question:</p><h4>What happens after 1 million?</h4><p>Today it might be 1 million.</p><p>Tomorrow it could be: 1M → 2M → 5M → 10M → ?</p><p>We couldn’t confidently predict how much the business data would grow in the future.</p><p>That meant simply optimizing the existing pipeline for <strong>1 million records</strong> would solve today’s problem, but potentially create tomorrow’s performance issue.</p><h4>The Traditional Approach</h4><p>My first thought was what I had seen many times before:</p><ul><li>Increase CPU and memory</li><li>Increase the number of pipeline instances</li><li>Configure a larger infrastructure</li><li>Add additional workers</li><li>Define a higher maximum batch size</li><li>Introduce another capacity limit</li></ul><blockquote>For example:</blockquote><blockquote>Pipeline Capacity: 100K → Increase Infrastructure → New Capacity: 1M</blockquote><p>It works.</p><p>But what happens when the requirement becomes <strong>2 million</strong>?</p><p>We scale again.</p><p>Then 5 million?</p><p>Scale again.</p><blockquote>This creates a continuous cycle:</blockquote><blockquote>Business growth → Pipeline reaches limit → Performance issue → Infrastructure change → Performance validation → New limit</blockquote><p>The development team’s solution took a completely different approach.</p><p>And honestly, it was one of the more interesting pipeline-scaling approaches I’ve seen in recent years.</p><h4>Don’t Scale the Batch. Split the Batch.</h4><p>Instead of designing a pipeline capable of processing one enormous dataset, the team changed the processing model.</p><blockquote>The basic idea was:</blockquote><blockquote>Split the incoming dataset into smaller chunks based on the processing capacity available to each pipeline task.</blockquote><p>So instead of:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*Ng5N6pT8sIma3JIvaCWvcg.png" /></figure><p>the architecture becomes conceptually:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/513/1*RckUzKYt8W5gTpxD6sgYZA.png" /></figure><p>Rather than asking:</p><blockquote>How big should our pipeline become?</blockquote><p>the architecture asks:</p><blockquote><strong><em>How can we divide the work so individual processing units remain within their safe operating capacity?</em></strong></blockquote><p>That is a very different scalability model.</p><h4>Why This Makes Scaling Much More Interesting</h4><p>Assume testing determines that approximately <strong>100K records per processing task</strong> is a comfortable workload.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*1dpK8vSN525zh4hpp08_oQ.png" /></figure><blockquote>If the input is <strong>100K records:</strong> 100K → 1 Chunk → 1 Task</blockquote><blockquote>For <strong>1 million records</strong>: 1M → 10 × ~100K chunks → Multiple ECS tasks</blockquote><blockquote>If someday the input becomes <strong>5 million records</strong>, conceptually the same architecture continues:</blockquote><blockquote>5M → 50 × ~100K chunks → Dynamically scheduled ECS tasks</blockquote><p>The processing unit stays relatively predictable.</p><p>The <strong>number of units changes with demand</strong>.</p><p>That’s the important part.</p><h4>Turning the Idea Into Code: Python ECS Orchestrator</h4><p>Instead of continuously making the pipeline bigger, the architecture takes a smarter approach: <strong>a Python ECS orchestrator dynamically selects the appropriate ECS configuration, splits the dataset based on the task’s validated processing capacity, and distributes those chunks across parallel ECS tasks for scalable processing.</strong></p><p>For example, assume performance testing established these safe processing limits:</p><blockquote>Small ECS configuration → 25K records/task</blockquote><blockquote>Medium ECS configuration → 50K records/task</blockquote><blockquote>Large ECS configuration → 100K records/task</blockquote><p>The important point is that these aren’t theoretical limits. They should come from <strong>performance-test results</strong>, with enough headroom for production variability.</p><p><strong>Example Python implementation</strong></p><blockquote>import math</blockquote><blockquote>import boto3</blockquote><blockquote>ecs = boto3.client(“ecs”)</blockquote><blockquote># Capacity established through performance testing</blockquote><blockquote>ECS_PROFILES = [{</blockquote><blockquote>“name”: “small”,</blockquote><blockquote>“task_definition”: “pipeline-small”,</blockquote><blockquote>“max_records”: 25_000</blockquote><blockquote>},{</blockquote><blockquote>“name”: “medium”,</blockquote><blockquote>“task_definition”: “pipeline-medium”,</blockquote><blockquote>“max_records”: 50_000</blockquote><blockquote>},{</blockquote><blockquote>“name”: “large”,</blockquote><blockquote>“task_definition”: “pipeline-large”,</blockquote><blockquote>“max_records”: 100_000}]</blockquote><blockquote>def select_best_profile():</blockquote><blockquote>“””Select the profile with the highest validated capacity.”””</blockquote><blockquote>return max(</blockquote><blockquote>ECS_PROFILES,</blockquote><blockquote>key=lambda profile: profile[“max_records”])</blockquote><blockquote>def calculate_chunks(total_records, chunk_size):</blockquote><blockquote>“””Calculate how many processing chunks are required.”””</blockquote><blockquote>return math.ceil(total_records / chunk_size)</blockquote><blockquote>def start_ecs_task(profile, start_record, record_count):</blockquote><blockquote>“””Launch an ECS task for one chunk.”””</blockquote><blockquote>response = ecs.run_task(</blockquote><blockquote>cluster=”data-processing-cluster”,</blockquote><blockquote>taskDefinition=profile[“task_definition”],</blockquote><blockquote>launchType=”FARGATE”,</blockquote><blockquote>networkConfiguration={</blockquote><blockquote>“awsvpcConfiguration”: {</blockquote><blockquote>“subnets”: [“subnet-xxxxxxxx”],</blockquote><blockquote>“securityGroups”: [“sg-xxxxxxxx”],</blockquote><blockquote>“assignPublicIp”: “DISABLED”</blockquote><blockquote>}},</blockquote><blockquote>overrides={</blockquote><blockquote>“containerOverrides”: [</blockquote><blockquote>{</blockquote><blockquote>“name”: “pipeline-worker”,</blockquote><blockquote>“environment”: [</blockquote><blockquote>{</blockquote><blockquote>“name”: “START_RECORD”,</blockquote><blockquote>“value”: str(start_record)</blockquote><blockquote>},</blockquote><blockquote>{</blockquote><blockquote>“name”: “RECORD_COUNT”,</blockquote><blockquote>“value”: str(record_count)}]}]})</blockquote><blockquote>return response</blockquote><blockquote>def process_dataset(total_records):</blockquote><blockquote>profile = select_best_profile()</blockquote><blockquote>chunk_size = profile[“max_records”]</blockquote><blockquote>total_chunks = calculate_chunks(</blockquote><blockquote>total_records,</blockquote><blockquote>chunk_size)</blockquote><blockquote>print(f”Dataset size : {total_records:,}”)</blockquote><blockquote>print(f”Selected profile : {profile[‘name’]}”)</blockquote><blockquote>print(f”Capacity per task : {chunk_size:,}”)</blockquote><blockquote>print(f”ECS tasks required : {total_chunks}”)</blockquote><blockquote>for chunk in range(total_chunks):</blockquote><blockquote>start_record = chunk * chunk_size</blockquote><blockquote>remaining = total_records — start_record</blockquote><blockquote>records_to_process = min(chunk_size,remaining)</blockquote><blockquote>print(f”Starting chunk {chunk + 1}:</blockquote><blockquote>“f”{records_to_process:,} records”)</blockquote><blockquote>start_ecs_task(profile,start_record,records_to_process)</blockquote><blockquote>process_dataset(1_000_000)</blockquote><p>If tomorrow the input becomes <strong>5 million records</strong>, the architecture doesn’t need to redefine the maximum pipeline data size.</p><blockquote>5,000,000 / 100,000 = 50 chunks</blockquote><p>The same orchestration logic can continue to operate.</p><h4>But ECS capacity isn’t the only limit</h4><p>This is where performance engineering becomes critical.</p><p>The orchestrator shouldn’t blindly launch all 50, 100, or 500 tasks simultaneously.</p><p>For example, testing might establish:</p><blockquote>Worker capacity = 100K records/task; Required chunks = 50; Safe parallel workers = 10</blockquote><h4>Where ECS Helps</h4><p>In our case, the pipeline processing runs using <strong>Amazon ECS clusters/tasks</strong>.</p><p>That makes this design particularly useful because additional tasks can be started as processing demand grows, subject to the cluster’s underlying compute capacity, ECS quotas, downstream-system capacity, and configured scaling policies.</p><p>Instead of permanently maintaining enough pipeline instances to support the worst imaginable future workload, processing capacity can be aligned more closely with actual demand.</p><p>Conceptually:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*AgqAdxeJ4Iwsx8iUeF5IEg.png" /></figure><h4>Performance Engineering Changes Too</h4><p>This architecture also changed how I thought about the performance test.</p><p>Originally, the question was:</p><blockquote><strong><em>Can the pipeline process 1 million records?</em></strong></blockquote><p>That’s still important.</p><p>But after introducing chunking and horizontal scaling, better questions emerge.</p><h4>What is the optimal chunk size?</h4><p>Don’t assume the largest possible chunk is the best one.</p><blockquote>Test something like: 25K, 50K, 100K, 150K, 250K</blockquote><blockquote>Then compare: Processing duration, CPU utilization, Memory utilization, Task failures/retries, Chunk scheduling overhead, Database pressure, Network throughput, End-to-end processing time</blockquote><h4>How many chunks can run concurrently?</h4><p>Splitting 10 million records into 100 chunks doesn’t mean all 100 chunks should execute simultaneously.</p><p>The pipeline might scale perfectly while overwhelming something downstream.</p><blockquote>For example: ECS → API → Database → connection limits, CPU saturation, lock/contention</blockquote><p>So performance testing needs to identify the <strong>safe concurrency level</strong>, not just the maximum number of ECS tasks.</p><h4>Does processing time scale linearly?</h4><blockquote><strong>Suppose the results look like:</strong> 100K → 5 min, 1M → 8 min, 5M → 14 min</blockquote><blockquote><strong>That tells a very different story from:</strong> 100K → 5 min, 1M → 50 min, 5M → 250 min</blockquote><p>A scalable architecture isn’t simply one that <em>eventually</em> processes the data.</p><p>It should maintain predictable behavior as volume grows.</p><h4>Scalability Doesn’t Mean Unlimited</h4><p>This is an important lesson.</p><p>Even with chunking and dynamically created ECS tasks, I wouldn’t call the architecture <strong>unlimited</strong>.</p><p>Every distributed system eventually has boundaries:</p><ul><li>ECS service quotas</li><li>EC2 or Fargate capacity</li><li>database connections</li><li>downstream API rate limits</li><li>queue throughput</li><li>memory and CPU</li><li>network bandwidth</li><li>storage I/O</li><li>retry storms</li><li>cost</li></ul><p>So the goal isn’t:</p><blockquote><strong><em>“The pipeline has no limit.”</em></strong></blockquote><p>A more accurate engineering statement is:</p><blockquote><strong><em>“The architecture removes the fixed data-volume dependency from individual pipeline workers and allows processing capacity to scale horizontally.”</em></strong></blockquote><p>That’s a much stronger design principle.</p><h4>There’s Another Dimension: Cost</h4><p>Horizontal scaling can solve a performance problem while creating a cost problem.</p><p>If: 1M records → 10 tasks; 10M records → 100 tasks; 100M records → 1,000 tasks</p><p>the system might technically scale, but should it?</p><p>Performance engineering for cloud-native systems should therefore measure:</p><p><strong>Performance + Scalability + Reliability + Cost</strong></p><p>not performance alone.</p><blockquote>A useful metric becomes: Cost per million records processed</blockquote><p>alongside traditional metrics such as:</p><p>Records/sec, Processing duration, CPU %, Memory %, Failure rate, Retry rate, Task count</p><h4>The Biggest Lesson for Me</h4><p>What impressed me about this solution wasn’t just that it allowed us to move from <strong>100K toward 1M+ records</strong>.</p><p>It was the shift in thinking.</p><p>Instead of asking:</p><blockquote><strong><em>“How do we make this pipeline big enough?”</em></strong></blockquote><p>the team effectively asked:</p><blockquote><strong><em>“How do we make the workload small enough for each worker?”</em></strong></blockquote><p>That subtle change completely alters the scalability model.</p><blockquote><strong>Vertical thinking:</strong> More Data → Bigger Pipeline → More Resources → Eventually another limit</blockquote><blockquote><strong>Horizontal thinking: </strong>More Data → More Chunks → More Processing Tasks → Parallel Processing</blockquote><p>The individual processing unit doesn’t necessarily have to become bigger.</p><p>The system becomes capable of creating <strong>more processing units when needed</strong>.</p><h4>What Performance Testing Actually Gave Us</h4><p>This experience was another reminder that performance testing is not simply about producing response-time charts or saying:</p><p>→Passed 100K<br> →Failed 150K</p><p>Finding the breaking point is only the beginning.</p><p>A good performance test should help answer:</p><blockquote><strong><em>Why did it break?</em></strong></blockquote><p>And an even better architecture should answer:</p><blockquote><strong><em>How do we avoid repeatedly reaching the same type of breaking point as the business grows?</em></strong></blockquote><p>In our case, a pipeline that struggled beyond roughly <strong>100K records</strong> exposed an architectural opportunity.</p><p>Instead of engineering specifically for <strong>1 million</strong>, the solution moved toward <strong>chunk-based, horizontally scalable processing on Amazon ECS</strong>.</p><p>And that is probably the biggest performance-engineering lesson from this exercise:</p><blockquote>Scalability isn’t always about making individual workers more powerful. Sometimes it’s about keeping each worker within its proven operating range and intelligently distributing the workload across more workers :)</blockquote><p><strong>Priya Kothandaraman</strong><br><em>Sharing insights from real-world debugging and system optimization journeys!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ed6aff1cbd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beyond Response Time: A Practical Guide to Performance Testing AI Services]]></title>
            <link>https://medium.com/@priyaraman.nov07/beyond-response-time-a-practical-guide-to-performance-testing-ai-services-09d4233930e3?source=rss-90baf3691e8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/09d4233930e3</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Priyaraman]]></dc:creator>
            <pubDate>Mon, 23 Nov 2026 11:31:02 GMT</pubDate>
            <atom:updated>2026-11-23T11:31:02.314Z</atom:updated>
            <content:encoded><![CDATA[<p>AI services are rapidly becoming part of modern applications. Chatbots, copilots, summarization APIs, RAG platforms, document intelligence, recommendation engines, and AI agents are increasingly sitting behind APIs just like traditional microservices.</p><p>But there is an important difference:</p><blockquote><strong><em>An AI API returning HTTP 200 does not necessarily mean the system is performing well.</em></strong></blockquote><p>For a traditional REST service, we might focus on:</p><ul><li>Requests per second</li><li>Average response time</li><li>P90/P95/P99 latency</li><li>CPU and memory</li><li>Database response time</li><li>Error percentage</li></ul><p>For an AI service, those metrics still matter, but they are only part of the story.</p><p>AI introduces another performance dimension:</p><p><strong>Tokens.</strong></p><p>A request containing 100 tokens and another containing 20,000 tokens may hit the same endpoint but create completely different workloads.</p><p>That means our performance model needs to evolve.</p><h3>What Does an AI Request Actually Look Like?</h3><p>Consider a simplified LLM API:</p><blockquote><strong>HTTP: </strong>POST /api/chat</blockquote><blockquote><strong>JSON: </strong>{“model”: “enterprise-llm”,“messages”: [{“role”: “user”,“content”: “Summarize the following inspection…”}],“max_tokens”: 1000}</blockquote><p>A traditional performance test might send 100 concurrent requests and calculate response time.</p><p>For AI testing, we should ask additional questions:</p><ul><li>How many input tokens are being submitted?</li><li>How many output tokens are generated?</li><li>When does the first token arrive?</li><li>How quickly are subsequent tokens generated?</li><li>What happens when prompts become large?</li><li>What happens when hundreds of users submit large prompts simultaneously?</li><li>Does the system queue requests?</li><li>Are requests throttled?</li><li>Does the application retry automatically?</li><li>Is the bottleneck in the model, RAG pipeline, vector database, network, or downstream API?</li></ul><p>That leads to a much richer performance model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*0vabjhMwrIVHMUjrh2f3XA.png" /><figcaption>AI — Performance Testing Scenarios</figcaption></figure><h3>Scenario 1: Baseline AI Service Performance</h3><p>Always start with a controlled baseline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C-AuPN-REIEGwxe1wAHVzw.png" /></figure><p>Capture:</p><ul><li>End-to-end latency</li><li>Time to First Token</li><li>Token-generation duration</li><li>Input tokens</li><li>Output tokens</li><li>Tokens per second</li><li>HTTP errors</li><li>Infrastructure utilization</li></ul><p>This establishes the best-case performance of the service before concurrency becomes a factor.</p><h3>Scenario 2: Concurrent User Testing</h3><p>Once the baseline is understood, gradually increase concurrency.</p><p>For example:</p><blockquote>1 user →10 users →25 users →50 users →100 users →250 users</blockquote><p>At every stage, observe whether latency grows linearly or suddenly increases.</p><p>Imagine this result:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FFO-aXkLrgzXZSHSZKfA-g.png" /></figure><p>The interesting question isn’t simply:</p><blockquote><em>“Can the service support 250 users?”</em></blockquote><p>It’s:</p><blockquote><strong><em>“Where does the AI platform stop scaling efficiently?”</em></strong></blockquote><p>The transition between 50 and 100 users may reveal GPU saturation, queue growth, rate limiting, or downstream resource exhaustion.</p><h3>Scenario 3: Token-Based Workload Testing</h3><p>This is one of the biggest differences between traditional API testing and AI performance testing.</p><p>Requests should be categorized by token size.</p><h4>Small prompt</h4><blockquote>Input: 100 tokens</blockquote><blockquote>Output: 200 tokens</blockquote><h4>Medium prompt</h4><blockquote>Input: 2,000 tokens</blockquote><blockquote>Output: 1,000 tokens</blockquote><h4>Large prompt</h4><blockquote>Input: 20,000 tokens</blockquote><blockquote>Output: 4,000 tokens</blockquote><h4>Extreme-context request</h4><blockquote>Input: 50K+ tokens</blockquote><blockquote>Output: several thousand tokens</blockquote><p>Then measure how latency, throughput, memory consumption, and failure rates change.</p><p>A useful business workload might be:</p><blockquote>*60% small prompts *25% medium prompts *10% large prompts *5% very large prompts</blockquote><p>This is far more realistic than repeating the same prompt thousands of times.</p><h3>Scenario 4: Time to First Token</h3><p>For streaming AI applications, normal response time can be misleading.</p><p>Suppose two responses both take 15 seconds to complete.</p><h4>Service A</h4><p>Request → 1.2 sec → First Token → Streaming… →15 sec complete</p><h4>Service B</h4><p>Request → 10 sec → First Token → Streaming… →15 sec complete</p><p>Technically, both completed in 15 seconds.</p><p>From the user’s perspective, Service A feels dramatically faster.</p><p>That’s why <strong>Time to First Token (TTFT)</strong> should be treated as a first-class performance metric for conversational AI.</p><h3>Scenario 5: Tokens per Second</h3><p>After the first token arrives, measure generation throughput.</p><p>A simple metric is:</p><blockquote>Tokens/sec = Generated output tokens/Generation duration</blockquote><p>Example: Output tokens = 600, Generation time = 20 sec</p><p>Then: 600 / 20 = 30 tokens/sec</p><p>Track this across different concurrency levels.</p><p>You may discover:</p><blockquote>10 users → 45 tokens/sec</blockquote><blockquote>50 users → 38 tokens/sec</blockquote><blockquote>100 users → 25 tokens/sec</blockquote><blockquote>200 users → 12 tokens/sec</blockquote><p>Even when requests remain successful, degraded token throughput can indicate capacity pressure.</p><h3>Scenario 6: Context-Window Stress Testing</h3><p>AI systems increasingly operate on large contexts.</p><p>For example, test progressively larger prompts:</p><blockquote>1K tokens; 5K tokens; 10K tokens; 25K tokens; 50K tokens; Maximum supported context</blockquote><p>Measure:</p><ul><li>TTFT</li><li>Total inference latency</li><li>Memory consumption</li><li>Tokens/sec</li><li>Failure rate</li><li>Timeout rate</li></ul><p>Then combine context size with concurrency.</p><p>For example: 100 users × 1K tokens</p><p>is very different from: 100 users × 50K tokens</p><p>The API request rate may be identical, but the computational workload certainly isn’t.</p><h3>Scenario 7: RAG Performance Testing</h3><p>Many enterprise AI applications don’t call an LLM directly.</p><p>They use Retrieval-Augmented Generation:</p><blockquote>User → API Gateway → Application → Embedding → Vector Search → Document Retrieval → Prompt Construction → LLM → Streaming Response</blockquote><p>If the response takes 8 seconds, saying:</p><blockquote><em>“AI response time is 8 seconds”</em></blockquote><p>doesn’t tell us enough.</p><p>Measure every important stage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*zORG_9ulRbrRdym2dO68Pw.png" /></figure><p>Now the bottleneck becomes visible.</p><p>RAG performance testing should therefore monitor both <strong>end-to-end latency and component-level latency</strong>.</p><h3>Scenario 8: Rate-Limit and Throttling Validation</h3><p>AI platforms usually enforce quotas or rate limits.</p><p>Performance testing should deliberately discover what happens near those limits.</p><blockquote><strong>Validate: </strong>Normal traffic → 80% quota → 100% quota → 120% quota → Burst traffic</blockquote><blockquote><strong>Monitor for: </strong>HTTP 429 , timeouts , queue growth , retry storms, connection failures</blockquote><p>The critical behavior isn’t merely whether throttling happens.</p><p>It’s whether the application handles it gracefully.</p><p>Poorly configured retry logic can turn a small throttling event into a much larger production incident.</p><h3>Scenario 9: Burst Testing</h3><p>AI workloads aren’t always steady.</p><p>Imagine an enterprise Copilot used by thousands of employees.</p><p>At 9:00 AM:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*ZyCbXfDDU_12-nUFeR6aQQ.png" /></figure><blockquote><strong>A burst scenario might simulate: </strong>50 users → 500 users within 30 seconds → Maintain for 5 minutes → Return to 50 users</blockquote><blockquote><strong>Observe:</strong> Queue depth, TTFT, P95/P99 latency, Token throughput, Autoscaling reaction, Errors, Recovery time</blockquote><p>Recovery matters just as much as peak performance.</p><h4>Scenario 10: AI Agent Performance Testing</h4><p>AI agents create another level of complexity.</p><blockquote><strong>A single user request might trigger: </strong>User Prompt → LLM → Tool Call → Database/API → LLM → Another Tool → LLM → Final Response</blockquote><p>One user action may therefore generate <strong>multiple model calls and downstream requests</strong>.</p><blockquote><strong>Performance tests should capture:</strong> Model calls per user request, Tool calls per request , Agent execution time, Tool/API latency, Retry count, Tokens consumed, Successful task-completion rate</blockquote><p>Otherwise, a test showing “100 requests/minute” could hide 500+ internal operations.</p><h3>Scenario 11: Long-Duration AI Soak Testing</h3><p>Run the service continuously for several hours.</p><blockquote><strong>For example:</strong> 100 concurrent users * 4 hours * Mixed prompt sizes * Streaming enabled * RAG enabled</blockquote><p>Look for gradual degradation:</p><blockquote>GPU memory growth, Application memory leaks, Connection-pool exhaustion, Queue accumulation, Cache growth, Increasing TTFT, Worker instability, Throughput reduction</blockquote><p>A system that survives a 15-minute test isn’t necessarily production-ready.</p><h3>Scenario 12: Failure and Recovery Testing</h3><p>High load testing shouldn’t only measure successful traffic.</p><blockquote><strong>Introduce realistic failures such as:</strong> LLM timeout, Vector database latency, Dependency failure, 429 throttling, 5xx responses, Network delay, Worker restart, Model endpoint unavailable</blockquote><p>Then observe whether the application retries safely or amplifies the problem.</p><blockquote>For example: 100 user requests → AI service slows → 100 retries → More congestion → 200 retries → Service collapse</blockquote><p>This is a classic <strong>retry storm</strong> and should be explicitly included in AI performance engineering.</p><h4>What Should an AI Performance Dashboard Show?</h4><p>I would divide the dashboard into four layers.</p><p><strong>User experience: </strong>P50/P90/P95/P99 latency, TTFT, Total response time, Error percentage</p><p><strong>AI workload: </strong>Input tokens/sec, Output tokens/sec, Tokens/request, Tokens/sec, Concurrent generations</p><p><strong>Service/Platform:</strong> CPU, Memory, GPU utilization, GPU memory, Queue depth, Active workers, Dependencies</p><p><strong>Vector-search latency: </strong>Database latency, Tool-call latency, External API latency, Cache performance, 429/5xx responses</p><h3>Traditional API Testing vs AI Performance Testing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t50lf2kHeL_aEOIDtSG5RA.png" /></figure><h4>A Practical AI Performance Test Matrix</h4><p>A strong test plan could look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ezmPyxkjanFhrAJu9cXJUQ.png" /></figure><p>Numbers should ultimately come from production traffic and capacity expectations rather than being treated as universal targets.</p><h4>The Most Important Change: Stop Thinking Only in TPS</h4><p>This may be the biggest mindset shift for performance engineers.</p><blockquote>Two AI systems processing: 100 requests/minute</blockquote><p>could have radically different workloads.</p><blockquote><strong>Workload A:</strong> 100 × 200 tokens = 20,000 tokens/min</blockquote><blockquote><strong>Workload B:</strong> 100 × 10,000 tokens = 1,000,000 tokens/min</blockquote><p>Same RPM.</p><p><strong>50× difference in token volume.</strong></p><p>That’s why AI workload modeling should increasingly combine:</p><blockquote>Requests + Concurrency + Tokens + Context Size + Generation Rate + Dependency Calls</blockquote><h4>Final Thoughts</h4><p>Performance engineering for AI doesn’t replace traditional performance testing. It extends it.</p><p>CPU, memory, response time, throughput, scalability, and errors still matter.</p><p>But the next generation of performance engineers also needs to understand:</p><p><strong>TTFT. Token throughput. Context windows. Streaming. RAG latency. GPU saturation. Rate limits. Agent tool calls. Retry behavior.</strong></p><p>Because when an AI system becomes slow, the problem may not be the API.</p><p>It could be the <strong>prompt, retrieval layer, model, token generation, GPU, queue, tool chain, or architecture behind it</strong>.</p><p>And finding exactly where that time is being spent is where performance engineering becomes valuable |😎 |—| 🤖|.</p><p><strong>Priya Kothandaraman</strong><br><em>Sharing insights from real-world debugging and system optimization journeys!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09d4233930e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Federated GraphQL: Microservices Broke the Data Apart.]]></title>
            <link>https://medium.com/@priyaraman.nov07/federated-graphql-microservices-broke-the-data-apart-f53510669f11?source=rss-90baf3691e8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f53510669f11</guid>
            <category><![CDATA[api-design]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[performance-engineering]]></category>
            <dc:creator><![CDATA[Priyaraman]]></dc:creator>
            <pubDate>Mon, 16 Nov 2026 11:31:02 GMT</pubDate>
            <atom:updated>2026-11-16T11:31:02.551Z</atom:updated>
            <content:encoded><![CDATA[<h3>Federated GraphQL: Microservices Broke the Data Apart. GraphQL Federation Connects It Again [Performance perspective]</h3><p>Microservices are great at one thing: <strong>separating responsibilities</strong>.</p><p>**The User Service owns users.<br>**The Order Service owns orders.<br>**The Product Service owns products.<br>**The Notification Service owns notifications.</p><p>Clean architecture. Independent deployments. Separate scaling.</p><p>Then a simple business requirement arrives:</p><blockquote><em>“Show the customer profile, recent orders, product details, shipment status, and notifications on one screen.”</em></blockquote><p>Suddenly, the frontend needs to talk to five services.</p><p>And this is where the microservice dream can quietly become a <strong>data orchestration problem</strong>.</p><p>That is exactly where <strong>Federated GraphQL</strong> becomes interesting.</p><h4>The Problem Isn’t Always Microservices. It’s Data Fragmentation.</h4><p>Imagine an e-commerce application built with these services:</p><blockquote>User Service , Order Service, Product Service, Inventory Service, Shipment Service</blockquote><p>Each service has a clean API.</p><p>But the UI needs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*Z4kk_nN2DgW5QOzl7zxYQA.png" /></figure><p>With traditional REST orchestration, the application might execute:</p><blockquote>GET /users/1001</blockquote><blockquote>GET /users/1001/orders</blockquote><blockquote>GET /products/P100</blockquote><blockquote>GET /products/P200</blockquote><blockquote>GET /inventory/P100</blockquote><blockquote>GET /shipment/ORD001</blockquote><p>One screen can easily turn into <strong>multiple network calls</strong>.</p><p>If some of those calls happen sequentially, latency starts stacking up.</p><blockquote>User API [80 ms] → Order API [120 ms] → Product API [ 90 ms] → Shipment API [110 ms]</blockquote><blockquote>Potential dependency path ≈ 400 ms</blockquote><p>Of course, real systems can parallelize requests. But as the number of services and relationships grows, orchestration becomes increasingly complicated.</p><p>The problem has shifted.</p><p>We reduced application coupling with microservices, but introduced <strong>data-fetching complexity</strong>.</p><h4>Enter Federated GraphQL</h4><p>GraphQL Federation provides a different model.</p><p>Instead of exposing every microservice independently to consumers, each domain can expose its part of a larger graph.</p><p>Conceptually:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*ScqKsoJTgslCmS2lknH4dw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vdN_u-rkYOZSDvDS04reBQ.png" /></figure><p>From the client’s perspective, there is <strong>one graph</strong>.</p><p>The consumer asks for the data it needs:</p><blockquote>query { customer(id: “1001”) { name email orders { id status product { name price} shipment {status}}}}</blockquote><p>The client doesn’t need to understand which microservice owns each field.</p><p>That responsibility moves into the graph architecture.</p><p>And that changes the performance conversation.</p><h4>Federation Doesn’t Make Slow Services Fast</h4><p>This is one of the most important lessons.</p><p>Adding GraphQL doesn’t magically turn a 500 ms API into a 50 ms API.</p><p>If the Product Service has an inefficient database query, federation will not fix it.</p><p>If the Order Service is CPU-saturated, federation will not fix it.</p><p>If a downstream service has poor caching, federation will not fix it.</p><p>Federation improves another dimension:</p><p><strong>how efficiently distributed data is discovered, requested, composed, and returned.</strong></p><p>That distinction matters.</p><h4>Performance Benefit #1: Fewer Client-Side Round Trips</h4><p>Without an orchestration layer:</p><blockquote>Browser → User Service</blockquote><blockquote>Browser → Order Service</blockquote><blockquote>Browser → Product Service</blockquote><blockquote>Browser → Inventory Service</blockquote><blockquote>Browser → Shipment Service</blockquote><p>With federation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*c9sY3t5tKjHCLLcvAOKjHg.png" /></figure><p>There may still be multiple calls internally.</p><p>But you’re reducing <strong>client-facing network chatter</strong> and centralizing orchestration.</p><p>This becomes particularly useful for mobile applications or geographically distributed clients where another network round trip isn’t free.</p><h4>Performance Benefit #2: Parallel Execution</h4><p>Imagine this relationship:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/226/1*-r184GoT-PCtym5wm8CpvQ.png" /></figure><p>After obtaining the order information, Product and Shipment data may not depend on each other.</p><p>A good execution layer can execute those operations concurrently.</p><p>Instead of thinking: Order → Product → Shipment</p><p>we want something closer to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*Bzp7pH7WCpbKTMaRyc5ZDQ.png" /></figure><p>That’s a major performance-engineering principle:</p><blockquote><strong><em>Don’t serialize work that can safely execute in parallel.</em></strong></blockquote><p>Federation can make these dependency relationships explicit and allow the routing layer to build an efficient query plan.</p><h4>Performance Benefit #3: Stop Returning Data Nobody Uses</h4><p>REST APIs often return fixed structures.</p><p>For example:</p><blockquote>{ “id”: “1001”, “name”: “Priya”, “email”: “…”, “address”: {}, “preferences”: {}, “history”: [], “metadata”: {}, “settings”: {}, “permissions”: [] }</blockquote><p>But the screen might only need:</p><blockquote>customer(id: “1001”) {name email}</blockquote><p>That means smaller payloads.</p><p>Smaller payloads can mean:</p><ul><li>less serialization work</li><li>less network transfer</li><li>less client-side parsing</li><li>lower memory consumption</li><li>better performance for constrained clients</li></ul><p>This becomes increasingly meaningful when nested REST responses become large.</p><h4>Performance Benefit #4: Data Ownership Remains With the Domain</h4><p>One misconception about GraphQL is that everything needs to move into one enormous service.</p><p>Federation is interesting because it tries to avoid exactly that.</p><p>For example: Graphql</p><p>Customer Subgraph</p><blockquote>type Customer @key(fields: “id”) { id: ID! name: String! email: String! }</blockquote><p>Order Subgraph</p><blockquote>extend type Customer @key(fields: “id”) { id: ID! @external orders: [Order]}</blockquote><p>Product Subgraph</p><blockquote>type Product @key(fields: “id”) { id: ID! name: String! price: Float! }</blockquote><p>Each team can continue owning its domain while participating in the larger graph.</p><p>So rather than creating another giant orchestration microservice containing business logic from everywhere, we create a common <strong>data graph</strong>.</p><h4>But There Is a Performance Trap</h4><p>Federation can also make a system slower. Yes, slower.</p><p>Consider:</p><blockquote>Graphql</blockquote><blockquote>query { orders { product { name}}}</blockquote><p>Suppose there are 500 orders.</p><p>An inexperienced implementation could effectively create:</p><blockquote>1 request for orders + 500 product lookups</blockquote><p>Congratulations! We just created the GraphQL version of the <strong>N+1 problem</strong>.</p><p>That’s why federation architecture and performance engineering have to evolve together.</p><p>Techniques such as batching, request-scoped caching, DataLoader-style patterns, and bulk downstream APIs become extremely important.</p><p>Instead of:</p><blockquote>GET product/1 GET product/2 GET product/3 …</blockquote><p>prefer something like:</p><blockquote>GET products?id=1,2,3,…</blockquote><p>when the downstream service supports it.</p><h4>Another Trap: An Innocent Query Can Be Expensive</h4><p>This query looks harmless:</p><blockquote>customer { orders { product { reviews { author { orders { product {…}}}}}}}</blockquote><p>The client sent <strong>one request</strong>.</p><p>But one request does not mean one unit of backend work.</p><p>That request might create hundreds or thousands of resolver operations.</p><p>This leads to one of my favorite GraphQL performance lessons:</p><blockquote><strong><em>Request rate alone becomes a poor representation of system load.</em></strong></blockquote><p>In REST performance testing, we often talk about: Requests/sec; TPS; RPM</p><p>For GraphQL, another dimension becomes essential:</p><blockquote><strong>Query complexity, Query depth, Resolver count, Subgraph calls, Entities fetched, Response size, Execution time</strong></blockquote><p>Two GraphQL requests can have completely different costs.</p><h4>Performance Testing Federated GraphQL Requires a Different Mindset</h4><p>This is where things get especially interesting for performance engineers.</p><p>Don’t build a workload with only:</p><blockquote><em>500 GraphQL requests/minute.</em></blockquote><p>Instead, classify operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GABZh0dVlp2rbHCwHzDs3w.png" /></figure><p>Then generate a realistic workload mix.</p><p>For example:</p><blockquote>45% Simple queries</blockquote><blockquote>30% Medium queries</blockquote><blockquote>20% Complex federated queries</blockquote><blockquote>5% Very expensive queries</blockquote><p>Now you’re testing <strong>business behavior</strong>, not simply endpoint throughput.</p><h4>Measure the Router AND the Subgraphs</h4><p>Suppose your GraphQL request takes:</p><blockquote>P95 = 1.2 seconds</blockquote><p>That’s useful, but not enough.</p><p>You need to know the critical path.</p><blockquote>GraphQL Request: 1200 ms; Router overhead 35 ms</blockquote><blockquote>Customer subgraph 90 ms; Order subgraph 310 ms; Product subgraph 740 ms; Shipment subgraph 180 ms</blockquote><p>Immediately our investigation changes.</p><p>The GraphQL endpoint isn’t necessarily the bottleneck.</p><p>The federation layer may simply be exposing a problem inside the Product domain.</p><p>That is why distributed tracing becomes extremely valuable.</p><p>A federated GraphQL environment should ideally let you follow:</p><blockquote>Client Request → GraphQL Router → Query Plan → Subgraph → Service → Database / Cache</blockquote><p>Without that visibility, troubleshooting federation can become painful very quickly.</p><h4>Caching Also Changes</h4><p>Caching a REST endpoint can be relatively straightforward:</p><blockquote>/products/123</blockquote><p>GraphQL queries are more dynamic.</p><p>Two clients might request:</p><blockquote>product {name}</blockquote><p>and</p><blockquote>product { name price inventory }</blockquote><p>Same entity. Different query shape.</p><p>So caching strategies need to be considered carefully.</p><p>Depending on the architecture, that may include:</p><ul><li>entity-level caching</li><li>resolver caching</li><li>DataLoader/request-level caching</li><li>downstream service caching</li><li>persisted operations</li><li>CDN or response caching where applicable</li><li>databases and Redis remaining the proper cache boundary for certain workloads</li></ul><p>The goal shouldn’t be:</p><blockquote>“Let’s cache GraphQL.”</blockquote><p>The better question is:</p><blockquote>Where in this data path does caching remove the most expensive repeated work without creating unacceptable stale-data risk?</blockquote><h4>What Federation Really Solves</h4><p>I don’t think the biggest benefit of Federation is simply:</p><p><strong>“One API instead of many APIs.”</strong></p><p>That’s too simplistic.</p><p>Its bigger value is creating a consistent data model over independently owned domains.</p><p>Microservices organize <strong>business capabilities</strong>.</p><p>Federated GraphQL organizes <strong>how those capabilities appear as connected data</strong>.</p><p>That distinction becomes incredibly valuable as architecture grows.</p><h4>When Federation Makes Sense</h4><p>Federation becomes compelling when:</p><p>→ Many clients need overlapping data from several microservices.</p><p>→ Frontends contain significant orchestration logic.</p><p>→ Multiple teams independently own different business domains.</p><p>→ REST aggregation services are multiplying.</p><p>→ Backend-for-frontend layers are becoming difficult to maintain.</p><p>→ Business entities naturally cross service boundaries.</p><p>→ Your organization has enough observability to understand distributed execution.</p><p>But don’t adopt it simply because GraphQL is fashionable.</p><p>For a system with three services and straightforward access patterns, federation could introduce more complexity than it removes.</p><h4>Final Thought</h4><p>We spent years breaking monoliths into microservices.</p><p>Then we discovered something interesting.</p><p>The business still thinks in connected entities.</p><p>→ A customer has orders.<br> → An order contains products.<br> → A product has inventory.<br> → An order has a shipment.</p><p>Microservices separated those responsibilities.</p><p>But consumers still need the complete story.</p><p><strong>Federated GraphQL doesn’t remove microservices. It gives their distributed data a common language.</strong></p><p>And from a performance engineering perspective, that’s where things become fascinating.</p><p>Because optimizing such systems is no longer only about asking:</p><blockquote><strong><em>“How many requests per second can this API handle?”</em></strong></blockquote><p>The better questions become:</p><blockquote><strong><em>“How much backend work does this query create?”</em></strong></blockquote><blockquote><strong><em>“Which subgraph controls the critical path?”</em></strong></blockquote><blockquote><strong><em>“Which work is sequential, and which can run in parallel?”</em></strong></blockquote><blockquote><strong><em>“Are we reducing data complexity, or simply hiding it behind one endpoint?”</em></strong></blockquote><p>Federation can absolutely improve the experience and performance of a microservice architecture.</p><p>But only when we remember one principle:</p><blockquote>One GraphQL request may look simple from the outside. Performance engineering is about understanding everything that happens underneath it.</blockquote><p><strong>Priya Kothandaraman</strong><br><em>Sharing insights from real-world debugging and system optimization journeys!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f53510669f11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Troubleshooting High CPU in ECS Fargate: Beyond Infrastructure Scaling]]></title>
            <link>https://medium.com/@priyaraman.nov07/troubleshooting-high-cpu-in-ecs-fargate-beyond-infrastructure-scaling-1fa97944d154?source=rss-90baf3691e8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1fa97944d154</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Priyaraman]]></dc:creator>
            <pubDate>Mon, 09 Nov 2026 11:31:01 GMT</pubDate>
            <atom:updated>2026-11-09T11:31:01.561Z</atom:updated>
            <content:encoded><![CDATA[<p>A performance troubleshooting story about ECS Fargate, batch processing, and massive database exports</p><p>For the last couple of weeks, I’ve been troubleshooting a persistent performance issue:</p><blockquote><strong><em>Consistently high CPU utilization in an ECS Fargate service.</em></strong></blockquote><p>At first, the obvious questions were around infrastructure.</p><ul><li>Do we need more CPU?</li><li>Should we increase the number of Fargate tasks?</li><li>Is autoscaling too slow?</li><li>Is the database the bottleneck?</li></ul><p>But as we investigated deeper, something became clear.</p><p><strong>The CPU was only showing us the symptom.</strong></p><p>The real problem was <strong>how much work the application was trying to do at once.</strong></p><h4>What Was Actually Happening?</h4><p>One of the major contributors was a batch-processing workflow that exported a large volume of data from the database.</p><p>The flow was roughly:</p><blockquote>API Request → Query Database → Fetch Large Dataset → Process Records → Transform Data → Generate Export</blockquote><p>It is easy to think:</p><blockquote><em>“It’s just exporting data from the database.”</em></blockquote><p>But from a performance perspective, it is doing much more.</p><p>Once the database returns the records, the application may still need to:</p><ul><li>Load them into memory</li><li>Deserialize the response</li><li>Loop through thousands of records</li><li>Apply business logic</li><li>Transform objects</li><li>Serialize the output</li><li>Generate the export file</li></ul><p>And all of this consumes <strong>CPU and memory inside the Fargate task</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*u5_j8HgSRKxItNuJPqmN1A.png" /><figcaption>Don’t just scale the container. Understand the workload, optimize the flow, and scale the design.</figcaption></figure><h4>Large Batches Change Everything</h4><p>Imagine processing: 10,000 records, 50,000 records, 100,000+ records</p><p>Now add multiple requests doing the same thing concurrently.</p><p>For example: 5 requests × 100,000 records = 500,000 records to process</p><p>Suddenly, high CPU doesn’t look surprising.</p><p>The issue becomes even more interesting when the application processes large batches continuously.</p><blockquote>Large DB Result + Large Batch + Data Transformation + Concurrent Requests = Sustained CPU Usage</blockquote><p>This was the important shift in the investigation.</p><p>Instead of asking:</p><blockquote><strong><em>“Why is Fargate CPU high?”</em></strong></blockquote><p>we started asking:</p><blockquote><strong><em>“What is the application doing that requires so much CPU?”</em></strong></blockquote><p>That is a much better performance-engineering question.</p><h4>Why Scaling Alone May Not Solve It</h4><p>Increasing ECS Fargate CPU can absolutely provide more processing capacity.</p><p>But consider this: 2 vCPU → 4 vCPU → 8 vCPU</p><p>If the application continues retrieving increasingly large datasets and processing them in large batches, the additional capacity may simply allow it to do more inefficient work.</p><p>You may see temporary improvement.</p><p>But eventually: More Data → More Processing → More CPU → Same Problem Again</p><p>Infrastructure scaling improves <strong>capacity</strong>.</p><p>Application optimization reduces <strong>demand</strong>.</p><p>Good performance engineering usually considers both.</p><h4>A Better Processing Pattern</h4><p>Instead of:</p><blockquote>DB → Fetch Everything → Process Everything → Export</blockquote><p>consider controlled, chunk-based processing:</p><blockquote>DB → Fetch Chunk → Process → Stream / Write → Fetch Next Chunk</blockquote><p>For example, instead of loading 500,000 records in one operation: 500,000 records</p><p>the application could process smaller chunks: 1,000 →Process →1,000 →Process</p><p>The exact batch size should come from performance testing rather than a fixed rule.</p><p>Test different sizes such as: 500 1,000 2,500 5,000 10,000</p><p>Then measure:</p><ul><li>ECS CPU</li><li>Memory utilization</li><li>Database latency</li><li>Garbage collection</li><li>Export duration</li><li>Throughput</li></ul><p>The goal isn’t simply to reduce CPU.</p><p>The goal is to find the <strong>best balance between throughput and resource consumption</strong>.</p><h4>Should Large Exports Even Be Synchronous?</h4><p>This investigation also raises a bigger architectural question.</p><p>Should a user request really wait while an API processes hundreds of thousands of records?</p><p>Instead of:</p><blockquote>User → API → DB → Process Everything → Export</blockquote><p>a scalable design could be:</p><blockquote>User →API →Export Job → Queue → Worker → Chunked DB Processing → Object Storage → Download</blockquote><p>Now the API is responsible for accepting and coordinating the request, while dedicated workers handle heavy processing.</p><p>This also gives much better control over:</p><ul><li>Concurrency</li><li>Retries</li><li>Batch sizes</li><li>Back-pressure</li><li>Worker scaling</li><li>Failure recovery</li></ul><h4>My Biggest Takeaway</h4><p>After spending the last couple of weeks investigating this issue, one lesson stood out:</p><blockquote><strong><em>High CPU is an observation. It is not necessarily the root cause.</em></strong></blockquote><p>A dashboard showing: CPU = 80%, 90%, 100%</p><p>tells us <strong>where the pressure is visible</strong>.</p><p>It doesn’t automatically tell us <strong>why the pressure exists</strong>.</p><p>Sometimes the answer isn’t:</p><blockquote><strong><em>“Give the container more CPU.”</em></strong></blockquote><p>The better question is:</p><blockquote><strong><em>“Why does this operation need so much CPU in the first place?”</em></strong></blockquote><p>Maybe it is batch size.</p><p>Maybe it is excessive database retrieval.</p><p>Maybe it is object transformation.</p><p>Maybe it is serialization.</p><p>Maybe it is concurrency.</p><p>Or maybe the workload simply belongs in an asynchronous processing architecture.</p><h4>Final Thought</h4><p>Performance engineering isn’t about seeing a CPU graph and immediately saying:</p><p><strong>“Scale it.”</strong></p><p>It is about asking:</p><p><strong>“What workload created that graph?”</strong></p><p>Because sometimes the real optimization isn’t hidden inside ECS Fargate or the database.</p><p>It is hidden inside <strong>how the application chooses to process the data.</strong></p><blockquote><strong>Don’t just scale the container. Scale the design.</strong></blockquote><p><strong>Priya Kothandaraman</strong><br><em>Sharing insights from real-world debugging and system optimization journeys!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1fa97944d154" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Scaling Your Database: Your Order Schema Might Be the Real Performance Bottleneck]]></title>
            <link>https://medium.com/@priyaraman.nov07/stop-scaling-your-database-your-order-schema-might-be-the-real-performance-bottleneck-cd50dc67ac10?source=rss-90baf3691e8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd50dc67ac10</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[performance-engineering]]></category>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Priyaraman]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 11:31:01 GMT</pubDate>
            <atom:updated>2026-11-02T11:31:01.816Z</atom:updated>
            <content:encoded><![CDATA[<p>How smarter schema design can improve Payment &amp; Order API performance before you add more infrastructure</p><p>Imagine a high-traffic e-commerce platform.</p><p>Every second, customers are:</p><ul><li>creating orders</li><li>making payments</li><li>checking payment status</li><li>viewing order history</li><li>cancelling orders</li><li>requesting refunds</li><li>tracking order status</li></ul><p>During normal traffic, everything looks healthy.</p><p>Then a major sale starts.</p><p>API traffic increases, database CPU climbs, queries slow down, connection pools become busy, and suddenly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*n_RrvmL0mrjNTvlrthT8LA.png" /></figure><p>The first suggestion is usually predictable:</p><blockquote><em>“Let’s scale the database.”</em></blockquote><p>Maybe we move from 8 vCPUs to 16, Then 16 to 32.</p><p>Add more application instances, Increase the connection pool.</p><p>That may provide additional capacity, But there is a more important question:</p><blockquote><strong><em>Why is every Order API request so expensive in the first place?</em></strong></blockquote><p>Sometimes the answer isn’t infrastructure.</p><p><strong>It’s the schema.</strong></p><h4>Let’s Build a Payment &amp; Order Service</h4><p>Consider a simplified architecture:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*bHoD_VqUcwVAV6GktqOCqw.png" /></figure><p>Our business entities might include:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*6mkSFntkNq4pBu9-aLBP1A.png" /></figure><p>Now imagine millions of orders and payment transactions accumulating over time.</p><p>The schema that looked perfectly fine with 50,000 records may behave very differently with tens of millions.</p><p>That is where performance engineering becomes important.</p><h4>The First Schema: Correct, but Is It Fast?</h4><p>We might start with normalized tables:</p><blockquote><strong>CUSTOMERS </strong>— —customer_id, name, email</blockquote><blockquote><strong>ORDERS</strong>— — order_id,customer_id,order_status,total_amount,created_at</blockquote><blockquote><strong>ORDER_ITEMS </strong>— —order_item_id,order_id,product_id,quantity,price</blockquote><blockquote><strong>PAYMENTS </strong>— — payment_id,order_id,payment_status,payment_method,amount,created_at</blockquote><blockquote><strong>PAYMENT_TRANSACTIONS </strong>— — transaction_id,payment_id,transaction_type,transaction_status,created_at</blockquote><p>From a database-design perspective, this is clean.</p><p>But now consider: GET /orders/ORD-12345</p><p>The response needs:</p><ul><li>order information</li><li>customer information</li><li>order items</li><li>payment status</li><li>latest payment transaction</li></ul><p>The request may require several tables to be accessed.</p><blockquote>Something conceptually like:</blockquote><blockquote>SELECT …FROM orders o JOIN customers c ON o.customer_id = c.customer_id JOIN order_items oi ON o.order_id = oi.order_id LEFT JOIN payments p ON o.order_id = p.order_id LEFT JOIN payment_transactions pt ON p.payment_id = pt.payment_id WHERE o.order_id = ?;</blockquote><p>One request might be fine.</p><p>But performance engineering isn’t concerned with one request.</p><p>What happens when thousands of customers request their orders concurrently?</p><blockquote>More Requests →More Queries →More Joins / Reads →Higher DB CPU &amp; I/O →Longer Query Execution →Higher API Latency</blockquote><p>Now we have a scalability problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*VvBeiPO1aMh4mT4JMl8CMg.png" /><figcaption>Better Schema → Less DB Work → Faster APIs → Smarter Scaling.</figcaption></figure><h4>Optimization 1: Design for the Access Pattern</h4><p>One of the most important schema-performance lessons I’ve learned is:</p><blockquote><strong><em>Don’t design the database only around entities. Design it around how the application accesses those entities.</em></strong></blockquote><p>Suppose our most frequently executed APIs are:</p><blockquote>HTTP</blockquote><blockquote>GET /orders/{orderId}</blockquote><blockquote>GET /customers/{customerId}/orders</blockquote><blockquote>GET /orders/{orderId}/payment-status</blockquote><p>Now we have meaningful information for schema design.</p><p>For example, order_id is obviously critical.</p><p>But customer order-history queries may frequently use:</p><blockquote>SQL → WHERE customer_id = ? ORDER BY created_at DESC</blockquote><p>That access pattern should influence indexing.</p><p>For example, a candidate index to evaluate could be:</p><blockquote>SQL (customer_id, created_at)</blockquote><p>Payment lookup may repeatedly use:</p><blockquote>WHERE order_id = ?</blockquote><p>So order_id deserves similar attention in the Payment table.</p><p>The important point isn’t to blindly create these indexes.</p><p>It is:</p><blockquote><em>Observe query patterns → design index → inspect execution plan → load test → measure.</em></blockquote><h4>Optimization 2: Don’t Use One Giant Order Query for Everything</h4><p>Consider an Order Detail API.</p><p>The database contains:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*nF_VblMzG_cpwRTJT1FiOQ.png" /></figure><p>Do we need all of that just to display:</p><blockquote>Order #12345</blockquote><blockquote>Status: Shipped</blockquote><blockquote>Amount: $199</blockquote><blockquote>Payment: Successful</blockquote><p>Probably not.</p><p>Instead of loading the complete object graph for every API request, separate the read paths.</p><p>For example:</p><blockquote>GET /orders/{id}/summary</blockquote><blockquote>GET /orders/{id}/items</blockquote><blockquote>GET /orders/{id}/payment</blockquote><blockquote>GET /orders/{id}/transactions</blockquote><p>Now a lightweight summary operation doesn’t need to retrieve an entire payment transaction history.</p><p>This reduces work across:</p><blockquote>Database →Application → JSON Serialization → Network → Client</blockquote><h4>Optimization 3: Introduce a Read-Optimized Order Schema</h4><p>For a read-heavy API, it can make sense to introduce an <strong>Order Summary read model</strong>. For example:</p><blockquote>ORDER_SUMMARY: order_id, customer_id, order_status, total_amount, payment_status, item_count, created_at, updated_at</blockquote><p>Now instead of reconstructing the most commonly requested information repeatedly, the API has a representation designed specifically for reading.</p><p>Architecture becomes:</p><blockquote>Write → Transaction Schema → Update/Event Flow → Order Summary Model →Read APIs</blockquote><p>This is essentially the idea behind separating read and write models, sometimes taken further with patterns such as <strong>CQRS</strong>.</p><p>That doesn’t mean every Order Service needs CQRS.</p><p>Complexity has a cost.</p><p>But when read traffic dramatically outweighs writes, a dedicated read model can be worth evaluating.</p><h4>Optimization 4: Separate Order and Payment Concerns</h4><p>Payment history behaves differently from order data.</p><p>An order may be relatively stable after fulfillment.</p><p>Payment activity, however, can contain:</p><blockquote>Authorization — Capture — Failure — Retry — Refund — Partial Refund — Reversal</blockquote><p>Trying to treat all of this as one giant Order entity can create unnecessary coupling.</p><p>A cleaner service-level model could be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*cvJRcSeJrQzPKd2v1EESig.png" /></figure><blockquote><strong>Order Service owns:</strong> Order, Order Items, Order Status</blockquote><blockquote><strong>Payment Service owns:</strong> Payment, Payment Attempts, Transactions,Refunds</blockquote><p>The Order Service may only need the current payment state for common operations.</p><p>It doesn’t necessarily need to retrieve the complete payment history every time somebody checks an order.</p><h4>Optimization 5: Use the Right Indexing Strategy</h4><p>Let’s say this query executes extremely frequently:</p><blockquote>SELECT order_id, order_status, total_amount, created_at FROM orders WHERE customer_id = ? ORDER BY created_at DESC;</blockquote><p>A relevant composite index candidate might be:</p><blockquote>(customer_id, created_at)</blockquote><p>Now imagine another API:</p><blockquote>GET /orders?status=PENDING</blockquote><p>Its database access pattern is different.</p><p>That’s why I don’t recommend:</p><blockquote><em>“Add indexes to all frequently used columns.”</em></blockquote><p>Instead:</p><blockquote><strong><em>Build indexes around proven query patterns.</em></strong></blockquote><p>Then verify them using the database’s query/execution-plan tooling.</p><p>Because indexes also have a cost.</p><p>Every additional index can affect:</p><blockquote>INSERT * UPDATE * DELETE * Storage * Index maintenance</blockquote><p>This is especially important for Payment and Order systems where write throughput can be significant.</p><h4>Optimization 6: Keep Payment Transactions Append-Oriented</h4><p>Payment transaction history has a useful characteristic.</p><p>Historical events such as:</p><blockquote>Payment Initiated → Payment Authorized → Payment Captured → Payment Failed → Refund Created</blockquote><p>are naturally suited to recording individual transaction/event records rather than repeatedly turning one huge Payment row into an ever-growing object.</p><p>A simplified model might look like:</p><blockquote>PAYMENT — — payment_id, order_id, current_status, amount, updated_at</blockquote><blockquote>PAYMENT_TRANSACTION — — transaction_id, payment_id, type, status, amount, created_at</blockquote><p>The current state remains easy to retrieve while detailed history stays separately accessible.</p><h4>Optimization 7: Cache Hot Order Data</h4><p>Now imagine an order has been shipped.</p><p>A customer opens the mobile app several times and repeatedly checks:</p><blockquote>HTTP GET /orders/ORD-12345</blockquote><p>Does every request need to hit the primary transactional database?</p><p>Not necessarily.</p><p>For suitable data, an architecture could use <strong>Redis</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*oDkVI78XI4ejsmmIoQ4r3w.png" /></figure><p>Suitable candidates might include:</p><ul><li>order summaries</li><li>product/reference information used in order views</li><li>relatively stable completed-order information</li></ul><p>But be careful with payment state.</p><p>Payment status may require stronger freshness guarantees.</p><p>Cache policy should therefore be based on the business consistency requirement, not just performance.</p><h4>Optimization 8: Keep API Payloads Small</h4><p>Suppose:</p><blockquote>HTTP GET /orders/{id}</blockquote><p>returns:</p><blockquote>{“order”: {}, “customer”: {}, “items”: [], “payment”: {}, “transactions”: [], “refunds”: [], “auditHistory”: [] }</blockquote><p>That’s convenient.</p><p>But convenience can become expensive at scale.</p><p>For an order-list page, maybe we need only:</p><blockquote>{“orderId”: “ORD-12345”,“status”: “SHIPPED”,“amount”: 199,“paymentStatus”: “PAID”}</blockquote><p>Smaller representations can reduce:</p><ul><li>query work</li><li>application memory allocation</li><li>serialization overhead</li><li>network transfer</li><li>client parsing</li></ul><p>Database schema and API contract design should therefore be considered together.</p><h4>Recommended Schema for a High-Performance Order &amp; Payment Platform</h4><p>I wouldn’t recommend one magical schema.</p><p>I would recommend <strong>different schemas for different jobs</strong>.</p><ol><li><strong>Transactional Order Schema: </strong>Keep this model reasonably normalized and focused on transactional integrity.</li></ol><blockquote>ORDERS, ORDER_ITEMS, CUSTOMERS</blockquote><p><strong>2. Transactional Payment Schema:</strong> Keep payment lifecycle/history separate from the Order entity.</p><blockquote>PAYMENTS, PAYMENT_TRANSACTIONS, REFUNDS</blockquote><p><strong>3. Read-Optimized Schema: </strong>Create it only when measurements show that the read workload benefits from it.</p><blockquote><strong>ORDER_SUMMARY:</strong> order_id, customer_id, order_status, payment_status, total_amount, item_count, created_at, updated_at</blockquote><p><strong>4. Cache: </strong>Use appropriate TTL and invalidation strategies based on freshness requirements.</p><blockquote>Redis → Order Summary → Frequently requested stable data</blockquote><p>5. <strong>Historical / Analytical Data: </strong>Don’t force operational APIs to perform heavy analytics against the same query paths used for checkout and payment.</p><p>Separate operational transactions from historical analytics when the workload justifies it.</p><h4>Now Let’s Look at Infrastructure</h4><p>This is where performance testing becomes critical.</p><p>Assume our database CPU is high during peak Order traffic.</p><blockquote><strong>Option A: </strong>DB CPU High → Increase DB Size →Problem Temporarily Reduced</blockquote><blockquote><strong>Option B:</strong> DB CPU High → Find Top Queries → Analyze Execution Plans → Optimize Schema → Optimize Indexes → Introduce Read Model/Cache if justified → Run Same Workload →Measure Again</blockquote><p>I strongly prefer investigating <strong>Option B before relying on Option A alone</strong>.</p><p>Scaling infrastructure is perfectly valid.</p><p>But scaling should support an efficient architecture, not compensate indefinitely for inefficient data access.</p><h4>What Should We Measure as performance engineer?</h4><p>After implementing the new schema, run the <strong>same performance workload</strong> against both designs.</p><p><strong>API level Compare: </strong>Average response time, P90, P95, P99, TPS, Error rate</p><p><strong>Order/Payment service Compare: </strong>CPU, Memory, GC, Threads, DB connection pool, Request queueing</p><p><strong>Database level:</strong> DB CPU, Query duration, Execution plans, Rows scanned, Disk I/O, Connections, Locks / waits</p><p><strong>Infrastructure level: </strong>Application instances/pods, CPU utilization, Memory utilization, Autoscaling behavior, Database capacity, Network utilization</p><p>The goal isn’t merely:</p><blockquote><strong>“The API became faster.”</strong></blockquote><p>A much stronger performance conclusion is:</p><blockquote><strong>At the same workload, the optimized design required less database work per business transaction while maintaining the required API latency and throughput.</strong></blockquote><h4>The Architecture I’d Start With</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*rfCBQs7zrFi54eFfr3jLAA.png" /></figure><p>The exact architecture should still be driven by workload, consistency, operational complexity, and measured bottlenecks.</p><h4>Final Thought</h4><p>When your Payment or Order API slows down under load, don’t immediately ask:</p><blockquote><strong><em>“How much more infrastructure do we need?”</em></strong></blockquote><p>Ask:</p><blockquote><strong><em>“How much work is one order request forcing our system to perform?”</em></strong></blockquote><p>Look at the query, joins, execution plan, indexes, how many records are scanned, payload, repeated reads, whether payment history needs to be loaded with every order.</p><p>Then decide whether you need:</p><p><strong>a better query, a better index, a read model, a cache, a better schema, or genuinely more infrastructure.</strong></p><p>Because scaling a poorly optimized data model simply gives an expensive request a bigger machine to run on.</p><p><strong>Good performance engineering isn’t just about making infrastructure bigger.</strong></p><blockquote>It’s about making every transaction <strong>cheaper.</strong></blockquote><p><strong>Priya Kothandaraman</strong><br><em>Sharing insights from real-world debugging and system optimization journeys!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd50dc67ac10" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When Webhooks Arrive in Bursts: A Performance Testing Story]]></title>
            <link>https://medium.com/@priyaraman.nov07/when-webhooks-arrive-in-bursts-a-performance-testing-story-10d8a6b640b0?source=rss-90baf3691e8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/10d8a6b640b0</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[api-performance-testing]]></category>
            <category><![CDATA[performance-engineering]]></category>
            <category><![CDATA[webhooks]]></category>
            <category><![CDATA[performance-testing]]></category>
            <dc:creator><![CDATA[Priyaraman]]></dc:creator>
            <pubDate>Mon, 26 Oct 2026 11:31:02 GMT</pubDate>
            <atom:updated>2026-10-26T11:31:02.366Z</atom:updated>
            <content:encoded><![CDATA[<p>A signup flow can look perfectly healthy when tested with one user at a time. The API responds, the user gets created, and everything appears ready for production.</p><p>Then we apply load.</p><p>Suddenly, the confirmation email doesn’t arrive.</p><p>At first glance, this sounds like an <strong>email problem</strong>. It wasn’t.</p><p>The real issue was hiding upstream, in the way <strong>Gigya webhook traffic was being handled under concurrent load</strong>.</p><h4>Everything Looked Fine… Until We Added Load</h4><p>During performance testing, we observed an interesting behavior in the signup journey:</p><blockquote><strong><em>Users were successfully signing up, but the confirmation email was not consistently being sent by the server.</em></strong></blockquote><p>The issue was reproducible in the Stage environment, which gave us an opportunity to investigate what was happening when multiple signup activities occurred together.</p><p>What we discovered changed the direction of the investigation.</p><p>The email itself wasn’t the starting point of the problem.</p><p>The webhook traffic pattern was.</p><h4>Following the Request Flow</h4><p>The original flow was essentially:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*h7njPFHflV9pizhRBhdOwg.png" /></figure><p>Under load, <strong>Gigya was sending a burst of webhook requests around the same time</strong>.</p><p>That behavior contributed to two visible problems:</p><ul><li>Duplicate UID processing</li><li>Increased response time at the API Gateway layer</li></ul><p>Eventually, the impact surfaced where users could actually notice it:</p><h4>The signup confirmation email was not sent reliably.</h4><p>And this is exactly why performance engineering shouldn’t stop at checking whether an API meets a response-time SLA.</p><p>A response-time degradation can sometimes be the first visible symptom of a much larger architectural problem.</p><h4>The Real Problem: A Burst Became a Bottleneck</h4><p>Imagine the system receiving webhook callbacks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*kZDG-51_1l9xip08IrLgHg.png" /></figure><p>When requests arrive individually, everything may behave normally.</p><p>But performance testing changes the equation.</p><p>Instead of asking:</p><blockquote><strong><em>“Does this functionality work?”</em></strong></blockquote><p>we ask:</p><blockquote><strong><em>“Does this functionality still work when many things happen at the same time?”</em></strong></blockquote><p>That distinction exposed the weakness.</p><p>The architecture needed a better way to absorb and organize the incoming webhook traffic before performing email processing.</p><h4>The Fix: Separate Webhook Intake from Email Processing</h4><p>Instead of continuing to process the incoming Gigya webhook traffic directly through the existing flow, the solution introduced a <strong>separate email service</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*sPn6Uw4pMwCrP_BMDjKBjQ.png" /></figure><p>The responsibility of this service was straightforward:</p><ol><li>Receive the webhook requests coming from Gigya.</li><li>Align the incoming webhook events appropriately.</li><li>Ensure the email operation is performed for <strong>unique UIDs</strong>.</li><li>Send the corresponding confirmation email.</li></ol><p>The revised flow became:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*apD5kbMeOBI72abIMW5lPg.png" /></figure><p>This design separated the webhook-handling concern from the original processing path and addressed the duplicate UID behavior observed during testing.</p><p>After implementing the change, the issue was <strong>resolved in validation</strong>.</p><h4>Before vs. After</h4><blockquote><strong>Before the fix:</strong></blockquote><blockquote><em>Webhook Burst → Concurrent Requests → </em><strong>Duplicate UID Processing</strong> <em>→ API Gateway Response-Time Impact →Confirmation Email Issue</em></blockquote><blockquote><strong>After the fix:</strong></blockquote><blockquote>Webhook Burst → Dedicated Email Service → Webhook Alignment →<br><strong><em>Unique UID Processing</em></strong> → Confirmation Email</blockquote><p>That is an important transformation.</p><p>We didn’t simply make an API faster.</p><p><strong>We changed how the application handled concurrent events.</strong></p><h4>What Performance Testing Really Found</h4><p>This finding reinforced something I have repeatedly seen while working on performance validation:</p><blockquote><strong><em>Performance issues are not always infrastructure issues. Sometimes load simply exposes an architectural assumption that was invisible at lower concurrency.</em></strong></blockquote><p>The system worked functionally.</p><p>The problem appeared when the traffic pattern changed.</p><p>That’s where performance engineering provided value beyond TPS and response-time measurements.</p><p>We weren’t only asking:</p><ul><li>What is the response time?</li><li>What TPS can the application handle?</li><li>Is CPU utilization high?</li><li>Are APIs meeting their SLA?</li></ul><p>We also asked: <strong><em>What actually happens to the business flow when the system is under load?</em></strong></p><p>In this case, the answer was significant.</p><p>A performance bottleneck was affecting a user-facing business outcome: <strong>signup confirmation email delivery</strong>.</p><h4>Final Throught</h4><p>Performance testing shouldn’t end with a statement like:</p><blockquote>“Response time exceeded the SLA.”</blockquote><p>That’s an observation.</p><p>The real engineering work begins with the next question: <strong><em>Why?</em></strong></p><p>Follow the request → Follow the dependencies → Look at concurrency → Look at the traffic pattern</p><p>And most importantly, follow the impact all the way to the user journey.</p><p>Because sometimes the most valuable performance finding isn’t:</p><p>“This API took longer than expected.” It’s:</p><blockquote><strong>“Under load, the architecture behaved differently than we expected.”</strong></blockquote><p>And finding that <em>before production</em> is exactly what performance engineering is meant to do.</p><p><strong>Priya Kothandaraman</strong><br><em>Sharing insights from real-world debugging and system optimization journeys!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10d8a6b640b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Needed to Refresh a Token Every Hour. So I Built a JMeter Controller.]]></title>
            <link>https://medium.com/@priyaraman.nov07/i-needed-to-refresh-a-token-every-hour-so-i-built-a-jmeter-controller-f5873763efe3?source=rss-90baf3691e8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5873763efe3</guid>
            <category><![CDATA[apache-jmeter]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Priyaraman]]></dc:creator>
            <pubDate>Mon, 19 Oct 2026 11:31:02 GMT</pubDate>
            <atom:updated>2026-10-19T11:31:02.068Z</atom:updated>
            <content:encoded><![CDATA[<p>The birth story of my Timed Specified Controller, built from a real performance-testing problem with a help from vibe coding</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*xrwV5MwkPKjn-ZwWwC75LA.png" /><figcaption>Beyond Once Only: Building a Time-Based Controller for Apache JMeter</figcaption></figure><p>Sometimes the best developer tools don’t start with a roadmap.</p><p>They start with a small irritation.</p><p>In my case, it was an <strong>authentication token</strong>.</p><p>While building a performance test in Apache JMeter, I had an API that generated an authentication token. The problem was simple:</p><blockquote><strong><em>The token expired after one hour.</em></strong></blockquote><p>Generating the token at the beginning of the test was easy.</p><p>But what happens when the test runs longer than an hour?</p><p>I needed JMeter to execute the token-generation API again, refresh the token, and allow the performance test to continue.</p><p>And that led me to one simple question:</p><blockquote><strong><em>We have the Once Only Controller. Why don’t we have something similar that executes periodically based on a specified time interval?</em></strong></blockquote><p>That question eventually became my <strong>Timed Specified Controller for JMeter</strong>.</p><p>And this is the story of how it was born.</p><h4>The Original Problem</h4><p>Imagine a long-running performance test:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*mjKu0GgnnPhKj_2c8vq28g.png" /></figure><p>The token is valid only for a limited period.</p><p>If my test runs beyond that validity period, the old token becomes unusable.</p><p>Of course, this can be handled with JMeter scripting.</p><p>You can maintain timestamps, calculate elapsed time and decide whether the token needs to be regenerated.</p><p>Conceptually, the logic looked something like this:</p><blockquote><strong>Groovy</strong></blockquote><blockquote>def now = System.currentTimeMillis()</blockquote><blockquote>def lastRun = vars.get(“TOKEN_LAST_REFRESH”)</blockquote><blockquote>if (lastRun == null || (now — lastRun.toLong()) &gt;= 3600000) {</blockquote><blockquote>// Allow token-generation flow to execute</blockquote><blockquote>vars.put(“TOKEN_LAST_REFRESH”, now.toString())</blockquote><blockquote>}</blockquote><p>It works. But while writing logic like this, another thought popped into my head.</p><p><strong>Why am I solving a scheduling problem inside a script?</strong></p><h4>Then I Thought About JMeter’s Once Only Controller</h4><p>JMeter already gives us a very intuitive controller:</p><p><strong>Once Only Controller</strong></p><p>The intention is immediately understandable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*9tEeLqZLWnw7_Qk9VpXBfw.png" /></figure><p>What if we had the same kind of concept for time?</p><p>Something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*nYF17KR-5fqdv1PhbfDxsw.png" /></figure><p>Instead of burying the scheduling logic inside scripts, the <strong>controller itself could represent the intent</strong>.</p><p>That was the idea.</p><p>💡 <strong>Run the children of this controller according to a specified time interval.</strong></p><p>And suddenly this was no longer only about authentication tokens.</p><p>It could potentially become a reusable JMeter concept.</p><h4>From a Workaround to a Plugin Idea</h4><p>This is one of the things I love about performance engineering.</p><p>You start by solving:</p><blockquote><em>“How do I refresh this token?”</em></blockquote><p>But if you step back, you sometimes discover the actual problem is:</p><blockquote><em>“How can I make this behavior reusable across my JMeter test plans?”</em></blockquote><p>That distinction matters.</p><p>The first approach solves today’s test.</p><p>The second has the potential to solve the same pattern again.</p><p>So instead of leaving the solution as another piece of Groovy logic buried inside one .jmx file, I decided to explore turning the idea into a <strong>custom JMeter controller</strong>.</p><p>And that’s where <strong>vibe coding</strong> entered the story. 😄</p><h4>Vibe Coding My Way From Idea to Plugin</h4><p>I had the performance-testing requirement clearly in my head:</p><ul><li>I knew the problem.</li><li>I knew how I wanted it to behave from a tester’s perspective.</li><li>I knew I wanted it to feel like a native JMeter controller.</li><li>And I knew I wanted to avoid repeating the same timing logic across test plans.</li></ul><p>Rather than designing every class and implementation detail upfront, I used an AI-assisted, iterative coding approach.</p><p>Or, as we increasingly call it:</p><p><strong>Vibe coding.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*Vkw7AdPSO7X15U0gTZ9TMg.png" /></figure><p>AI helped accelerate the coding process, but the important part was still the engineering context.</p><p>The tool can help write code.</p><p><strong>The performance engineer still has to understand what problem the code should solve.</strong></p><p>That, to me, is where vibe coding becomes genuinely useful.</p><h4>The Controller I Wanted to See in My Test Plan</h4><p>I wanted the completed test plan to tell the story without requiring someone to inspect Groovy scripts.</p><p>Instead of this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*OAcq3XhaxdFmWzMv_FHoVQ.png" /></figure><p>I wanted something conceptually closer to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*s1lxeqZZ7dgLqcDn5uVQYA.png" /></figure><p>The second representation immediately communicates <strong>why that API exists in the test plan</strong>.</p><p>For me, that readability is important.</p><p>Performance scripts live longer than we expect.</p><p>Eventually another engineer opens your test.</p><p>And when they do, this:</p><blockquote><strong><em>Timed Specified Controller → Generate Token</em></strong></blockquote><p>is much easier to understand than:</p><blockquote><strong><em>JSR223 → Groovy → timestamp variable → condition → sampler</em></strong></blockquote><h4>Beyond Token Generation</h4><p>The authentication-token problem triggered the idea, but the pattern isn’t necessarily limited to authentication.</p><p>A time-controlled execution concept could also be useful for workloads where you have operations that should occur significantly less frequently than the main business flow.</p><p>Conceptually:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*HoJMnqGHWr76uegST9ZLaA.png" /></figure><p>The important thing is that the <strong>timing intent becomes part of the test-plan structure</strong>, rather than being hidden entirely inside custom scripting.</p><h4>But Why Not Just Use Groovy?</h4><p>Honestly? You can.</p><p>And for a small or highly specific test, <strong>Groovy may be the better answer</strong>.</p><p>Not every 10-line script deserves to become a plugin.</p><p>For me, the motivation was reusability and readability.</p><p>If I repeatedly have test plans containing variations of:</p><blockquote>Groovy</blockquote><blockquote>currentTime — lastExecution &gt;= configuredInterval</blockquote><p>then I start asking whether that logic belongs in every individual performance script.</p><p>A reusable controller can make more sense when the behavior appears repeatedly and you want your .jmx structure to communicate that behavior directly.</p><p>So I don’t see this controller as:</p><p><strong>“JMeter scripting is bad.”</strong></p><p>I see it as:</p><p><strong>“If a pattern keeps repeating, maybe it deserves an abstraction.”</strong></p><h3>What This Project Taught Me About AI-Assisted Engineering</h3><p>The interesting part of this project wasn’t only building something for JMeter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ojvg7-nHkNeTdsqDAVEFrQ.png" /></figure><p>It changed how I think about AI-assisted coding.</p><p>There is a lot of discussion around whether AI can generate production-ready code, whether developers should trust it, and whether vibe coding is good or bad.</p><p>For me, that’s not the most interesting question.</p><p>A better question is:</p><blockquote><strong><em>Can AI reduce the distance between an engineer identifying a problem and experimenting with a working solution?</em></strong></blockquote><p>For this project, that answer was <strong>yes</strong>.</p><p>The idea didn’t come from AI.</p><p>The problem didn’t come from AI.</p><p>The engineering requirement didn’t come from AI.</p><p>It came from running performance tests and encountering an annoying real-world situation.</p><p>AI simply helped me move faster between:</p><blockquote>“I wish JMeter could do this.” and “Let me try building it.”</blockquote><p>And I think that’s one of the most exciting things about vibe coding.</p><h3>The Timed Specified Controller</h3><p>The project is available on my GitHub repository:</p><p>👉 <a href="https://github.com/priyak0711/Jmeter_TimedSpecifiedController/tree/main/timed-specified-controller">Explore the Timed Specified Controller source code</a></p><p>If you’re a JMeter or performance engineer, I’d especially love for you to look at this project from a <strong>use-case perspective</strong>.</p><p>Not just:</p><blockquote><em>“Does the code work?”</em></blockquote><p>But:</p><blockquote><strong><em>“Where else would time-based controller behavior simplify a JMeter workload?”</em></strong></blockquote><p>Because that is how this project started in the first place.</p><p>One performance-testing problem.</p><p>One question.</p><p>A bit of experimentation.</p><p>And quite a lot of vibe coding. 😄</p><h3>Final Thought</h3><p>There is a small mindset change here that I want to carry into future performance-engineering work:</p><blockquote><strong><em>When you repeatedly write custom logic to work around a limitation, pause for a moment. You might not just have a workaround. You might have the beginning of a tool.</em></strong></blockquote><p>For me, that moment happened while refreshing an authentication token.</p><p>And that’s how the <strong>JMeter Timed Specified Controller</strong> was born. 🚀</p><p><strong>Priya Kothandaraman</strong><br><em>Sharing insights from real-world debugging and system optimization journeys!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5873763efe3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AWS Redis Optimization: How Redis Hashes Improved Order API Performance by 50%]]></title>
            <link>https://medium.com/@priyaraman.nov07/aws-redis-optimization-how-redis-hashes-improved-order-api-performance-by-50-3128c9fdf71b?source=rss-90baf3691e8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/3128c9fdf71b</guid>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Priyaraman]]></dc:creator>
            <pubDate>Mon, 12 Oct 2026 11:31:02 GMT</pubDate>
            <atom:updated>2026-10-12T11:31:02.007Z</atom:updated>
            <content:encoded><![CDATA[<p>When Infrastructure Scaling Isn’t the Answer</p><p>Performance engineers often look at CPU bottlenecks, database tuning, query optimization, and horizontal scaling when latency starts increasing.</p><p>Recently, while analyzing an Order Management API, we observed that the database wasn’t the primary bottleneck.</p><p>The bottleneck was hiding in plain sight:</p><blockquote><em>Our Redis cache design.</em></blockquote><p>The application was storing order information as serialized JSON strings in AWS ElastiCache Redis.</p><p>While functional, this approach was creating unnecessary serialization overhead, increased network traffic, and slower cache updates.</p><p>We decided to compare two approaches:</p><ol><li>Redis String Cache</li><li>Redis Hash Cache</li></ol><p>The results were surprisingly impressive.</p><h4>Existing Cache Design: Redis Strings</h4><p>Our Order Details API cached an order object as a single JSON string.</p><p><strong><em>Sample Order — </em></strong>JSON</p><blockquote>{<br>“orderId”: “ORD123456”,<br>“customerId”: “CUS1001”,<br>“status”: “SHIPPED”,<br>“amount”: 2500,<br>“deliveryDate”: “2026–10–01”<br>}</blockquote><p><strong><em>Python Implementation</em></strong></p><blockquote>import redis<br>import json</blockquote><blockquote>redis_client = redis.Redis(<br> host=’redis-endpoint’,<br> port=6379,<br> decode_responses=True<br>)</blockquote><blockquote>order = {<br> “orderId”: “ORD123456”,<br> “customerId”: “CUS1001”,<br> “status”: “SHIPPED”,<br> “amount”: 2500,<br> “deliveryDate”: “2026–10–01”<br>}</blockquote><blockquote>redis_client.set(<br> f”order:{order[‘orderId’]}”,<br> json.dumps(order)<br>)</blockquote><p><strong><em>Read Operation</em></strong></p><blockquote>cached_order = redis_client.get(“order:ORD123456”)</blockquote><blockquote>order = json.loads(cached_order)</blockquote><blockquote>print(order)</blockquote><p>The challenge? Whenever a single field changes:</p><blockquote>Python</blockquote><blockquote>status = “DELIVERED”</blockquote><blockquote><strong><em>The entire object must be retrieved, updated, serialized, and stored again.</em></strong></blockquote><h4>Optimized Design: Redis Hashes</h4><p>Instead of storing an entire JSON object, we stored each field independently.</p><p><strong>Hash Structure</strong></p><blockquote>Python</blockquote><blockquote>orderId ORD123456<br>customerId CUS1001<br>status SHIPPED<br>amount 2500<br>deliveryDate 2026–10–01</blockquote><p><strong>Python Implementation</strong></p><blockquote>redis_client.hset(<br> “order:ORD123456”,<br> mapping={<br> “orderId”: “ORD123456”,<br> “customerId”: “CUS1001”,<br> “status”: “SHIPPED”,<br> “amount”: “2500”,<br> “deliveryDate”: “2026–10–01”}<br>)</blockquote><p><strong>Fetch Entire Order</strong></p><blockquote>order = redis_client.hgetall(<br>“order:ORD123456”<br>)<br>print(order)</blockquote><p><strong>Fetch Only Status</strong></p><blockquote>status = redis_client.hget(<br> “order:ORD123456”,<br> “status”<br>)</blockquote><p><strong>Update Only Status</strong></p><blockquote>redis_client.hset(<br> “order:ORD123456”,<br> “status”,<br> “DELIVERED”<br>)</blockquote><p>No serialization, No full object rewrite, No unnecessary network traffic.</p><h4>APIs Under Test</h4><p><strong>GET Order Details:</strong> Returns only order status.</p><blockquote>HTTP -GET /api/orders/{orderId}</blockquote><p><strong>Update Order Status: </strong>Updates shipment or delivery status.</p><blockquote>HTTP - PUT /api/orders/{orderId}/status</blockquote><h4>JMeter Performance Test Setup</h4><p>To compare both cache implementations, Apache JMeter was used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TH8MEWL2R8VCHIKHc9XBhA.png" /><figcaption><strong><em>Perf Workload Design</em></strong></figcaption></figure><h4><strong><em>Performance Results</em></strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*bHGooy3_NUn4xK5xEgk6Mw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*DY0YxLclD8hFJqU6qpMrPQ.png" /></figure><h4>Why Redis Hashes Won</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*OxB6fa626Vuq-wdYiLNhfA.png" /><figcaption>From Redis Strings to Redis Hashes. Same infrastructure. Different league.</figcaption></figure><ol><li><strong>Partial Updates:</strong> Single operation, Less processing.</li><li><strong>Reduced Payload Size: </strong>Hashes allowed fetching a single field, instead of loading the entire order document.</li><li><strong>Lower Serialization Overhead: </strong>JSON Serialize &amp; Deserialize</li><li><strong>Better Resource Utilization:</strong> The same AWS Redis cluster handled significantly more traffic without any infrastructure upgrade.That means:</li></ol><ul><li>Higher TPS</li><li>Better response times</li></ul><h4>Final Thoughts</h4><p>Performance optimization isn’t always about:</p><ul><li>Bigger EC2 instances &amp; More containers</li><li>Larger Redis clusters &amp; Additional replicas</li></ul><p>Sometimes the biggest win comes from choosing the right data structure.</p><p>In our Order API use case, simply migrating from <strong>Redis Strings</strong> to <strong>Redis Hashes</strong> resulted in:</p><p>** 50% lower latency</p><p>** 60% higher throughput</p><p>** Better scalability without additional infrastructure</p><blockquote><strong><em>Before scaling your infrastructure, ensure you’re scaling your data structures intelligently.</em></strong></blockquote><p>A small cache design decision can unlock a massive performance improvement. 🚀</p><p><strong>Priya Kothandaraman</strong><br><em>Sharing insights from real-world debugging and system optimization journeys!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3128c9fdf71b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL Database at 100% CPU: The Performance Investigation That Revealed More Than Just a Scaling…]]></title>
            <link>https://medium.com/@priyaraman.nov07/sql-database-at-100-cpu-the-performance-investigation-that-revealed-more-than-just-a-scaling-c5bd1709542b?source=rss-90baf3691e8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5bd1709542b</guid>
            <category><![CDATA[system-design-concepts]]></category>
            <category><![CDATA[database-optimization]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Priyaraman]]></dc:creator>
            <pubDate>Mon, 05 Oct 2026 11:31:01 GMT</pubDate>
            <atom:updated>2026-10-05T11:31:01.626Z</atom:updated>
            <content:encoded><![CDATA[<h3>SQL Database at 100% CPU: The Performance Investigation That Revealed More Than Just a Scaling Problem</h3><p>Our performance testing dashboard started flashing warning signs. Database CPU utilization was consistently between <strong>80% and 100%</strong>, response times were growing, and throughput was struggling to scale.</p><p>At first glance, the obvious assumption was:</p><p><em>“The database needs more resources.”</em></p><p>But as every performance engineer learns sooner or later, throwing more hardware at a problem doesn’t always solve it.</p><p>This became an interesting investigation into query design, table relationships, indexing strategies, and understanding what was really happening beneath the surface.</p><h4>The Symptom</h4><p>During load testing, we observed:</p><ul><li>Database CPU utilization consistently between <strong>80% and 100%</strong></li><li>Increased query execution times</li><li>API response time degradation</li><li>Reduced ability to handle additional throughput</li><li>Performance bottlenecks appearing even before target TPS was reached</li></ul><p>The infrastructure seemed healthy enough, yet the database was behaving like it was constantly running a marathon.</p><p>Something deeper was happening.</p><h4>Following the Clues</h4><p>We started analyzing the slow-running SQL statements.</p><p>A pattern immediately stood out.</p><p>Most of the expensive queries contained:</p><ul><li>Multiple table joins</li><li>Large datasets</li><li>Complex filtering conditions</li><li>Repetitive execution under high load</li></ul><p>The execution plans showed that the database was spending significant effort combining data across several related tables.</p><p>What may work efficiently with thousands of records can quickly become a bottleneck when the dataset grows into hundreds of thousands or millions.</p><p>The database wasn’t just retrieving data.</p><p>It was working overtime to find it.</p><h4>The Hidden Cost of Multiple Joins</h4><p>Joins are powerful, They help normalize data, maintain relationships, and reduce duplication.</p><p>However, when multiple tables are involved in a single query, the database must perform additional work:</p><ul><li>Match records between tables</li><li>Scan large portions of data</li><li>Sort intermediate results</li><li>Allocate additional memory and CPU resources</li></ul><p>Under heavy workload conditions, these operations can become expensive.</p><p>The more complex the join structure, the harder the database has to work.</p><p>And harder work means higher CPU consumption.</p><h4>The Indexing Suspect</h4><p>While analyzing execution plans, another suspect emerged.</p><p><strong>Indexes </strong>Or <strong>Missing or inefficient indexes.</strong></p><p>Several frequently used columns involved in:</p><ul><li>Join conditions</li><li>Search filters</li><li>Sorting operations</li></ul><p>were either not optimally indexed or required further optimization.</p><p>When an appropriate index is missing, the database often performs larger scans to locate data.</p><p>Imagine searching for a specific chapter in a book without a table of contents.</p><p>Now imagine doing that thousands of times per second.</p><p>That’s exactly what the database is forced to do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/1*w-c8bAW5BUfxv4frGo2O9A.png" /><figcaption>Not Every Performance Problem Needs Bigger Hardware.</figcaption></figure><h4>Why Scaling Up Isn’t Always the Answer</h4><p>One common reaction to high CPU usage is database scaling.</p><p>More CPU. More memory. Larger instances.</p><p>While scaling may provide temporary relief, it doesn’t necessarily address the root cause.</p><p>In our case, infrastructure improvements helped reduce pressure temporarily, but the underlying query patterns continued consuming significant resources.</p><p>The lesson?</p><blockquote><em>You cannot optimize bad query patterns with hardware forever.</em></blockquote><p>At some point, application design and database design must be optimized together.</p><h4>How We Mitigated the High CPU Utilization</h4><p>After identifying that complex joins and potential indexing issues were contributing to the database bottleneck, we focused on addressing the root causes rather than relying solely on infrastructure scaling.</p><h4>1. Optimizing Query Design</h4><p>The first step was reviewing the most expensive SQL statements.</p><p>We identified opportunities to:</p><ul><li>Remove unnecessary table joins</li><li>Retrieve only the required columns instead of using SELECT *</li><li>Simplify filtering conditions</li><li>Reduce repetitive database calls from the application layer</li><li>Break large queries into smaller, more efficient operations where appropriate</li></ul><p>Even small query optimizations resulted in noticeable reductions in execution cost.</p><h4>2. Reviewing and Improving Indexing Strategy</h4><p>Index analysis revealed several areas for improvement.</p><p>We focused on:</p><ul><li>Creating indexes on frequently joined columns</li><li>Optimizing indexes used in search and filter conditions</li><li>Removing redundant or unused indexes that increased write overhead</li><li>Evaluating composite indexes for queries using multiple predicates</li></ul><p>Proper indexing significantly reduced table scans and lowered CPU-intensive operations.</p><blockquote>A well-designed index often provides greater performance benefits than simply increasing database resources.</blockquote><h4>3. Analyzing Execution Plans</h4><p>Execution plans became our primary diagnostic tool.</p><p>By reviewing the execution plan, we were able to identify:</p><ul><li>Full table scans</li><li>Costly nested-loop joins</li><li>Inefficient access patterns</li><li>Missing index recommendations</li><li>High-cost operations responsible for CPU spikes</li></ul><p>Rather than guessing, the execution plan showed us exactly where the database was spending its time.</p><h4>4. Archiving and Managing Data Growth</h4><p>One key observation was that query performance degraded as table sizes increased.</p><p>To address this, we evaluated:</p><ul><li>Data archiving strategies</li><li>Partitioning large tables</li><li>Retention policies for historical records</li><li>Separating operational and reporting workloads</li></ul><p>Keeping active datasets smaller reduced the amount of data processed during query execution.</p><h4>5. Introducing Caching Where Possible</h4><p>Some frequently requested information changed infrequently.</p><p>Instead of repeatedly querying the database, we explored:</p><ul><li>Application-level caching</li><li>Distributed caching mechanisms</li><li>Reference data caching</li><li>API response caching</li></ul><p>Reducing unnecessary database calls directly lowered CPU utilization.</p><h4>6. Infrastructure Scaling as a Temporary Relief</h4><p>As an immediate mitigation, the database was scaled to a larger instance size.</p><p>This provided:</p><ul><li>Additional CPU capacity</li><li>Better handling of concurrent workloads</li><li>Temporary relief while permanent optimizations were implemented</li></ul><p>However, scaling was treated as a short-term workaround rather than the final solution.</p><h4>Results</h4><p>Following these improvements, we observed:</p><p>→ Reduced database CPU utilization</p><p>→ Improved query execution times</p><p>→ Better API response times</p><p>→ Increased throughput capacity</p><p>→ Improved performance stability under load</p><p>Most importantly, the database became capable of supporting future growth more efficiently instead of relying solely on larger infrastructure.</p><h4>Final Takeaway</h4><p>High database CPU utilization is rarely just an infrastructure problem.</p><p>In many cases, it is the database telling us a story:</p><ul><li>Queries are doing too much work.</li><li>Joins are more expensive than expected.</li><li>Indexes are missing or ineffective.</li><li>Data volumes have outgrown the original design.</li></ul><p>The most sustainable solution is not always a bigger database server.</p><blockquote><strong>The best performance optimization isn’t scaling infrastructure. It’s eliminating the unnecessary work the system performs in the first place.</strong></blockquote><p>Because in performance engineering, the best optimization is not making the database more powerful. <strong>It’s making the database work less.</strong>🚀</p><p><strong>Priya Kothandaraman</strong><br><em>Sharing insights from real-world debugging and system optimization journeys!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5bd1709542b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Fast Servers Don’t Mean Fast Experiences: The Automation Playbook (Part 4)]]></title>
            <link>https://medium.com/@priyaraman.nov07/why-fast-servers-dont-mean-fast-experiences-the-automation-playbook-part-4-0cf14449772d?source=rss-90baf3691e8f------2</link>
            <guid isPermaLink="false">https://medium.com/p/0cf14449772d</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[core-web-vitals]]></category>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Priyaraman]]></dc:creator>
            <pubDate>Mon, 28 Sep 2026 11:31:01 GMT</pubDate>
            <atom:updated>2026-09-28T11:31:01.679Z</atom:updated>
            <content:encoded><![CDATA[<p>From Core Web Vitals to Continuous Monitoring: Building a Real Browser Performance Framework with Node.js</p><p>Part 1 taught us what to measure. Part 2 showed us how to optimize. Part 3 explained how elite engineering teams prevent performance regressions. But there’s one final piece most organizations still struggle with: automation.</p><h4>The Performance Problem Nobody Talks About</h4><p>Every engineering team eventually reaches the same milestone.</p><p>→ Lighthouse score improved →LCP reduced →CLS stabilized →Production release completed.</p><p>Everyone celebrates.</p><p>Then a few sprints later:</p><ul><li>A new marketing widget arrives.</li><li>Another analytics tag gets added.</li><li>A third-party JavaScript library grows larger.</li><li>New images are uploaded without optimization.</li></ul><p>Slowly, performance begins to decline.</p><p>Not because the team forgot how to optimize.</p><p>Because nobody was continuously measuring it.</p><p>The reality is simple:</p><blockquote>If performance validation requires someone to manually open Chrome DevTools, performance regressions are inevitable.</blockquote><p>That realization led me to build a lightweight automation framework that continuously captures real browser performance metrics using Node.js and Puppeteer.</p><h4>The Goal</h4><p>Instead of periodically running manual Lighthouse audits, I wanted a framework capable of:</p><p>→ Launching a real browser →Capturing browser-native performance metrics →Collecting Core Web Vitals automatically →Generating JSON reports →Supporting CI/CD integration →Tracking performance trends over time</p><p><strong>The result was:</strong> Client side analysis Automation [Webpage_ClientSide_Performance_Metrics_POC]</p><p>👉 GitHub Repository: <a href="https://github.com/priyak0711/Webpage_ClientSide_Performance_Metrics_POC"><strong>https://github.com/priyak0711/Webpage_ClientSide_Performance_Metrics_POC</strong></a></p><p>A Node.js-based client-side performance monitoring framework.</p><h4>Why Traditional Performance Testing Isn’t Enough</h4><p>As performance engineers, we typically monitor:</p><ul><li>API Response Time</li><li>Server Throughput</li><li>CPU Utilization</li><li>Memory Consumption</li><li>Database Latency</li></ul><p>But users never see those metrics.</p><p>Users see:</p><ul><li>Blank screens</li><li>Layout shifts</li><li>Slow rendering</li><li>Unresponsive pages</li></ul><h3>The Framework Architecture</h3><p>The project structure is intentionally simple.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eb8kz9dlgl9Lv75rQuzFbw.png" /></figure><p>Every component serves a clear purpose.</p><h3>index.js</h3><p>The main orchestrator.</p><p>Responsible for:</p><ul><li>Launching Chromium</li><li>Navigating to URLs</li><li>Injecting metric collectors</li><li>Extracting results</li><li>Saving reports</li></ul><p>Think of it as the controller for the entire workflow.</p><h4>metrics-collector.js</h4><p>This is where the magic happens.</p><p>The module leverages:</p><blockquote>PerformanceObserver</blockquote><blockquote>Navigation Webpage</blockquote><blockquote>Paint Timing API</blockquote><p>to collect:</p><ul><li>TTFB, FCP, LCP, CLS, FID, DOM Content Loaded, Rendering Time, Load Time</li></ul><p>These are the same browser-native metrics that influence real user experience.</p><h4>speed-index.js</h4><p>One challenge with performance measurements is that users don’t experience individual metrics.</p><p>They experience:</p><blockquote><em>“How quickly does the page feel complete?”</em></blockquote><p>To answer that question, the framework calculates a Speed Index approximation that tracks overall visual progress.</p><p>This provides another layer of user-centric performance analysis.</p><h4>Why Puppeteer?</h4><p>The project uses:</p><blockquote>Puppeteer</blockquote><p>to launch a real Chromium browser.</p><blockquote>con** browser = await puppeteer.launch**;</blockquote><p>This isn’t simulation.</p><p>It is an actual browser rendering an actual webpage.</p><p>That means:</p><p>**Real Paint Events</p><p>**Real Rendering</p><p>**Real Network Requests</p><p>**Real Browser Timings</p><p>The metrics collected reflect what users genuinely experience.</p><h4>The Most Critical Design Decision</h4><p>One of the biggest mistakes in browser performance automation is collecting metrics too late.</p><p><strong>Consider:</strong></p><blockquote>Navigation Page → FCP Happens → LCP Happens → Monitoring script Loads</blockquote><p>At this point you’ve already missed the metrics you wanted to measure.</p><p>To solve this problem, the framework uses:</p><blockquote>page.evaluateOnNewDocument**</blockquote><p>before page navigation.</p><p>This allows performance observers to begin listening immediately when the page starts loading. The sequence becomes:</p><blockquote>Browser Launche → Performance Observers → Website Loads → Metrics Captured</blockquote><p>No critical rendering events are missed.</p><p>For performance engineers, this small implementation detail dramatically increases measurement accuracy.</p><h4>Capturing Real User-Centric Metrics</h4><p>The framework automatically records:</p><blockquote>Time To First Byte (TTFB)</blockquote><p>How quickly the first response byte arrives from the server.</p><blockquote>First Contentful Paint (FCP)</blockquote><p>When users first see visible content.</p><blockquote>Largest Contentful Paint (LCP)</blockquote><p>When the primary page content becomes visible.</p><p>One of Google’s most important ranking and UX metrics.</p><blockquote>Cumulative Layout Shift (CLS)</blockquote><p>Measures unexpected movement on a page.</p><p>You click a button. The page shifts. You accidentally buy something.</p><p>That’s CLS.</p><blockquote>First Input Delay (FID)</blockquote><p>Measures responsiveness to user interaction. Interestingly:</p><p>FID = null</p><p>during automated runs. Why?</p><p>Because FID requires an actual human interaction event. Without a click, tap, or keyboard action, there is no interaction delay to measure and that’s completely expected.</p><h4>Why We Wait 9 Extra Seconds</h4><p>Another common mistake in performance testing is stopping measurement immediately after: <em>window.load</em></p><p>Modern web applications continue loading long after that event.</p><p>Examples include:</p><ul><li>Lazy-loaded images</li><li>Recommendation engines</li><li>Advertising widgets</li><li>Analytics scripts</li><li>Customer chat tools</li></ul><p>Largest Contentful Paint can continue changing during this time. To solve this challenge the framework intentionally waits: ~9 second before finalizing results.</p><p>That allows:</p><p>→ LCP stabilization</p><p>→ Rendering completion</p><p>→ Speed Index calculations</p><p>The result is closer to what actual users experience.</p><h4>JSON Reporting for Historical Trending</h4><p>After each execution, the framework generates:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1kiHQMhSje0GzXxChyZdAQ.png" /></figure><p>and stores results inside: /results with timestamps. This enables historical analysis.</p><p>Instead of asking:</p><blockquote>“Did performance degrade?”</blockquote><p>You can answer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*1V3iWDAraVPqrvcrFfxiFw.png" /><figcaption>Monthly Client Side Performance Result</figcaption></figure><p>Now regression detection becomes data-driven.</p><h4>CI/CD: Where the Real Value Appears</h4><p>Imagine integrating this framework into a pipeline:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*N_yLMtTDlfltBSGhG-W2ew.png" /></figure><p>A release introducing:</p><blockquote>LCP: 2.1s → 4.5s</blockquote><p>could immediately fail the pipeline. The problem is discovered before reaching production. Not after customers complain. That’s the difference between:</p><h4>Reactive Performance Engineering and <strong>Preventive Performance Engineering</strong></h4><p>Testing More Than Amazon Although the example uses Amazon:</p><blockquote>Shell</blockquote><blockquote>node index.js <a href="https://www.amazon.com/">https://www.amazon.com</a></blockquote><p>the framework works with virtually any public website.</p><blockquote>Shell</blockquote><blockquote>node index.js <a href="https://example.com/">https://example.com</a></blockquote><p>Simply change the URL and collect performance metrics for any page under test.</p><p>This makes it useful for:</p><ul><li>Enterprise applications</li><li>E-commerce platforms</li><li>Internal portals</li><li>Customer-facing websites</li><li>Performance validation in test environments</li></ul><h4>Final Thoughts</h4><p>In today’s digital world, organizations obsess over:</p><ul><li>Cloud Infrastructure</li><li>Kubernetes Clusters</li><li>Database Optimization</li><li>API Scalability</li></ul><p>But users care about only one thing:</p><blockquote><strong><em>“Does the page feel fast?”</em></strong></blockquote><p>Core Web Vitals transformed how we measure user experience.</p><p>Automation transforms how we protect it.</p><p><strong><em>By combining:</em></strong></p><blockquote>→ Node.js → Puppeteer → PerformanceObserver → Browser APIs →Automated Reporting</blockquote><p>we can continuously monitor user experience the same way we monitor server health.</p><p>Because performance isn’t something you optimize once.</p><p>It’s something you measure, track, protect, and improve every day.</p><h4>GitHub Repository</h4><p>🚀 Explore the complete implementation here:</p><p><strong>🔗 GitHub:</strong> <a href="https://github.com/priyak0711/Webpage_ClientSide_Performance_Metrics_POC">https://github.com/priyak0711/Webpage_ClientSide_Performance_Metrics_POC</a></p><h4>Series Recap</h4><p>✅ <strong>Part 1:</strong> Understanding User-Centric Performance Metrics</p><p>✅ <strong>Part 2:</strong> Practical Optimization Techniques to Improve Core Web Vitals</p><p>✅ <strong>Part 3:</strong> Building a Performance-First Culture</p><p>✅ <strong>Part 4:</strong> Automating Client-Side Performance Monitoring Using Node.js &amp; Puppeteer</p><blockquote>“You can’t optimize what you don’t measure, and you can’t protect what you don’t automate.<strong>” 🚀</strong></blockquote><p><strong>Priya Kothandaraman</strong><br><em>Sharing insights from real-world debugging and system optimization journeys!</em></p><p>#PerformanceEngineering #WebPerformance #CoreWebVitals #NodeJS #Puppeteer #PerformanceTesting #DevOps #SRE #FrontendPerformance #AutomationTesting #SoftwareEngineering #MediumArticle #PerformanceMonitoring #OpenSource #WebDevelopment</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0cf14449772d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>