<?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 Hardik Khanesa on Medium]]></title>
        <description><![CDATA[Stories by Hardik Khanesa on Medium]]></description>
        <link>https://medium.com/@hardikkhanesa?source=rss-82624d31d729------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*zNZcRzh9WwccuQ8Jze6Jwg.jpeg</url>
            <title>Stories by Hardik Khanesa on Medium</title>
            <link>https://medium.com/@hardikkhanesa?source=rss-82624d31d729------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 15:00:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hardikkhanesa/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[Benchmarking in Node.js with `perf_hooks`]]></title>
            <link>https://medium.com/@hardikkhanesa/benchmarking-in-node-js-with-perf-hooks-202467d287e9?source=rss-82624d31d729------2</link>
            <guid isPermaLink="false">https://medium.com/p/202467d287e9</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[benchmarking]]></category>
            <category><![CDATA[benchmark]]></category>
            <category><![CDATA[optimization]]></category>
            <dc:creator><![CDATA[Hardik Khanesa]]></dc:creator>
            <pubDate>Fri, 17 May 2024 06:09:32 GMT</pubDate>
            <atom:updated>2024-05-17T06:40:54.341Z</atom:updated>
            <content:encoded><![CDATA[<p>Performance is a critical aspect of software development, especially when building scalable and efficient applications. Node.js, known for its non-blocking, event-driven architecture, provides built-in tools to help developers measure and optimize their code. One of the most powerful tools for this purpose is the `perf_hooks` module. In this blog, we will explore how to use `perf_hooks` for benchmarking in Node.js and why it is essential for your development toolkit.</p><figure><img alt="Becnhmarking" src="https://cdn-images-1.medium.com/max/1024/1*wnBa0_dfvNcuRVvZzvSa1Q.jpeg" /></figure><h3><strong>What is `perf_hooks`?</strong></h3><p>The `perf_hooks` module is part of Node.js’s core library and provides an API for measuring performance. It leverages the Performance Timing API, similar to the one available in browsers, allowing developers to capture high-resolution timestamps and measure the duration of operations within their applications.</p><h3><strong>Why Benchmarking Matters</strong></h3><p>Benchmarking is the practice of measuring the performance of various aspects of your application to identify bottlenecks and areas for improvement. Effective benchmarking can lead to:</p><p>1. <strong>Optimized Code</strong>: Identify slow parts of your code and optimize them for better performance.<br>2. <strong>Resource Management</strong>: Ensure your application uses resources efficiently, reducing costs and improving user experience.<br>3. <strong>Scalability</strong>: Prepare your application to handle increasing loads without degradation in performance.</p><h3>Getting Started with `perf_hooks`</h3><p>To start using `perf_hooks`, you need to import it into your Node.js application:</p><pre><br>const { performance, PerformanceObserver } = require(‘perf_hooks’);</pre><h3><strong>Measuring Execution Time</strong></h3><p>The most basic use of `perf_hooks` is to measure the execution time of a function or a block of code. Here’s an example:</p><pre><br>const { performance } = require(‘perf_hooks’);<br><br>function someFunction() {<br> const start = performance.now();<br> // Code you want to measure<br> for (let i = 0; i &lt; 1e6; i++) {}<br> const end = performance.now();<br> console.log(`Execution time: ${end - start} milliseconds`);<br>}<br><br>someFunction();</pre><h3><strong>Using Performance Marks and Measures</strong></h3><p>For more complex applications, you might want to measure different parts of your code. `perf_hooks` allows you to create custom performance marks and measures:</p><pre><br><br>performance.mark(&#39;A&#39;);<br>// Code block A<br>for (let i = 0; i &lt; 1e6; i++) {}<br>performance.mark(&#39;B&#39;);<br><br>performance.mark(&#39;C&#39;);<br>// Code block B<br>for (let i = 0; i &lt; 1e6; i++) {}<br>performance.mark(&#39;D&#39;);<br><br>performance.measure(&#39;A to B&#39;, &#39;A&#39;, &#39;B&#39;);<br>performance.measure(&#39;C to D&#39;, &#39;C&#39;, &#39;D&#39;);<br><br>const measures = performance.getEntriesByType(&#39;measure&#39;);<br>measures.forEach((measure) =&gt; {<br>  console.log(`${measure.name}: ${measure.duration} milliseconds`);<br>});</pre><h3><strong>Observing Performance Entries</strong></h3><p>For more advanced usage, you can observe performance entries in real-time using the `PerformanceObserver`:</p><pre>const observer = new PerformanceObserver((list) =&gt; {<br>  const entries = list.getEntries();<br>  entries.forEach((entry) =&gt; {<br>    console.log(`${entry.name}: ${entry.duration} milliseconds`);<br>  });<br>});<br><br>observer.observe({ entryTypes: [&#39;measure&#39;] });<br><br>performance.mark(&#39;start&#39;);<br>// Code to benchmark<br>setTimeout(() =&gt; {<br>  performance.mark(&#39;end&#39;);<br>  performance.measure(&#39;start to end&#39;, &#39;start&#39;, &#39;end&#39;);<br>}, 1000);</pre><h3><strong>Real-world Application</strong></h3><p>In a real-world scenario, you can use `perf_hooks` to measure the performance of critical parts of your application, such as database queries, API requests, or heavy computations. By continuously monitoring these metrics, you can ensure your application remains performant as it evolves.</p><h3><strong>Conclusion</strong></h3><p>Benchmarking is an essential practice for any serious developer, and Node.js’s `perf_hooks` module provides a powerful and flexible way to measure and optimize your code. By understanding and utilizing this tool, you can improve your application’s performance, leading to better resource management and an enhanced user experience.</p><p>Remember, in the world of software development, what gets measured gets improved. So start benchmarking your Node.js applications today with `perf_hooks` and take your performance optimization to the next level.</p><p>— -</p><p>Feel free to leave your comments and share your experiences with `perf_hooks` and performance benchmarking in Node.js. Happy coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=202467d287e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Salary Increased 5 times in 2 years — Here is How I Did It]]></title>
            <link>https://medium.com/@hardikkhanesa/my-salary-increased-5-times-in-2-years-here-is-how-i-did-it-7a2c3ea13bff?source=rss-82624d31d729------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a2c3ea13bff</guid>
            <category><![CDATA[salary]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[job-interview]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[jobs]]></category>
            <dc:creator><![CDATA[Hardik Khanesa]]></dc:creator>
            <pubDate>Thu, 24 Nov 2022 04:54:39 GMT</pubDate>
            <atom:updated>2023-07-20T16:22:00.687Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*-FjEpfzzzvnjKwIt" /></figure><h3>My Salary Increased 5 times in 2 years — Here is How I Did It</h3><p>My income has increased <strong>5 times </strong>in the last<strong> two years</strong> of my career while being an ordinary full stack developer .</p><p>I joined one small technology software company in 2020 as an Software engineer after graduating from college. when i joined them my salary was “x” INR , i knew i was underpaid at that time .</p><p>I was having multiple job offers which was paying 50% more than that salary i was getting at that time but i chosen start up over mnc. I got some hint from seniors regarding learning matters than a company name .</p><p>I jumped and got promoted multiple times in my tenure of 1 year and 11 month in first company. i got 3 salary hike and two position upgrade in this tenure.</p><p>But still i was feeling i was underpaid according to the market. Although i got 2.5 x when i was joined.</p><p>Exposure i got from this startup is like …</p><ul><li><strong>React.js</strong></li><li><strong>Node.js</strong></li><li><strong>Python</strong></li><li><strong>Django</strong></li><li><strong>Rest APIs</strong></li><li><strong>Aws EC2</strong></li><li><strong>Aws lambda</strong></li><li><strong>Nginx</strong></li></ul><p>This learnings were awesome .</p><p>I started searching in comparative sights like ambitionbox, Glassdoor for competitive salary of the position of Full stack Developer.</p><p>I started searching outside locality where i was staying , In my area companies where not more employee centric that i knew from my past 2 years . I started searching job in indian IT industy hubs called Banglore,Pune .</p><p><strong>I received offer of 5.5x from my initial salary and 2.2x from my last salary.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/0*f-RB--xK8a2tl01a" /></figure><p>Here are the key factors that over past two years have enabled me to achieve this.</p><ol><li>Prepare for interviews wisely</li><li>Change jobs in specific span</li><li>Learning from failures and rejection</li><li>Keep exploring trending technologies</li></ol><h3><strong>Prepare for interviews wisely</strong></h3><p>In SDE roles ,basically sde 1 and sde 2 roles generally depends on how much you can grasp and explored in recent years. Learning technologies , implementing real world problems , problem solving and approching skills.</p><p>Generally in tech , Interview depends on Problem solving skills, Technology you know , Knowledge level in diversify sections of Development.</p><p>I have solved some problems over leetcode, hackerrank which helped me for this. Also i used to read Geeksforgeeks for interview prep.</p><h3><strong>Change jobs in specific span</strong></h3><p>In tech , Specifically i have analyzed regarding market that, companies trust employees who stays at least more than 1 or 1.5 year in a same company. 2 year is preffered for same company. So i have made a plan accordingly for that.</p><p>I used to read articles and posts regarding hikes we got after switch and spans they spent over companies.</p><p>There are some benifits of job change.</p><ul><li>You can get exposure of different technologies , different methodologies of software development processes.</li><li>You get paid well according to the market standard.</li><li>Even if you get good learning and good pay in same company you can stay for it, I just spoken 2 years because its a general practice people do in the market.</li></ul><h3><strong>Learning from failures and rejection</strong></h3><ul><li>I applied for amazon after 1.5 year in first company ,but some how not able to solve one problem in 3rd tech round .</li><li>I again started prep for new job , Eat- sleep — repeat on learnings on technologies i knew , geeksforgeeks , clean code ,system design ,design patterns,etc.</li></ul><h3><strong>Keep exploring trending technologies</strong></h3><ul><li>I used to follow twitter , Linkedin ,Medium ,Hackernews,Medium for exploring tech news and trending in the market .</li><li>I used to learn and do courses over udemy .</li></ul><p>You can follow me on <a href="https://twitter.com/hardik_khanesa">twitter</a> , <a href="https://www.linkedin.com/in/hardik-khanesa/">Linkedin </a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a2c3ea13bff" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Html in servlet]]></title>
            <link>https://medium.com/@hardikkhanesa/html-in-servlet-2a335e1e4d80?source=rss-82624d31d729------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a335e1e4d80</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[jsp]]></category>
            <category><![CDATA[servlet]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Hardik Khanesa]]></dc:creator>
            <pubDate>Fri, 22 Mar 2019 08:52:52 GMT</pubDate>
            <atom:updated>2020-09-10T04:29:18.614Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to use HTML in Java Servlet ?</h3><blockquote>Starting of jsp</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b041d4be8745c346887ea4b220bd397/href">https://medium.com/media/5b041d4be8745c346887ea4b220bd397/href</a></iframe><p>You can see here I have created a simple servlet for add to input numbers.</p><p>For output, I have used PrinterWriter Class.</p><p>In out object, I have added some HTML code which is used as shown in the code given.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a335e1e4d80" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[java servlet learning]]></title>
            <link>https://medium.com/@hardikkhanesa/java-servlet-learning-8f62f15499cc?source=rss-82624d31d729------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f62f15499cc</guid>
            <category><![CDATA[eclipse]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[servlet]]></category>
            <dc:creator><![CDATA[Hardik Khanesa]]></dc:creator>
            <pubDate>Tue, 01 Jan 2019 03:23:55 GMT</pubDate>
            <atom:updated>2020-09-10T04:35:47.736Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to start with Servlets?</h3><p>First connect tomcat to DemoApp.(Don’t forget to add web.xml while creating a project.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j2cOu1es3N9Rg-diHq0A9A.png" /></figure><p>Server tomcat.</p><h3><strong>Src DemoClass:</strong></h3><pre>package com.telusko;</pre><pre>import java.io.IOException;</pre><pre>import java.io.PrintWriter;</pre><pre>import javax.servlet.RequestDispatcher;</pre><pre>import javax.servlet.ServletException;</pre><pre>import javax.servlet.http.HttpServlet;</pre><pre>import javax.servlet.http.HttpServletRequest;</pre><pre>import javax.servlet.http.HttpServletResponse;</pre><pre>public class DemoClass extends HttpServlet</pre><pre>{</pre><pre>public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException, ServletException</pre><pre>{</pre><pre>int i=Integer.parseInt(req.getParameter(&quot;num1&quot;));</pre><pre>int j=Integer.parseInt(req.getParameter(&quot;num2&quot;));</pre><pre>int k=i+j;</pre><pre>req.setAttribute(&quot;k&quot;, k);</pre><pre>RequestDispatcher rd =req.getRequestDispatcher(&quot;sq&quot;);</pre><pre>rd.forward(req,res);</pre><pre>}</pre><pre>}</pre><h3><strong><em>Src SqServlet:</em></strong></h3><pre>package com.telusko;</pre><pre>import java.io.IOException;</pre><pre>import java.io.PrintWriter;</pre><pre>import javax.servlet.http.HttpServlet;</pre><pre>import javax.servlet.http.HttpServletRequest;</pre><pre>import javax.servlet.http.HttpServletResponse;</pre><pre>public class SqServlet extends HttpServlet {</pre><pre>public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException</pre><pre>{</pre><pre>int k=(int)req.getAttribute(&quot;k&quot;);</pre><pre>k=k*k;</pre><pre>PrintWriter out=res.getWriter();</pre><pre>out.println(&quot;result is &quot;+k);</pre><pre>}</pre><pre>}</pre><h3><strong>Src Index.html</strong></h3><pre>&lt;!DOCTYPE html&gt;</pre><pre>&lt;html&gt;</pre><pre>&lt;body&gt;</pre><pre>&lt;form action=<em>&quot;add&quot;</em> method=<em>&quot;get&quot;</em>&gt;</pre><pre>Enter 1st No.&lt;input type=<em>&quot;text&quot;</em> name=<em>&quot;num1&quot;</em>&gt;&lt;br/&gt;</pre><pre>Enter 2nd No.&lt;input type=<em>&quot;text&quot;</em> name=<em>&quot;num2&quot;</em>&gt;&lt;br/&gt;</pre><pre>&lt;input type=<em>&quot;submit&quot;</em>&gt;</pre><pre>&lt;/form&gt;</pre><pre>&lt;/body&gt;</pre><pre>&lt;/html&gt;</pre><h3><strong>Src Web.xml</strong></h3><pre>&lt;?xml version=<em>&quot;1.0&quot;</em> encoding=<em>&quot;UTF-8&quot;</em>?&gt;</pre><pre>&lt;web-app xmlns:xsi=<em>&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</em> xmlns=<em>&quot;http://xmlns.jcp.org/xml/ns/javaee&quot;</em> xsi:schemaLocation=<em>&quot;http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd&quot;</em> id=<em>&quot;WebApp_ID&quot;</em> version=<em>&quot;4.0&quot;</em>&gt;</pre><pre>&lt;servlet&gt;</pre><pre>&lt;servlet-name&gt;abc &lt;/servlet-name&gt;</pre><pre>&lt;servlet-class&gt;com.telusko.DemoClass&lt;/servlet-class&gt;</pre><pre>&lt;/servlet&gt;</pre><pre>&lt;servlet-mapping&gt;</pre><pre>&lt;servlet-name&gt;abc&lt;/servlet-name&gt;</pre><pre>&lt;url-pattern&gt;/add&lt;/url-pattern&gt;</pre><pre>&lt;/servlet-mapping&gt;</pre><pre>&lt;servlet&gt;</pre><pre>&lt;servlet-name&gt;pqr &lt;/servlet-name&gt;</pre><pre>&lt;servlet-class&gt;com.telusko.SqServlet&lt;/servlet-class&gt;</pre><pre>&lt;/servlet&gt;</pre><pre>&lt;servlet-mapping&gt;</pre><pre>&lt;servlet-name&gt;pqr&lt;/servlet-name&gt;</pre><pre>&lt;url-pattern&gt;/sq&lt;/url-pattern&gt;</pre><pre>&lt;/servlet-mapping&gt;</pre><pre>&lt;/web-app&gt;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f62f15499cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>