<?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 Ramya Venkatesh on Medium]]></title>
        <description><![CDATA[Stories by Ramya Venkatesh on Medium]]></description>
        <link>https://medium.com/@ramya.iyer?source=rss-8a99087ab1a4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XfatCvt2MnaEV7D_r7XlMw.jpeg</url>
            <title>Stories by Ramya Venkatesh on Medium</title>
            <link>https://medium.com/@ramya.iyer?source=rss-8a99087ab1a4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:25:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ramya.iyer/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[A solution to the EV subsidy (FAME) problem]]></title>
            <link>https://medium.com/@ramya.iyer/a-solution-to-the-ev-subsidy-fame-problem-cdca0b8eac99?source=rss-8a99087ab1a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/cdca0b8eac99</guid>
            <category><![CDATA[india]]></category>
            <category><![CDATA[public-policy]]></category>
            <category><![CDATA[electric-vehicles]]></category>
            <dc:creator><![CDATA[Ramya Venkatesh]]></dc:creator>
            <pubDate>Fri, 16 Jun 2023 11:00:42 GMT</pubDate>
            <atom:updated>2023-06-16T11:00:42.011Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4fPhekphTEKNaGwSskYPnQ.jpeg" /></figure><p>Let’s have a quick look at what the FAME subsidy is, associated problems, and then dive into potential solutions.</p><p>FAME (Fast Adoption and Manufacturing of EVs) is a subsidy scheme introduced by the government in 2015. As the name suggests, the goal was to increase India’s adoption of Electric Vehicles. Why is this important for India? Because, the government of India has a goal of electrifying 80% of two-wheelers and 30% of private cars by <a href="https://www.livemint.com/industry/manufacturing/indias-fy23-electric-vehicle-sales-exceed-1-million-units-driven-by-government-incentives-and-robust-production-by-automakers-11681151789686.html">2030</a>. To give some perspective, India produced 15 million two-wheelers and 4 million private cars in FY 2023. This is an aggressive goal, and to achieve it, the Government of India introduced FAME for private vehicles in 2015 and extended it to public transport in 2019.</p><p>As with all subsidies, the intention of this one, too, was to reduce the price of goods to end consumers in order to boost sales, and eventually provide a ramp to keep the momentum going. Also, as with all subsidies, organisations need to follow certain rules to claim these subsidies. Very briefly, some conditions to avail these incentives were —</p><ul><li>Ex-factory price</li><li>Cap on maximum incentive as a percentage of the cost of the vehicle</li><li>Minimum technical eligibility with regard to performance</li><li>Localisation of parts used (percentage as notified by the Govt.)</li></ul><p>Some of these conditions were not met by companies, yet they were trying to avail the incentives. While this may seem like a vanilla case of fraud, the reasons why these companies did not abide by the rules set forth by the Govt. is also something to consider before penalizing them. One of the most important factors was the pandemic. Supply chains were impacted all across, and these EV manufacturers were forced to import certain parts and batteries to justify the ex-factory price. This pushed people to not abide by some of the rules. Now, they are in a situation where the sales have been made, but their subsidy claims are being rejected. What this means is that the working capital of these companies is drying up, and there is risk to business continuity. This can hamper India’s EV goals to a large extent. With current numbers of <a href="https://cleantechnica.com/2023/02/14/electric-two-wheelers-growing-fast-in-india/">4% of two-wheelers</a> and about <a href="https://auto.economictimes.indiatimes.com/news/only-about-10-15-of-total-pvs-to-be-electric-by-2030-against-30-target/94211375">2–3% of private cars</a> electrified, we have a long way to go. So, what can the Govt. do to ensure a positive outcome, keeping the 2030 goal in mind. Here are my thoughts —</p><ol><li>Since some of these companies are struggling with liquidity and working capital, a couple of things the Govt. could do to pump in some money —</li></ol><ul><li>Start a financial programme, for example provide loans to such companies, after careful assessment, to ensure business continuity. This will provide financial relief without digging into government funds, however the company will have to incur additional debt. This can be on the lines of ECGLS scheme. The assessment is critical to identify genuine cases. For example, if the ex-factory price was manipulated, this should not be accepted.</li><li>Give a part of the subsidy promised upfront, with revised agreement in terms of timeline and targets to amend the deviations taken by these OEMs which were against the policy rules. This will, however, have an impact on government funds. Assuming that the Govt. will be able to provide this from the previously allocated resources, it can be a viable and quicker option for OEMs.</li></ul><p>NOTE: Both of these financial support strategies will need to have strict monitoring and reporting to ensure that the Govt. is not wasting their resources on companies that are incompetent. Hence, the revised agreement should have specific expectations like switching to local suppliers as originally expected under a certain timeline, regular site visits and audits etc.</p><p>2. Once OEMs show progress and capability to manufacture EVs in this capacity, and once a certain percentage of sales number is reached, say 50% of the annual goal as set by the company, the rest of the subsidy amount for the vehicles sold can be paid out by the Govt. This restoration of support will be gradual and only after the conditions are met by the manufacturers.</p><p>3. Collect penalties and fines for violation of rules. This will serve to emphasize the importance of complying with Govt. rules and regulations.</p><p>4. If a company is not able to perform despite all the measures taken by the government, stop support of any kind as these are just bad and incompetent actors, and they will only cause more problems in the country’s EV journey and overall economy.</p><p>References</p><ul><li><a href="https://fame2.heavyindustries.gov.in/content/english/11_1_PolicyDocument.aspx">https://fame2.heavyindustries.gov.in/content/english/11_1_PolicyDocument.aspx</a></li><li><a href="https://finshots.in/archive/whats-wrong-with-ev-subsidies/">https://finshots.in/archive/whats-wrong-with-ev-subsidies/</a></li><li>Photo by <a href="https://unsplash.com/@michael_marais?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Michael Marais</a> on <a href="https://unsplash.com/s/photos/electric-vehicle?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cdca0b8eac99" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[On burnouts]]></title>
            <link>https://medium.com/@ramya.iyer/on-burnouts-24c362d55a8e?source=rss-8a99087ab1a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/24c362d55a8e</guid>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[wellness]]></category>
            <category><![CDATA[careers]]></category>
            <dc:creator><![CDATA[Ramya Venkatesh]]></dc:creator>
            <pubDate>Tue, 21 Mar 2023 10:31:02 GMT</pubDate>
            <atom:updated>2023-03-21T10:31:02.361Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bvmw8ZiXkeOJPTuBNRaF5g.jpeg" /></figure><p>Last month, I quit my job as Engineering Manager to take a break. It was a well-thought-out decision, and I’m extremely happy to have taken this step. I’m writing to share how I felt in the last few months at work, some signs that I ignored and some that I acted upon. If anyone is going through it, I just want to say that you’re not alone, and it’s going to be okay. I will not be talking about what might have caused the burnout. It could be a combination of factors, but I haven’t given that enough thought yet.</p><p>For a long time, I had heard and read about people burning out at work. It did not bother me much personally, because I had dealt with stress on a personal front. At that point, work was a welcome distraction. I also believed that I had a good work-life balance. So, burnout seemed far from reality to me. But, as it turns out, I wasn’t immune to it. I’ll start by saying that I wasn’t 100% sure I was burnt out. I’m still not sure. This part is hard to confirm because it’s a thin line where stress ends and burnout begins. They’re both characterised by exhaustion. If you’re the kind of person who likes to push limits, then your mind doesn’t want to give up easily and wants you to keep going. To be honest, I love pushing limits, I admire people who do it in different aspects of their life. You run for 20–30 minutes, and then decide you should do another 10, so you do it. It’s exhilarating. It’s similar with work. You’re in a situation you don’t know how to navigate, you get out of your comfort zone, figure it out and emerge victorious. The feeling is precious. The difference, though, was that I wasn’t feeling great after pushing myself after some point.</p><p>I started leading a team almost a couple of years ago, and I absolutely loved my job. The role is very different from that of an individual contributor. I felt like I had a chance to have a bigger impact in the organization. I honestly think it’s more rewarding.</p><p>Over time, I got the hang of my new responsibilities. However, for some reason (prolonged remote work is my best guess at this point), I was not getting the same kind of satisfaction as I did a few months ago. I thought I needed new challenges. So, I picked up other things along with my regular work, like improving the hiring process, or getting involved in campus hiring, or organising cultural events to name a few. I liked the experience I got, but it only left me more exhausted. This was possibly the first sign. There were other signs, which, I’m able to list down upon reflection —</p><ul><li>I had stopped preparing for my day/week. I love being prepared in general and knowing what my day looks like. Not doing so gives me anxiety. Even so, I stopped doing it. I could tell that I was being inefficient, but that changed nothing.</li><li>One-on-one meetings with my team members took more effort to prepare. I had come to really enjoy talking to people in a one-on-one discussion and realized the kind of impact I could have there. But over time, it started seeming like a chore. I would still go prepared (almost) every time I had to meet someone, but it took more from me every time.</li><li>Same thing happened with other meetings. I’m not a fan of (unnecessary) meetings. If I had to attend one, I liked to go with my points ready, and try to finish early. I stopped doing that in the last few months, and I hated the feeling.</li><li>Being cynical of happenings around me (even the good parts). While burnout may not be the only cause of this, I felt like the only lens I was left with was one of cynicism and negativity. This went heavily against my principles.</li><li>Started feeling like I wasn’t adding the kind of value I wanted to. I felt like I had lost the sense of purpose I started off with. This was the dealbreaker for me.</li></ul><p>After a lot of thought and many discussions with my husband, friends and mentors, I decided that it was time to pause and take a break. To be clear, I still love the role, and I know I will fit very well there. When I talked to a few people, I was told repeatedly that I was being harsh on myself, which could’ve been one of the reasons for the burnout. Irrespective, I was in the situation and I had to prioritise myself. I’m able to realize things on the hindsight, after I decided to take a break. If I had decided to continue, perhaps I would’ve told myself that this was just a phase. At this point, I’m glad I decided to give my mind and body the much-needed rest.</p><p>What’s next for me? I haven’t figured it out, and that is completely fine. All I know is that I enjoy enabling and empowering people, I believe that is key to success in any organization. I will get back to doing that when the time is right.</p><p>I’m happy to share more of my experience and have a chat with anyone who wants to. Feel free to reach out on Twitter https://twitter.com/Ramya_Venkatesh</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24c362d55a8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Things I will tell my younger self about being a developer]]></title>
            <link>https://medium.com/helpshift-engineering/things-i-will-tell-my-younger-self-about-being-a-developer-a2cf688a6f1d?source=rss-8a99087ab1a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2cf688a6f1d</guid>
            <category><![CDATA[mindset]]></category>
            <category><![CDATA[growth]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Ramya Venkatesh]]></dc:creator>
            <pubDate>Tue, 04 Jan 2022 13:34:18 GMT</pubDate>
            <atom:updated>2022-01-05T04:53:42.905Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xHa7TwoWhgTKb2sdNEWsQw.jpeg" /></figure><p>This year has been fascinating and challenging for me professionally. I have moved from being a senior developer to leading a team. It’s not something I thought I would do or get a chance to do this year. Nevertheless, opportunities opened up and I’m glad I took it.</p><p>It has been about 8–10 months since my daily routine at work changed. Over this period, I have realized a few things that I wish I had paid more attention to earlier. These are applicable even now, but it happens organically. How? My best guess is — without these aspects, it’s hard to be effective.</p><h4>Take initiatives</h4><ul><li>Don’t expect a top-down set of instructions. Sooner or later, it will lead to stagnation. Have your own opinions and suggestions. Talk to your manager about it.</li><li>Ideas are great. If you believe in an idea, put some effort to show its value. This part is hard and it’s easy to put off, but it’s crucial to communicate things in the right way. A plan of execution will go along way in convincing people.</li></ul><h4>Expect some level of uncertainty at all times</h4><ul><li>It’s not possible to have things go according to plan all the time. There are multiple factors out of your control - company priority changed, people left, and some are out of everyone else’s control too - Covid, remote work, you get the idea. Wanting 100% clarity all the time will drain you out, it’s not worth it. Be flexible instead, life becomes easier.</li><li>Observe and take note of patterns where this happens repeatedly, raise your concerns. Don’t hold back. It’s important that others know if the uncertainty is troubling you.</li></ul><h4>Question status quo</h4><ul><li>If you’re not progressing, talk about it. Once you do, it’s okay to take your time, think about the discussion and go back for a follow-up if you’re still not convinced. Scratch the surface every once in a while.</li></ul><h4>Share feedback and do it often</h4><ul><li>If you want something, ask for it. If you don’t like something, mention it. Good feedback will be appreciated. If you don’t share feedback, don’t expect things to change.</li><li>Once you do give feedback, it is essential to follow-up if you care for a resolution.</li></ul><h4>It’s all about having an impact</h4><ul><li>This is the most significant one. Don’t run behind the shiny new thing. Even a small task well done is better than an endless task that “sounded” interesting.</li><li>Talk to your manager about what value you’re adding to the team/project and how you can do better. Understand how to measure impact too, pick what works for you.</li></ul><p>I will admit that it can be taxing to keep all of this in mind, while also delivering projects, meetings, code reviews and a lot of other things you are already doing. At the very least, having a flexible mindset goes a long way. Once I accepted that these are the things that will help me, it became a tad bit easier.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2cf688a6f1d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/helpshift-engineering/things-i-will-tell-my-younger-self-about-being-a-developer-a2cf688a6f1d">Things I will tell my younger self about being a developer</a> was originally published in <a href="https://medium.com/helpshift-engineering">helpshift-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Improving communication — being assertive and polite]]></title>
            <link>https://medium.com/@ramya.iyer/improving-communication-being-assertive-and-polite-675858fc9516?source=rss-8a99087ab1a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/675858fc9516</guid>
            <category><![CDATA[communication]]></category>
            <category><![CDATA[assertiveness]]></category>
            <dc:creator><![CDATA[Ramya Venkatesh]]></dc:creator>
            <pubDate>Sun, 31 Oct 2021 09:29:20 GMT</pubDate>
            <atom:updated>2021-10-31T11:04:37.353Z</atom:updated>
            <content:encoded><![CDATA[<h3>Improving communication — being assertive and polite</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsAvVhQCYGTswwhuE3j7OA.jpeg" /></figure><p>There have been multiple times, work or otherwise, when I have asked myself this question- Did I come across as being rude? It mostly happens when I disagree with something, and I’m trying to get my point across.</p><p>I try to not let this bother me but sometimes I wonder if others feel this too. I’ve asked for feedback and very rarely have I got a ‘Yes, you were rude!’. In most cases, it’s not even noticeable. In some cases, it has come across as confidence(yay!). Even after all of this, I tend to overthink, mostly out of curiosity.</p><p>In my experience, I have seen people(mostly men) talk far worse and use a lot harsher tone. I would even say it’s natural to them. It would be great to know if others think about this too. Probably not as much. My data points aren’t a lot, so I can’t tell for sure.</p><p>I have similar thoughts around how people perceive concerns being raised by men vs women. My theory is that women raising concerns comes across as complaining, not so much for men because the world is wired to men questioning things all the time. I’m not saying it’s a bad thing but when compared with the other gender, it’s just unfair. Again, it’s a theory based on observations, no concrete data points.</p><p>Either way, I wonder if any of this has to do with decades of conditioning and an environment where women are supposed to be nice(er) and not ask too many questions. As much as I don’t want to let that affect me, the damage is done. All I can do is fix that now. There is a daunting feeling left after a difficult conversation, and then there is further struggle to not overcompensate by doing or saying something I didn’t want to in the first place.</p><p>Some tricks that have worked for me in such situations-</p><ul><li>Talk to someone you trust, tell them both sides of the conversation and get their unbiased opinion. Be open to feedback and change.</li><li>Talk to the person directly. This has worked wonders for me. However, decide for yourself if their opinion makes sense. They are after all still opinions. Keep what is useful, discard the trash.</li><li>Look back at the conversation to get a closer look at what made you feel this way in the first place. Was it your volume? Was it your tone? If there is something that can be fixed here, work on it.</li><li>Shake it off and move on!</li></ul><p>Some things to avoid-</p><ul><li>Doubting yourself to a point where it&#39;s no longer useful. Introspection is great until it becomes counterproductive.</li><li>Spending too much time on analyzing this because it can be a frequent occurrence. You don’t want to dampen your spirit. Take a few minutes, maybe 10–15, not more. <br>Note: Over analyzing has its benefits, like you may end up writing a blog about it!</li></ul><p>You can be assertive and polite at the same time, I know people who do this effectively. Observe what they’re getting right and try to copy. Communicating(written or verbal) effectively is super important and I’m constantly trying to improve different aspects of it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=675858fc9516" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to benchmark a Kafka consumer that makes async HTTP requests?]]></title>
            <link>https://medium.com/helpshift-engineering/how-to-benchmark-a-kafka-consumer-that-makes-async-http-requests-7d7134d62f57?source=rss-8a99087ab1a4------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d7134d62f57</guid>
            <category><![CDATA[kafka]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[benchmarking]]></category>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[clojure]]></category>
            <dc:creator><![CDATA[Ramya Venkatesh]]></dc:creator>
            <pubDate>Wed, 16 Oct 2019 04:08:04 GMT</pubDate>
            <atom:updated>2019-10-16T04:08:04.375Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I want to share my learnings from a task that we performed recently at Helpshift to benchmark a system which consumes events from Kafka and makes async HTTP requests based on information in the payloads.</p><p>Before we begin, just a quick note on the two types of HTTP requests. Async HTTP requests are different from sync HTTP requests in that async requests do not block the caller, the responses can be handled via callbacks. Sync requests on the other hand are blocking. So, it’s simpler to calculate the latency of systems that makes sync requests- just check how long the request took, while for systems that make async requests, we need to keep track of when the request was triggered and when the response was received. The trick that we used was to send a timestamp in the request and use that in the response callback to calculate how long it took.</p><p>With that context set, I’ll be covering these things:</p><ol><li>The system</li><li>Goals</li><li>Setup</li><li>The benchmark process</li><li>Conclusions</li></ol><h3>The system</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*7BKRdqkEkccEAwX1CU1XaA.png" /></figure><p>In a gist, the consumer upon receiving events, would extract information required to make the HTTP request and handles the response via callbacks. We have used Lee Hinman’s <a href="https://github.com/dakrone/clj-http">clj-http</a> client library.</p><h3>Goals</h3><p>We had 2 basic goals:</p><ol><li>Find the acceptable latency of the consumer with expected throughput</li><li>Identify the optimal HTTP client config</li></ol><p>Simply put, we wanted to utilize the resources on the consumer node as best as possible, and needed to understand the number of events we would process per second on the planned hardware configuration.</p><h3>Setup and terminology</h3><p>It required 3 nodes:</p><ol><li>Producer node: This had a traditional datastore component and a Kafka producer component. The datastore was required to dump some sample data, that the consumer would fetch and use it to make async HTTP requests.<br>Note: In real world, the datastore is independent of the producer (not on the same node). Since the intent of the benchmark was to test against a controlled flow of events, it didn’t matter that the producer and datastore were on the same node.</li><li>HTTP endpoint provider (mocked): A node that has a simple HTTP server and some sample routes. The endpoint provider performs operations on data in an in-memory database with randomised response times based on observations in production.</li><li>Consumer node: Node with the system under test running.</li></ol><p>Apart from this, we also have Graphite as our primary monitoring platform, we used this to plot consumer as well as JVM metrics.</p><h3>The benchmark process</h3><p>Once we had all the nodes ready, the next thing was to run the benchmarking code with varying RPS (rate of events per second) and HTTP client config to get the most efficient numbers. We started with 500 RPS. We throttled the events being produced using Bruno Vecchi’s <a href="https://github.com/brunoV/throttler">throttler</a>. Here’s an excerpt:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85779449146d3e306b5e91677fccfcb4/href">https://medium.com/media/85779449146d3e306b5e91677fccfcb4/href</a></iframe><h4>Initial Run</h4><p>For the first run, we started with this http config on the consumer-</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df17c4466b42cb8a463ff5443e6182d6/href">https://medium.com/media/df17c4466b42cb8a463ff5443e6182d6/href</a></iframe><p>After the first run, we noticed the response time for HTTP requests was an unremarkable 5s. We have an SLA of 5s for the entire roundtrip, including internal processing of the response, so 5s was unacceptable. The consumer lag of 1.8K, though not alarming, was a bit on the higher side. On doing some basic checks, we realised that this was due to one endpoint in the mocked endpoint provider that was deliberately made to timeout (added for heterogeneity of responses). Even though the endpoints were picked up at random, there was a certain pattern to the randomness which caused this particular endpoint to be picked up more often in the runs.</p><p>For the next run, we removed this endpoint and the response time quickly went below 2s. After this, we tried increasing the RPS further to 700, however incoming requests on the mocked server were maxing out at 600 RPS. We suspected three things:</p><ol><li>HTTP connection requests were getting piled up at http-client due to limited number of threads and this created back pressure.</li><li>The in-memory DB on mocked server was getting overloaded because all requests were populating it and none were deleting any data, so the same requests were taking longer to fetch data that was growing linearly in size and since we had set a timeout of 5s, a lot of requests started timing out and this eventually created back pressure.</li><li>The throttler library was not able to handle this level of throttling.</li></ol><h4>Debugging</h4><p>To eliminate #1, we decided to review Pool stats published by the Apache Commons HTTP library. These stats are a rich source of information on metrics like Available Connections, Leased Connections, Pending Connections etc. What we were interested in was the number of pending connections, accessible via <a href="https://hc.apache.org/httpcomponents-core-ga/httpcore/apidocs/org/apache/http/pool/PoolStats.html#getPending()">.getPending()</a>. This is a useful stat for having graceful shutdown as well, since you don’t want to stop a node which has pending requests piled up.</p><p>We plotted the number of pending connections on HTTP client. We noticed that there were no pending connections, so this was ruled out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L_U2MQrsxIq4PZOY07XQRw.png" /><figcaption>No. of pending HTTP client connections</figcaption></figure><p>To eliminate #2, even though it was highly unlikely this would be the cause for the no. of incoming requests on consumer to plateau, We added a middleware that would clean up the in-memory DB after every 10K requests. We also removed an endpoint that was returning a large response on purpose. As expected, nothing changed. We kept the change though, cleanup of in-memory DB seemed logical considering the benchmarking would run for hours eventually.</p><p>The only thing left was to remove the library and introduce custom throttling. We did this and it worked. We replaced the throttler with a configurable parallel execution of code (using Clojure’s <a href="https://clojuredocs.org/clojure.core/pmap">pmap</a>) that produced events. Code looked something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/830cd0de710a2ee6b3c1f17a501681a8/href">https://medium.com/media/830cd0de710a2ee6b3c1f17a501681a8/href</a></iframe><h4>Tuning http-client parameters</h4><p>Once the throttled events production problem was out of the way, we noticed that as the no. of requests increased, the response time was going over 5s, even though the timeouts were set at 5s. How was this possible? From graphs, we also noticed that the response time was increasing gradually over time. On further research, we realised that the connections were getting queued up by the connection manager. This meant that in order to maintain the system invariant(processing an event should take no more than 5s) we had to:</p><ul><li>Timeout the thread waiting for a connection to open up (because from the point of view of the system, this was time spent processing the event). Note that this is different from <a href="http://dakrone.github.io/clj-http/clj-http.core.html#var-request">conn-timeout</a> which times out when the connection manager has allocated a connection, but the endpoint provider could not be reached within the specified time.</li><li>Ensure that we don’t pull events off the queue if connections are not available</li></ul><p>To fix the problem of threads waiting forever for the http-client connection manager to provide a connection, we introduced ‘conn-request-timeout’ in the HTTP config and ran the benchmark again. Much better performance, the lag also reduced to under 1K. This was an acceptable number, but the lag, even though small, had to be debugged. A lot of debugging was centered around checking how clj-http client works and checking the benchmarking environment setup.</p><p>In the benchmarking environment we had setup, the endpoints being hit were limited(as compared to what would be in production) and the <a href="http://dakrone.github.io/clj-http/clj-http.conn-mgr.html">default-per-route</a> was configured keeping in mind that we had an upper limit on the number of requests we would make to a single endpoint in parallel. This was adding a restriction on the number of simultaneous connections that can be made per route. Increasing this value equal to the number of threads reduced the lag considerably as it used up threads that were lying idle earlier. We also wanted to max out requests being made from the system under test.</p><h4>Simulating production traffic</h4><p>Now, we started benchmarking with realistic RPS to get the figures that we would expect in production. Since our expected traffic on nodes in this subsystem was 60 RPS, we tried with this. Also, since this will be a new service and we don’t expect traffic on this service immediately, we reduced the number of threads in HTTP client config to 20 and increased default-per-route to 20(to avoid problem described above). With this, the HTTP response time was under 600ms, the consumer lag was about 100.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*7MCRvkC0NQBmhQhvlcKttw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GW8MBl4hJqoc14xIvpij5Q.png" /></figure><p>So, putting the numbers together-</p><p>Average processing time: 600ms<br>No. of parallel requests: 20<br>Average consumer lag: 100<br>Requests are picked up in batches of 20, so a new event will be processed in the 5th batch(100 / 20)<br>Wait time in queue = 4 * 600ms = 2.4s<br>Processing time for the new event = 600ms<br>Total processing time = 2.4s + 600ms = 3s</p><p>3s was acceptable for us. Increasing the RPS proportionately increased the lag, which is an expected side effect.</p><h3>Conclusions</h3><p>Some things to keep in mind while benchmarking consumer making async HTTP requests-</p><ol><li>If you’re benchmarking response time of async (or sync) HTTP requests, to keep things realistic, either have a middleware that adds random latency per route in the HTTP endpoint provider or if you have an endpoint that is made to timeout, have a probability selection instead of picking the routes randomly. This will avoid running into situations where the response time is unexpectedly high due to the timeout route being picked more often.</li><li>It is useful to have a good mix of HTTP endpoints(high/low response times, for example) if you want to play around and benchmark client configurations on a per route basis.</li><li>Ensure your internal services are not the bottlenecks- a lot of times we realised that having too many services on the same node was causing slowdown. Have clear boundaries between these services to avoid one overwhelming the other. Debugging becomes simpler.</li><li>Apart from the consumer metrics, capturing JVM metrics(in case of a Java application) like memory usage, thread count etc., can also be useful to see which part of the application is slowing down the process.</li></ol><p>I want to extend my gratitude to my team that helped me in this benchmarking process- <a href="https://medium.com/u/a0b9807fdf5d">Pardeep Shergill</a>, <a href="https://medium.com/u/9b8bbe72783c">Vedang Manerikar</a>, <a href="https://medium.com/u/481ed0a63477">Dinesh Chhatani</a> , <a href="https://medium.com/u/7d314065dc61">Neha Mishra</a>, <a href="https://medium.com/u/6f5c3feb1aad">Samuel Chase</a> and <a href="https://medium.com/u/4647487d8947">Rubal Jabbal</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d7134d62f57" width="1" height="1" alt=""><hr><p><a href="https://medium.com/helpshift-engineering/how-to-benchmark-a-kafka-consumer-that-makes-async-http-requests-7d7134d62f57">How to benchmark a Kafka consumer that makes async HTTP requests?</a> was originally published in <a href="https://medium.com/helpshift-engineering">helpshift-engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>