<?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 Shripati Bhat on Medium]]></title>
        <description><![CDATA[Stories by Shripati Bhat on Medium]]></description>
        <link>https://medium.com/@shripatibhat?source=rss-b8d2c65eef10------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Tn0fwPHmNkxhvzh7l27M9g.jpeg</url>
            <title>Stories by Shripati Bhat on Medium</title>
            <link>https://medium.com/@shripatibhat?source=rss-b8d2c65eef10------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 03:22:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shripatibhat/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[The Arjuna Fish Eye Fallacy]]></title>
            <link>https://shripatibhat.medium.com/the-arjuna-fish-eye-fallacy-4e31786a22b7?source=rss-b8d2c65eef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e31786a22b7</guid>
            <category><![CDATA[problem-solving]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[personal-growth]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[jobs]]></category>
            <dc:creator><![CDATA[Shripati Bhat]]></dc:creator>
            <pubDate>Mon, 25 May 2026 04:31:00 GMT</pubDate>
            <atom:updated>2026-05-25T04:31:00.632Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8fj1Xqf4coyE7M_p06pa3w.png" /></figure><p>After working with over 250 interns in the past decade, I was recently talking to a group of 3rd and 4th year engineering students in my alma mater. And I realised the anxieties that we started talking about — “<strong>AI taking up jobs</strong>”, “<strong>how to structure my resume</strong>”, etc were not the real issues. The underlying problem in everyone’s mind was a fallacy so deep rooted in our education system and the way of looking at challenges in life.</p><p>Coincidentally, I was reading about formal and informal fallacies in my pursuit of understanding arguments better. Fallacies are logical flaws in reasoning which make the whole argument incorrect. A lot of students mistake the method of doing a few projects, completing courses for becoming an engineer. And the problems we were discussing were a perfect example of <strong>means-end inversion fallacy</strong> where the method (of becoming an Engineer) gets mistaken for the goal itself (getting an Engineering degree and a job).</p><p>This fallacy has a familiar shape, the one we have actually been celebrating for centuries. We have all heard of the story from the epic Mahabharata about how Arjuna was focussed on the eye of the fish fixed at the centre of a rotating wheel while he was trying to aim at the fish [1]. This focus has often been touted as the epitome of avoiding distractions to focus on your goal.</p><p>Just like Arjuna’s single-minded focus on the fish eye, our education system has trained students to focus narrowly on completing courses and projects, completing the engineering degree, and getting a job. By the time an interviewer shortlists resumes out of a STEM batch of 750–1000 from a college, interviews a set of 40–50 candidates, all resumes have the same Library Management and AI Chatbot Project on their resume.</p><p>The problem with this is that the true concept of engineering is left far behind in this version of the goal. Engineering is the art of solving problems by using scientific principles and creative thinking to create tangible real world solutions to a problem out of abstract ideas. In my experience of working with interns across different tier colleges and cities, the ones that stood out weren’t the ones with the highest CGPA but ones who walked in with a working app they had built around something they actually could talk about.</p><p>The students who are graduating today are faced with a reality different than when I entered my engineering college almost 2 decades ago. Today, boilerplate code and most business logic can be generated with AI models. There are tools to create designs, websites, and even entire applications.</p><p>So there are a lot more options (<strong>and not fewer</strong>) for true Engineers to get out there and create tangible real world solutions to solve problems. Students who stop waiting for a degree/certification and start learning these right in their first year have a lot to gain in terms of mindset, thinking, and even experience. And in turn this mindset and experience will make students stand out during their interviews and help them get placed.</p><p>At the end of the day, businesses are not going to stop hiring Engineers altogether. In the core Software Development Engineer roles at least, businesses have always looked for this mindset and experience to understand a given real world problem and come up with a solution, an approach to solving it using AI tools at hand. There will certainly be newer roles [3] that will get created which we are already seeing in terms of Forward Deployed Engineers, AI Engineers, Product Engineers, AI Ethicists, MLOps/LLMOps Engineers and many more. Industry leaders like Anthropic, OpenAI, Palantir, and many more are demonstrating this fact through their hiring processes.</p><p>Arjuna’s Fish Eye target is a great analogy to execute towards a set goal but only when the goal is set by a wise coach like Drona. In its absence students must actively review their goals with industry mentors, professors, rather than picking the default target handed to them from the education system. I have often seen students miss the forest for the trees due to the obsession with landing a job without learning and understanding the role, what the job needs them to do, and what they really love doing. Instead of waiting for systems to change, here is a practical playbook to build real engineering experience along with your degree.</p><ol><li><strong>LEARN </strong>— After 2nd semester — Learn to build end-to-end applications using AI tools. Here focus on coming up with a novel problem related to something that you are most passionate about. It can be sports, music, travel, reading, etc. This is the essential part of Engineering to come up with an incremental or genuinely novel problem to an existing system and using AI tools to build this gives you confidence in terms of seeing a live successful transformation of idea to reality. Do this at a demo scale of a few data points and don’t focus so much on making this fully self service for all the consumers. This is called a Proof of Concept (PoC). Create a digital portfolio with as many details as you deem fit — put your code on GitHub, Demo on LinkedIn, etc.</li><li><strong>ENGAGE </strong>— After 3rd semester — Talk to roughly 25–50 strangers (read about Steve Blank’s Customer Development framework[2]) about what you thought was the problem, your view of the solution, and show them the application you have built. Do this in the space where you will find people with similar interests as you. Go to a gym or stadium for a sports related solution you created, a library for a reading one and so on. I understand that for a few students this may be the most difficult part — so try to do it at least amongst your friends, neighbours with similar interests instead of complete strangers. A very critical thing to do here is to collect feedback on your idea, the approach of your solution and their views on whether they also relate to similar problems. This is also critical from your communications, and confidence standpoint, and expressing your idea in your own words. Document feedback clearly in your digital portfolio.</li><li><strong>ADAPT </strong>— After 4th semester — Implement some of the feedback that you loved and received from your feedback cycle and tee up your Proof of Concept into a presentable shape for companies. Update your digital portfolio with as many details as you deem fit. With this, reach out to industry leaders on LinkedIn — especially startups who have tons of similar problems that need PoCs created. Aim to get more industry mentors as you do this as these mentors can help you throughout your career. Try to pick startups/firms in similar areas as your area of interest as far as possible. Diligently complete the PoC and provide a similar report to the startup as you did in your own case.</li><li><strong>PRODUCTIZE </strong>— After 5th semester — Now you are equipped to create PoCs and need to apply yourself to scaling the same to a real world scale. Pick up a new problem or extension of your current theme to create a real world scale application. Try to consult your industry guide or professor to validate the problem. You can create synthetic data if you do not have access to real data at scale. Focus on applying concepts of Operating Systems, CPU Parallelisation, Task Scheduling in the context of the real world problem which hopefully the theory part will have been covered by now. Start writing down your learnings and observations as scenarios of case studies.</li></ol><p>At this time in your 3rd year, you would be largely focussing on the “landing a job” part but the shift in the narrative with the <strong>LEAP</strong> framework is that you are already aware of how to identify real world problems, brainstorm with your customers/audience/professors, create a solution, test it out, get feedback and implement them. With this, you no longer are worrying about “AI taking your jobs” but transforming yourself to use AI tools into what the industry is looking for — an Engineer. And yes, you can absolutely try your hands at various roles at any point especially after your 4th semester. Also, it is never too late — if you are in your 6th to 8th semester, you can take these exact steps and create a portfolio of validated, scaled POCs and bring them to the interview table.</p><p>While these are steps listed for AI Engineers/Software Engineer roles, we can create a similar playbook for various roles of interest (reach out with your roles of interest if you need help). In this model, your Arjuna’s Fish Eye is not to get a job but instead to demonstrate your willingness to learn and your ability to solve real world problems through opportunities presented to you which is what Engineering is all about.</p><p><strong>References / Further Readings:</strong></p><ol><li><a href="https://en.wikipedia.org/wiki/Draupadi#Svayamvara">https://en.wikipedia.org/wiki/Draupadi#Svayamvara</a></li><li><a href="https://en.wikipedia.org/wiki/Customer_development">https://en.wikipedia.org/wiki/Customer_development</a></li><li><a href="https://www.weforum.org/publications/the-future-of-jobs-report-2025/">https://www.weforum.org/publications/the-future-of-jobs-report-2025/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e31786a22b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Skill Library Pattern for Enterprise AI Agents]]></title>
            <link>https://shripatibhat.medium.com/the-skill-library-pattern-for-enterprise-ai-agents-759ba7254369?source=rss-b8d2c65eef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/759ba7254369</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[enterprise-architecture]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Shripati Bhat]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 10:35:16 GMT</pubDate>
            <atom:updated>2026-04-27T13:22:15.187Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*STfWjrABtYLHW9BYdMdC4w.png" /></figure><p><em>The takeaway:</em> You can build an Enterprise AI Agent Platform with a Graph based topology along with a library of Skills.</p><p>Enterprise AI Agent use cases range across the spectrum like Autonomous Customer Support Agent, Sales Assistant, Billing Reminders, Collections Assistant, Engineering Productivity Agent, Roadmap Agents. Most enterprise AI agent prototypes pass functional review and fail to meet non-functional Enterprise standards. There may be two categories of the agents (customer facing, and employee facing) but let’s look at the non functional requirements across both.</p><ol><li>Reliability → output accuracy, responses are trustable and explainable, less hallucinations</li><li>Observability → ease of debugging, understanding planning and reasoning steps and actions</li><li>Low latency → responses for user facing operations within an acceptable timeframe (&lt;1–2s)</li><li>Security / Multi-tenancy → Role Based Access Control (RBAC), audit trails, Data Security</li><li>Scale &amp; Cost → Ability to scale to Enterprise volumes without cost scaling linearly with usage</li><li>Maintenance → ability to test repeatedly and in units, upgrades of LLMs, frameworks, and other components.</li><li>Service Level Objectives → ability to define, track, and monitor system-wide SLOs.</li></ol><p>These are common for any of the enterprise systems be it customer facing or internal facing.</p><p>A lot of frameworks help solve the functional requirements that are evaluated first during most of the prototypes. But in an Enterprise system, the NFRs play an equally important role. An Out Of The Box (OOTB) solution as powerful as it may be, will need a lot of systems to be built around the framework to achieve these NFRs. Some concerns are listed,</p><ol><li>Latency — A bloated set of frameworks tied together lead to delayed response destroying real time SLAs</li><li>Observability — When an agent hallucinates debugging nested stack is often harder, identifying the cause of failure becomes a nightmare.</li><li>Security — Linear chains have weaker enforcement of legacy RBAC constraints that may lead to cross tenant data leakage. Running VAPT, ISO-27701, ISO-27001 certification will need more careful consideration with constant upgrades to these opaque chains.</li></ol><p>One of the simplified design and architecture for an enterprise-grade AI Agent could be <strong>a Graph-based topology along with a library of Skills</strong>.</p><p>Following a <strong>Component-Based Architecture</strong>, let’s focus on the <strong>Skills</strong>. If we take a libraries approach for Skills, the AI Agent would need multiple Out Of The Box (OOTB) libraries as Skills. Some libraries that are needed,</p><ul><li><strong>RBAC-as-a-Skill</strong> — This cross cutting concern can also be built as a Skill. The first step of the processing of a task request from a user should be the user’s role check to ensure that the user has access to execute the task. Similar checks should be used to check before accessing the data from databases or taking post actions on integrations. Traditionally these are placed in the gateway applications but in an AI Agent, if this is modelled as a Skill, you can reuse this Skill in the first step of the process as well as fine grained access before querying database or integration actions.</li><li><strong>Integration Skill</strong> — A Skill built to integrate with specific MCP Tools/Third-party systems required to achieve the business needs. This enables tools to have similar observability, traceability as RBAC. In case of Integration failures, which is a very common aspect of Enterprise integrations, retries can be built as part of the Skill but a central Skill-execution-failure event can be setup to track overall SLOs for the agent.</li><li><strong>Memory Skill</strong> — A tool provided to store relevant facts/information to the agent’s long-term memory. There are three types of memory in an AI Agent,</li></ul><p>i. <strong>Semantic Memory Skill</strong> : This data typically comes from Enterprise data as part of RAG systems. <strong><em>Example</em></strong> — Good Day, Marie Gold, Bourbon, Little Hearts are biscuits sold by Britannia.</p><p>ii. <strong>Episodic Memory Skill</strong> : This is based on past conversations with the user, similar user segments/cohorts. <strong><em>Example</em></strong> — The user was interested in Bourbon biscuits when an order was placed last month.</p><p>iii. <strong>Procedural Memory Skill</strong> : The process used to solve the problem. <strong><em>Example</em></strong> — The process when the user reorders Bourbon — confirm price, check inventory, reserve inventory, place order, confirm placement to user.</p><p>The Episodic and Procedural memory can be mapped as Skills while RAG can bring in the Semantic Memory as part of the Integration Skills. Strong Episodic Memory Skill built into the Agent helps avoid repeated queries to LLM reducing response latency, long-term cost. Procedural Memory Skill brings in a more deterministic approach towards achieving a task thereby making the system more reliable. While an LLM can do a lot of powerful procedural tasks via long prompts, in an Enterprise system these prompts can become 1000s of lines, making them difficult to manage, debug, and often lead to hallucination. These skills facilitate more reliability.</p><ul><li><strong>Evaluation Skill</strong> — A Skill to evaluate the work done by the agent. This can be done using LLM-as-a-Judge, DeepEval, or other mechanisms. A good way to build this skill would be to pass every response through this evaluation skill asynchronously via queues and pass the execution feedback (autonomously or via Human-in-the-loop) back to the topology. This design for an evaluation skill allows the AI Agent to achieve the latency (&lt;1–2s) needed for Enterprise systems as well as improves the AI Agent performance over time.</li><li><strong>Audit / Logging Skill</strong> : In a highly regulated environment, it is essential to log every action the agent has taken, with the relevant authorising user, permissions granted, and verifiable timestamps. These help not just in improving the Observability but also are key to compliance and certifications like ISO.</li><li><strong>Guardrail / Safety Skill</strong> : Guardrail Skill can be used for PII redaction from responses, output validation, prompt injection detection, and more. This Skill strengthens the security posture of the framework overall.</li></ul><p>Along with these other Skills like Planning Skill, Cost Tracking Skill, Fallback / Service Degradation Handler Skill are also essential.</p><p>Each of these Skills can be used as a Component and can be used across the AI Agent. These Skills can have common layers for observability, error handling, monitoring which can lead to better reliability, governance, and security.</p><p>To stitch it together, we need to set up the Agent topology which is a Graph network. The topology is a directed Graph Network with the functional objective setup in terms of nodes as Skills and edges as directions the actions could navigate. This also enables SLO tracking, span setup at every node allows trace to be built at both the overall system and an individual user request. Traces like these can be then reported into ELK, Prometheus like systems to build SLO Dashboards facilitating pro-active monitoring rather than reactive firefighting. This is what a true Enterprise reliable, observable system actually requires. The topology can be built using frameworks like LangGraph, Bedrock Agents or a custom framework with graph databases. Let’s weigh both options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FZNmyQq95BSJmPl6xZZ9LA.png" /><figcaption>Comparison of LangGraph to Custom Topology for Enterprises</figcaption></figure><p>For Enterprise systems where compliance, multi tenancy and long term cost matter, a custom topology pays back the engineering effort invested in the first audit cycle itself. Mid size enterprises / mid stake deployments / prototypes are best done with existing frameworks. In any case, every Enterprise today needs to seriously think about a long term framework for transitioning into an AI-native organisation. This is the first step to transition, build and deploy AI Agents across customer facing and internal use cases. A Graph based topology along with a Skills library is one of the ways to architect a strong framework for enterprises building towards an AI-native future.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=759ba7254369" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The importance of design and architecture in today’s world of AI]]></title>
            <link>https://shripatibhat.medium.com/the-importance-of-design-and-architecture-in-todays-world-of-ai-17ed5809e8b0?source=rss-b8d2c65eef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/17ed5809e8b0</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Shripati Bhat]]></dc:creator>
            <pubDate>Sat, 11 Apr 2026 06:42:04 GMT</pubDate>
            <atom:updated>2026-04-11T11:59:45.877Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pXd2owRjupT8dgQF9jUimg.png" /><figcaption>AI Generated Image — Reasoning Loop</figcaption></figure><p>Claude has achieved widespread adoption amongst the developers as of April 2026. In the past few months itself, many have found it to be magical in terms of how Claude is able to generate, debug, and explain complex business logic in code. A lot of people attribute this to the sophistication of the model’s architecture and its ability to understand and generate code across programming languages.</p><p>While I concur that the LLMs today have improved significantly in terms of generating contextual responses and more so generating smart code, a closer look at the engineering under the hood shows that <strong>traditional system design and architecture plays the most critical role</strong> in terms of achieving the overall functionality and also the “wow” experience we have while using it.</p><p>Recently the source code of Claude code was leaked due to the source map file being bundled along with the compiled npm package. This setup while helpful in development environments for debugging is never advised for a production setup. The leak exposed 512K+ lines of code, 1.9K+ TypeScript files, with several hidden feature flags. Interestingly this is the second such leak in a week with the accidental exposure of the model specs and internal documents just days before this one.</p><p>A deeper look at the leaked source code of Claude code, reveals a masterclass in building production-grade Agentic AI applications. And spoiler alert: the LLM is not at the center of this argument I am trying to make. At the heart of it is a <strong>while loop (literally!)</strong>.</p><p>Yes, its an absolutely simple reasoning loop (classic while loop ) that runs continuously until a task is completed (or fails with an error) using tool calls, context updation, identifying the next best action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*Z-3xUnh0_NbDjvYuuvpwug.png" /><figcaption>Claude code — Architecture</figcaption></figure><p>Now compare this simplistic yet effective architecture to a core traditional distributed system (excluding Security, Governance components).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*PNEGUSQrenXZvh535O012w.png" /><figcaption>Traditional Distributed System (Simplified) — Architecture</figcaption></figure><p>Even as the LLM is a key component to generate a good response, some key considerations in the design and architecture of this system are critical to make the entire Agentic AI application (Claude code) effective,</p><ol><li>Multi Layer Memory — To generate the best response, it is critical to carry the right context to the LLM. This is accomplished by having multiple layers of memory including in-context memory, session memory, a persistent memory, and a Memory.md consolidated from background task and read for context efficiency.</li><li>Response Completion Detection — In cases of output token limits being reached, a continuation marker is sent to the model with a continuationCount , turnTokens to ensure the complete response is streamed. Additionally tool calls that yield massive responses are persisted to disk to ensure the context is not muddied with a very large response from a huge file for example.</li><li>Concurrent Tool calls — In case of readOnly tool calls, upto 10 calls are made concurrently.</li><li>Eager Loading of Configurations — Skills, MCP Registry details, plugins, MDM policies are loaded in the beginning of the session for faster access during various stages of response resolution.</li><li>KAIROS — the background processor — an always-on background agent that allows actions without user input. An autoDream configuration enables a subprocess that runs memory compaction to keep the context rich and updated. This subprocess merges observations, removes contradictions, and converts insights into facts.</li></ol><p>These and many more such crucial design considerations are a critical part of Agentic AI Applications like Claude code. The lesson here is clear: Great Agentic AI products are won or lost on classic software engineering and architectural discipline, not just model parameters.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17ed5809e8b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Will AI take over jobs? My view…]]></title>
            <link>https://shripatibhat.medium.com/will-ai-take-over-jobs-my-view-6e013a610cd5?source=rss-b8d2c65eef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e013a610cd5</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Shripati Bhat]]></dc:creator>
            <pubDate>Sat, 23 Aug 2025 20:17:58 GMT</pubDate>
            <atom:updated>2025-08-24T10:44:12.985Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aEMo1fCPqRnc2kldP4vmYQ.png" /><figcaption>Image Credit : Canva</figcaption></figure><p>During one of my recent interviews for an entry level graduate, I asked the candidate the customary “Can you please introduce yourself?” question. What followed to my surprise was an uncanny toned introduction. When I asked him to present his screen next for getting into a code writing question, he coincidentally opened the same Chrome window on which he had a picture of his Self-Introduction written and opened on WhatsApp Web. He swiftly tried to open a new tab but I had seen it by then. I asked him to open the WhatsApp Web tab where he had the image and I found it match word to word in terms of what he said to introduce himself.</p><p>Keeping the unethical piece aside (about which I am still furious), I feel if young people passing out of college today resort to memorising something as basic a Self Introduction — which is about their own selves, talking about their lives, their passion, then <strong>YES! AI will surely take your jobs very soon …</strong></p><p>It is important for people getting into the field of Technology to be fully aware of the true capabilities and not fall for the hype. AI models as it happens today, are not good at solving complex business problems without a lot of fine-tuning and customized deployment using RAG, Agentic AI. The models themselves can’t do a lot of things such as business knowledge, proprietary data based training, your personal information. Hence its essential “Applications” layer needs to be built around these models to meet various personal, productivity, and business use cases. For a quick analogy, if AI Models are like mobile phones, these “Applications” are like mobile applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*OEl8Wa-9PCaVcPYtB31qZA.png" /></figure><p>While the AI models themselves are evolving at a very rapid pace, the “Applications” around these models are <strong>NOT</strong> evolving at the same pace. This is clearly one stream of job roles that will have enhanced focus in the years to come.</p><p>In reality, today there are AI models with various capabilities like,</p><ol><li>Large Language Models — these models are good at some Natural Language Processing tasks (like generation, summarisation, translation). But since these models are biased towards the data that they are trained on (pretraining on large dataset).<br>Example — OpenAI’s GPT, Google’s Gemini, Meta’s Llama, DeepSeek.</li><li>Perception &amp; Vision Models — Traditionally Vision Models are good at processing visual format of data (Image Identification, Facial Recognition). The latest format of Visual Language Models are good at understand both text and image simultaneously.<br>Example — YOLO, ResNet, CLIP</li><li>Speech and Audio Models — Used to process speech data like Speech-to-Text (STT) , Text-to-Speech (TTS), Audio Generation, etc. <br>Example — Whisper, ElevenLabs</li><li>World Models — These models understand the concept of a world (simulated or real) and can plan and reason based on the concepts of that world.<br>Example — DreamerV3, MuZero.</li><li>Multimodal and Agentic Models — These are hybrid models that help process various formats of data including text, images, audio, video.<br>Example — GPT-5, Claude 3.</li></ol><p>&amp; more …</p><p>And building “Applications” requires a deeper understanding of a specific business problem that needs to be picked up and solved. A lot of AI Agents, RAG search based products that we read about are the initial versions of these “Applications” and just like the era of mobile applications, there will be very large number of such “Applications” and frameworks evolving around them.</p><p>In summary, At its core these are deep engineering and scale challenges that need to be solved to design and build these “Applications” around AI Models to ensure deeper penetration and boost productivity. The real opportunity is in learning to build <strong>WITH</strong> AI, not just use it. There is no dearth of future jobs for people with this skill. So I feel, <strong>AI will surely NOT take your jobs if we keep re-skilling ourselves to suit the needs of future jobs.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e013a610cd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Java 21 — Overview (Part 1)]]></title>
            <link>https://shripatibhat.medium.com/java-21-overview-part-1-2af7bf8f23ca?source=rss-b8d2c65eef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/2af7bf8f23ca</guid>
            <category><![CDATA[application]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Shripati Bhat]]></dc:creator>
            <pubDate>Sun, 08 Oct 2023 17:57:42 GMT</pubDate>
            <atom:updated>2023-10-08T17:58:01.192Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lKicLeOY6hpPUkRyzhh02Q.png" /><figcaption>Java 21 Overview — image courtesy craiyon.com</figcaption></figure><h3>Java 21 — Overview (Part 1)</h3><h3><strong>Introduction</strong></h3><p>Java 21 is now released and I’m sure due to it being a Long-Time-Support (LTS) version, a lot of technical enthusiasts like me are trying it out to learn and understand the feature set. A lot of java applications today are deployed using java versions 8/11/17. It is logical to anticipate that applications will soon start moving to Java 21. Hence I wanted to put together my initial few days of learning Java 21. Given the number of new feature sets in this release, I may have to break this topic down into multiple individual blogs covering some topics.</p><p>Of course I wanted to start the most talked about <strong>Virtual Threads </strong>concept. This is by far the most awaited, and most talked about feature in this release. Hence it is natural that a lot of people want to start using it almost immediately. But it is absolutely critical to understand where this feature applies and where it doesn’t (some sample test results at the end of the explanation).</p><h3>Background</h3><p>Let’s start by understanding what Threads are. The textbook definition of “<em>Threads are light-weight processes</em>” is an indication that the Operating System manages threads with resources lower than that of a process. A process can be anything from your chrome browser, your photo-editor app, a Spotify app, Microsoft Excel or any Java (or any other programming language) application. Now each of these applications would be using the Operating System for some duration (time slice) to do specific tasks and the Operating System makes us feel as if all these applications are running in parallel. Threads can be treated as execution units of individual tasks that each of these apps run.</p><p>Taking the previous example ahead, let’s say your Spotify app wants to send you a notification that has to be shown on the app. The real implementation of this may be different, but just taking this example to make you understand how this works as a concept. There would be one thread (a task listener) that would get notified with an event that a notification has arrived via the Operating System (that it gets from the <a href="https://www.geeksforgeeks.org/open-systems-interconnection-model-osi/">OSI Layer</a> 6 typically i.e. the Presentation Layer). The OS then puts this thread in a priority queue of threads that are to be executed. The thread scheduler in the OS kernel then allocates the CPU, and resources for the thread to display the notification on the app, play a notification sound, etc based on what the thread’s tasks. After the task is executed, the thread goes into a sleep kind of a state (blocked/waiting state) until the next notification comes up. If you treat the Spotify app to be a Java application, now we are all set to understand the difference between the concept of a Thread and a Virtual Thread.</p><blockquote>From the <a href="https://docs.oracle.com/en/java/javase/21/core/virtual-threads.html#GUID-15BDB995-028A-45A7-B6E2-9BA15C2E0501">documentation</a> of Java 21 <br>“A virtual thread isn’t tied to a specific OS thread. A virtual thread still runs code on an OS thread. However, when code running in a virtual thread calls a blocking I/O operation, the Java runtime suspends the virtual thread until it can be resumed. The OS thread associated with the suspended virtual thread is now free to perform operations for other virtual threads”.</blockquote><p>The key difference being when the thread is in a blocked state, for example <em>Thread.sleep(1000)</em> or a <em>HTTP API</em> call or a <em>Database Query Execution</em>, virtual threads are preempted and a new virtual thread is given the execution cycles whereas the Threads continue to be in a blocked state.</p><h3>Virtual Threads in Action</h3><p>To compare the behaviour of Threads and Virtual Threads, let’s run a code with <em>Thread.sleep(1000)</em> in it.</p><pre>public class ThreadDemo {<br>  private static final AtomicInteger COUNTER = new AtomicInteger(0);<br>  private static final int ONE_HUNDRED = 100;<br>  private static final long START_TIME = System.currentTimeMillis();<br><br>  public static void main(String[] args) {<br>    System.out.println(&quot;Welcome to Normal Threads&quot;);<br><br>    try (ExecutorService es = Executors.newFixedThreadPool(10)) {<br>      for (var i = 0; i &lt; ONE_HUNDRED; i++) {<br>        es.submit(<br>            () -&gt; {<br>              System.out.println(<br>                  &quot;In a normal thread&quot;<br>                      + &quot; COUNTER &quot;<br>                      + COUNTER.incrementAndGet()<br>                      + &quot; in &quot;<br>                      + ((System.currentTimeMillis() - START_TIME) / 1000)<br>                      + &quot; seconds &quot;<br>                      + Thread.currentThread());<br>              try {<br>                Thread.sleep(1000);<br>              } catch (InterruptedException e) {<br>                throw new RuntimeException(e);<br>              }<br>            });<br>      }<br>    }<br>  }<br>}</pre><p>I know the code is very rudimentary, but before you judge that, let’s take a look at the output.</p><pre>In a normal thread COUNTER 4 in 0 seconds Thread[#24,pool-1-thread-4,5,main]<br>In a normal thread COUNTER 10 in 0 seconds Thread[#30,pool-1-thread-10,5,main]<br>In a normal thread COUNTER 8 in 0 seconds Thread[#28,pool-1-thread-8,5,main]<br>In a normal thread COUNTER 9 in 0 seconds Thread[#29,pool-1-thread-9,5,main]<br>In a normal thread COUNTER 1 in 0 seconds Thread[#22,pool-1-thread-2,5,main]<br>In a normal thread COUNTER 5 in 0 seconds Thread[#25,pool-1-thread-5,5,main]<br>In a normal thread COUNTER 6 in 0 seconds Thread[#26,pool-1-thread-6,5,main]<br>In a normal thread COUNTER 7 in 0 seconds Thread[#27,pool-1-thread-7,5,main]<br>In a normal thread COUNTER 2 in 0 seconds Thread[#21,pool-1-thread-1,5,main]<br>In a normal thread COUNTER 3 in 0 seconds Thread[#23,pool-1-thread-3,5,main]<br>In a normal thread COUNTER 13 in 1 seconds Thread[#26,pool-1-thread-6,5,main]<br>In a normal thread COUNTER 20 in 1 seconds Thread[#21,pool-1-thread-1,5,main]<br>In a normal thread COUNTER 18 in 1 seconds Thread[#28,pool-1-thread-8,5,main]<br>In a normal thread COUNTER 15 in 1 seconds Thread[#27,pool-1-thread-7,5,main]<br>In a normal thread COUNTER 14 in 1 seconds Thread[#29,pool-1-thread-9,5,main]<br>In a normal thread COUNTER 12 in 1 seconds Thread[#23,pool-1-thread-3,5,main]<br>In a normal thread COUNTER 16 in 1 seconds Thread[#30,pool-1-thread-10,5,main]<br>In a normal thread COUNTER 19 in 1 seconds Thread[#24,pool-1-thread-4,5,main]<br>In a normal thread COUNTER 17 in 1 seconds Thread[#22,pool-1-thread-2,5,main]<br>In a normal thread COUNTER 11 in 1 seconds Thread[#25,pool-1-thread-5,5,main]<br>In a normal thread COUNTER 23 in 2 seconds Thread[#27,pool-1-thread-7,5,main]<br>In a normal thread COUNTER 26 in 2 seconds Thread[#23,pool-1-thread-3,5,main]<br>In a normal thread COUNTER 21 in 2 seconds Thread[#26,pool-1-thread-6,5,main]<br>In a normal thread COUNTER 22 in 2 seconds Thread[#21,pool-1-thread-1,5,main]<br>In a normal thread COUNTER 24 in 2 seconds Thread[#28,pool-1-thread-8,5,main]<br>In a normal thread COUNTER 25 in 2 seconds Thread[#29,pool-1-thread-9,5,main]<br>In a normal thread COUNTER 27 in 2 seconds Thread[#30,pool-1-thread-10,5,main]<br>In a normal thread COUNTER 29 in 2 seconds Thread[#24,pool-1-thread-4,5,main]<br>In a normal thread COUNTER 28 in 2 seconds Thread[#22,pool-1-thread-2,5,main]<br>In a normal thread COUNTER 30 in 2 seconds Thread[#25,pool-1-thread-5,5,main]<br>.....</pre><p>Now let’s try the same by replacing just the regular FixedThreadPool executor with the VirtualThreadPool and see the results. The core difference is using the <strong><em>Executors.newVirtualThreadPerTaskExecutor().</em></strong></p><pre>public class ThreadDemo {<br>  private static final AtomicInteger COUNTER = new AtomicInteger(0);<br>  private static final int ONE_HUNDRED = 100;<br>  private static final long START_TIME = System.currentTimeMillis();<br><br>  public static void main(String[] args) {<br>    System.out.println(&quot;Welcome to Virtual Threads&quot;);<br><br>    try (ExecutorService es = Executors.newVirtualThreadPerTaskExecutor()) {<br>      for (var i = 0; i &lt; ONE_HUNDRED; i++) {<br>        es.submit(<br>            () -&gt; {<br>              System.out.println(<br>                  &quot;In a virtual thread&quot;<br>                      + &quot; COUNTER &quot;<br>                      + COUNTER.incrementAndGet()<br>                      + &quot; in &quot;<br>                      + ((System.currentTimeMillis() - START_TIME) / 1000)<br>                      + &quot; seconds &quot;<br>                      + Thread.currentThread());<br>              try {<br>                Thread.sleep(1000);<br>              } catch (InterruptedException e) {<br>                throw new RuntimeException(e);<br>              }<br>            });<br>      }<br>    }<br>  }<br>}</pre><p>And the output of course being much better, goes as follows</p><pre>Welcome to Virtual Threads<br>In a virtual thread COUNTER 10 in 0 seconds VirtualThread[#32]/runnable@ForkJoinPool-1-worker-11<br>In a virtual thread COUNTER 5 in 0 seconds VirtualThread[#26]/runnable@ForkJoinPool-1-worker-5<br>In a virtual thread COUNTER 13 in 0 seconds VirtualThread[#34]/runnable@ForkJoinPool-1-worker-8<br>In a virtual thread COUNTER 2 in 0 seconds VirtualThread[#23]/runnable@ForkJoinPool-1-worker-2<br>In a virtual thread COUNTER 18 in 0 seconds VirtualThread[#40]/runnable@ForkJoinPool-1-worker-12<br>In a virtual thread COUNTER 23 in 0 seconds VirtualThread[#45]/runnable@ForkJoinPool-1-worker-1<br>In a virtual thread COUNTER 24 in 0 seconds VirtualThread[#46]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 27 in 0 seconds VirtualThread[#50]/runnable@ForkJoinPool-1-worker-10<br>In a virtual thread COUNTER 29 in 0 seconds VirtualThread[#52]/runnable@ForkJoinPool-1-worker-7<br>In a virtual thread COUNTER 31 in 0 seconds VirtualThread[#48]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 4 in 0 seconds VirtualThread[#25]/runnable@ForkJoinPool-1-worker-4<br>In a virtual thread COUNTER 32 in 0 seconds VirtualThread[#54]/runnable@ForkJoinPool-1-worker-3<br>In a virtual thread COUNTER 3 in 0 seconds VirtualThread[#21]/runnable@ForkJoinPool-1-worker-1<br>In a virtual thread COUNTER 37 in 0 seconds VirtualThread[#60]/runnable@ForkJoinPool-1-worker-1<br>In a virtual thread COUNTER 43 in 0 seconds VirtualThread[#65]/runnable@ForkJoinPool-1-worker-2<br>In a virtual thread COUNTER 9 in 0 seconds VirtualThread[#30]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 45 in 0 seconds VirtualThread[#67]/runnable@ForkJoinPool-1-worker-10<br>In a virtual thread COUNTER 49 in 0 seconds VirtualThread[#71]/runnable@ForkJoinPool-1-worker-5<br>In a virtual thread COUNTER 54 in 0 seconds VirtualThread[#77]/runnable@ForkJoinPool-1-worker-11<br>In a virtual thread COUNTER 65 in 0 seconds VirtualThread[#88]/runnable@ForkJoinPool-1-worker-5<br>In a virtual thread COUNTER 69 in 0 seconds VirtualThread[#94]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 72 in 0 seconds VirtualThread[#96]/runnable@ForkJoinPool-1-worker-5<br>In a virtual thread COUNTER 73 in 0 seconds VirtualThread[#98]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 74 in 0 seconds VirtualThread[#100]/runnable@ForkJoinPool-1-worker-3<br>In a virtual thread COUNTER 80 in 0 seconds VirtualThread[#107]/runnable@ForkJoinPool-1-worker-1<br>In a virtual thread COUNTER 84 in 0 seconds VirtualThread[#110]/runnable@ForkJoinPool-1-worker-2<br>In a virtual thread COUNTER 8 in 0 seconds VirtualThread[#29]/runnable@ForkJoinPool-1-worker-8<br>In a virtual thread COUNTER 96 in 0 seconds VirtualThread[#121]/runnable@ForkJoinPool-1-worker-2<br>In a virtual thread COUNTER 41 in 0 seconds VirtualThread[#59]/runnable@ForkJoinPool-1-worker-7<br>In a virtual thread COUNTER 12 in 0 seconds VirtualThread[#33]/runnable@ForkJoinPool-1-worker-12<br>In a virtual thread COUNTER 6 in 0 seconds VirtualThread[#27]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 14 in 0 seconds VirtualThread[#36]/runnable@ForkJoinPool-1-worker-1<br>In a virtual thread COUNTER 16 in 0 seconds VirtualThread[#37]/runnable@ForkJoinPool-1-worker-12<br>In a virtual thread COUNTER 15 in 0 seconds VirtualThread[#35]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 7 in 0 seconds VirtualThread[#28]/runnable@ForkJoinPool-1-worker-7<br>In a virtual thread COUNTER 17 in 0 seconds VirtualThread[#39]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 19 in 0 seconds VirtualThread[#41]/runnable@ForkJoinPool-1-worker-1<br>In a virtual thread COUNTER 21 in 0 seconds VirtualThread[#42]/runnable@ForkJoinPool-1-worker-7<br>In a virtual thread COUNTER 20 in 0 seconds VirtualThread[#43]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 22 in 0 seconds VirtualThread[#44]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 25 in 0 seconds VirtualThread[#47]/runnable@ForkJoinPool-1-worker-7<br>In a virtual thread COUNTER 11 in 0 seconds VirtualThread[#31]/runnable@ForkJoinPool-1-worker-10<br>In a virtual thread COUNTER 26 in 0 seconds VirtualThread[#49]/runnable@ForkJoinPool-1-worker-7<br>In a virtual thread COUNTER 28 in 0 seconds VirtualThread[#51]/runnable@ForkJoinPool-1-worker-7<br>In a virtual thread COUNTER 1 in 0 seconds VirtualThread[#24]/runnable@ForkJoinPool-1-worker-3<br>In a virtual thread COUNTER 30 in 0 seconds VirtualThread[#53]/runnable@ForkJoinPool-1-worker-3<br>In a virtual thread COUNTER 33 in 0 seconds VirtualThread[#55]/runnable@ForkJoinPool-1-worker-7<br>In a virtual thread COUNTER 34 in 0 seconds VirtualThread[#56]/runnable@ForkJoinPool-1-worker-1<br>In a virtual thread COUNTER 35 in 0 seconds VirtualThread[#57]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 36 in 0 seconds VirtualThread[#58]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 38 in 0 seconds VirtualThread[#61]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 42 in 0 seconds VirtualThread[#64]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 40 in 0 seconds VirtualThread[#63]/runnable@ForkJoinPool-1-worker-10<br>In a virtual thread COUNTER 44 in 0 seconds VirtualThread[#66]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 46 in 0 seconds VirtualThread[#70]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 47 in 0 seconds VirtualThread[#69]/runnable@ForkJoinPool-1-worker-12<br>In a virtual thread COUNTER 48 in 0 seconds VirtualThread[#68]/runnable@ForkJoinPool-1-worker-2<br>In a virtual thread COUNTER 39 in 0 seconds VirtualThread[#62]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 52 in 0 seconds VirtualThread[#74]/runnable@ForkJoinPool-1-worker-2<br>In a virtual thread COUNTER 50 in 0 seconds VirtualThread[#72]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 53 in 0 seconds VirtualThread[#75]/runnable@ForkJoinPool-1-worker-12<br>In a virtual thread COUNTER 51 in 0 seconds VirtualThread[#73]/runnable@ForkJoinPool-1-worker-1<br>In a virtual thread COUNTER 56 in 0 seconds VirtualThread[#79]/runnable@ForkJoinPool-1-worker-2<br>In a virtual thread COUNTER 55 in 0 seconds VirtualThread[#78]/runnable@ForkJoinPool-1-worker-10<br>In a virtual thread COUNTER 58 in 0 seconds VirtualThread[#81]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 57 in 0 seconds VirtualThread[#80]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 59 in 0 seconds VirtualThread[#82]/runnable@ForkJoinPool-1-worker-1<br>In a virtual thread COUNTER 60 in 0 seconds VirtualThread[#83]/runnable@ForkJoinPool-1-worker-2<br>In a virtual thread COUNTER 61 in 0 seconds VirtualThread[#84]/runnable@ForkJoinPool-1-worker-10<br>In a virtual thread COUNTER 63 in 0 seconds VirtualThread[#86]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 62 in 0 seconds VirtualThread[#85]/runnable@ForkJoinPool-1-worker-5<br>In a virtual thread COUNTER 64 in 0 seconds VirtualThread[#87]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 66 in 0 seconds VirtualThread[#89]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 67 in 0 seconds VirtualThread[#92]/runnable@ForkJoinPool-1-worker-4<br>In a virtual thread COUNTER 68 in 0 seconds VirtualThread[#93]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 70 in 0 seconds VirtualThread[#95]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 71 in 0 seconds VirtualThread[#97]/runnable@ForkJoinPool-1-worker-11<br>In a virtual thread COUNTER 77 in 0 seconds VirtualThread[#103]/runnable@ForkJoinPool-1-worker-6<br>In a virtual thread COUNTER 75 in 0 seconds VirtualThread[#102]/runnable@ForkJoinPool-1-worker-1<br>In a virtual thread COUNTER 76 in 0 seconds VirtualThread[#99]/runnable@ForkJoinPool-1-worker-12<br>In a virtual thread COUNTER 79 in 0 seconds VirtualThread[#105]/runnable@ForkJoinPool-1-worker-5<br>In a virtual thread COUNTER 78 in 0 seconds VirtualThread[#104]/runnable@ForkJoinPool-1-worker-11<br>In a virtual thread COUNTER 81 in 0 seconds VirtualThread[#106]/runnable@ForkJoinPool-1-worker-12<br>In a virtual thread COUNTER 82 in 0 seconds VirtualThread[#108]/runnable@ForkJoinPool-1-worker-11<br>In a virtual thread COUNTER 83 in 0 seconds VirtualThread[#109]/runnable@ForkJoinPool-1-worker-5<br>In a virtual thread COUNTER 86 in 0 seconds VirtualThread[#112]/runnable@ForkJoinPool-1-worker-3<br>In a virtual thread COUNTER 85 in 0 seconds VirtualThread[#111]/runnable@ForkJoinPool-1-worker-12<br>In a virtual thread COUNTER 88 in 0 seconds VirtualThread[#114]/runnable@ForkJoinPool-1-worker-11<br>In a virtual thread COUNTER 87 in 0 seconds VirtualThread[#113]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 89 in 0 seconds VirtualThread[#115]/runnable@ForkJoinPool-1-worker-5<br>In a virtual thread COUNTER 90 in 0 seconds VirtualThread[#116]/runnable@ForkJoinPool-1-worker-3<br>In a virtual thread COUNTER 93 in 0 seconds VirtualThread[#119]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 91 in 0 seconds VirtualThread[#117]/runnable@ForkJoinPool-1-worker-12<br>In a virtual thread COUNTER 92 in 0 seconds VirtualThread[#118]/runnable@ForkJoinPool-1-worker-11<br>In a virtual thread COUNTER 95 in 0 seconds VirtualThread[#122]/runnable@ForkJoinPool-1-worker-4<br>In a virtual thread COUNTER 97 in 0 seconds VirtualThread[#123]/runnable@ForkJoinPool-1-worker-10<br>In a virtual thread COUNTER 98 in 0 seconds VirtualThread[#125]/runnable@ForkJoinPool-1-worker-3<br>In a virtual thread COUNTER 99 in 0 seconds VirtualThread[#126]/runnable@ForkJoinPool-1-worker-9<br>In a virtual thread COUNTER 100 in 0 seconds VirtualThread[#127]/runnable@ForkJoinPool-1-worker-12<br>In a virtual thread COUNTER 94 in 0 seconds VirtualThread[#120]/runnable@ForkJoinPool-1-worker-5</pre><h3>Result</h3><p>The result very clearly implies that when a thread was in <em>Thread.sleep(1000) </em>, the regular Threads were in a blocked state and resources (CPU and memory) weren’t being yielded until the sleep duration was completed. Whereas in the VirtualThread, as soon as one of them goes into a blocked state, the next one gets picked up. This is phenomenally powerful in cases where resources are blocked often due to I/O of any kind like API calls, DB Queries, File reads and writes, etc. In these cases, your application can continue servicing other requests when VirtualThreads are enabled.</p><p>Does this make our applications 10x / 100x / 1000x faster? Well, it’s quite possible and quite not possible too. Depending on whether the application is memory intensive or CPU intensive or I/O intensive, virtual threads will suit your application or may not suit your applications. But definitely there should be no harm done in enabling it for your applications and give it a thorough test run to know if it benefits your application.</p><p>Please let us know if you want me to elaborate on any of the topics in this part more in a separate blog. As always, please comment and leave your feedback.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2af7bf8f23ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics of Threads and Thread Dump]]></title>
            <link>https://shripatibhat.medium.com/basics-of-threads-and-thread-dump-e4e50d2b2da8?source=rss-b8d2c65eef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4e50d2b2da8</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[threads]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Shripati Bhat]]></dc:creator>
            <pubDate>Thu, 09 Sep 2021 04:22:55 GMT</pubDate>
            <atom:updated>2021-09-09T04:22:55.105Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*8rrkqU52DIH7GzFqoQ_7_Q.jpeg" /></figure><p>In java based applications, Threads form the basic part of every operation. In fact, threads are the very core in most of the processing units in the entire world of computers. As per theoretical definition, threads are lightweight processes that execute tasks assigned to them. But to explain in simpler terminologies, imagine you go to a bank and there is a queue of 10 people waiting (maintaining physical distancing :) ) to perform actions like open an account or withdraw or deposit or do other activities. Imagine there being 5 counters and 1 operator at each counter. This is what the bank counters would look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*D87hMARaG8EY8FAZqrzP2A.png" /><figcaption>Multiple operators executing requests</figcaption></figure><p>The first customer goes to the first counter, the second customer goes to the second counter, and so on till the fifth customer. The sixth customer however is still waiting in the queue. If any of the first 5 customers finish their activities, the counter gets vacated and the 6th customer can go to that counter. The 7th customer can go to the next vacated counter and so on.</p><p>Very similarly, threads are processed in a queue. The threads are picked up by the OS (Thread scheduling) per the priority and handed to the CPU for execution. As we are looking at an example of a Java application, it can have multiple threads in different states. Although each thread can only be in a single state at any given point.</p><h3>Thread States</h3><p>NEW:<br>This indicates that a thread has just been created and hasn’t been started yet (<em>t.start()</em> method is not invoked yet). This indicates that the thread has just been assigned a task and the thread hasn’t been submitted to the OS yet.</p><p>RUNNABLE:<br>This indicates that the thread is executing in the JVM. This means that the thread is actually all set to execute instructions on an available CPU. The Java application however doesn’t know this detail of whether the thread is currently executing any instructions on the CPU or is it next in line. This time slicing or scheduling is left to the OS.</p><p>BLOCKED:<br>The thread goes in a blocked state when it is waiting to acquire a lock on a semaphore (shared object/resource). This could happen when another thread has already acquired a lock and is doing some processing/waiting but hasn’t released the monitor lock yet.</p><p>WAITING:<br>This indicates that the thread is waiting indefinitely for another thread to perform a particular task. Generally, a thread on which we invoke <em>t.wait()</em> gets into this state. It continues in the state till another thread call <em>t.notify()</em> or <em>t.notifyAll()</em></p><p>TIMED_WAITING:<br>This indicates that the thread is waiting for another thread to perform a particular task for a specified waiting time. Generally, a thread on which we invoke <em>t.wait(long timeout)</em> gets into this state.</p><h3>Thread Dumps</h3><p>If your JVM is utilizing CPU higher than usual or if you are working on a library that deals with a lot of thread operations or if your application is having deadlocks or even longer response time due to locks, thread dumps can come very handy for debugging. Also, part of scaling java based applications requires us to analyze what threads are doing at a given time under load conditions. Analyzing this can be done using a lot of tools like New Relic, Prometheus, etc. It could also need an analysis of a thread dump. You can get a thread dump of a java application using Java VisualVM or few other monitoring tools. But all the tools internally use the <strong><em>jstack </em></strong>command exposed by the JVM to take a thread dump. So effectively, you can take a thread dump from a terminal or command prompt.</p><p>Command to take a thread dump <strong><em>jstack -l &lt;pid&gt; &gt; dump1.txt<br></em></strong>where <strong><em>pid</em></strong> is the process id of your java application (which can be got from the <strong><em>jps </em></strong>command)</p><p>So for example, if your process id is 20883 then the command would be <br><strong><em>jstack -l 20883 &gt; dump1.txt</em></strong></p><p>Taking a single thread dump is not going to reveal a lot of information as it gives a snapshot or a point in time information of what all the threads in the JVM are doing. What we really need is at least 2 thread dumps taken over a brief duration. We can then compare the state of threads and check if they are stuck in a single operation for a prolonged period.</p><h3>Analyzing Thread Dumps</h3><p>A thread dump can be analyzed using multiple tools. There are many online thread dump analyzers like<a href="https://fastthread.io/"> https://fastthread.io/</a> or<a href="https://spotify.github.io/threaddump-analyzer/"> https://spotify.github.io/threaddump-analyzer/</a> but what I personally prefer which also comes very handy is to analyze it in your IDE. A lot of IDEs like Intellij and Eclipse provide plugins that help analyze thread dumps very easily.</p><p>I’m going to focus on my favorite IDE Intellij. If you have upgraded to<a href="https://www.jetbrains.com/idea/download/#section=mac"> Intellij IDEA 2020</a> or above, you will see this option Analyze &gt; Stack Trace or Thread Dump</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bfOYRdwtT5oKyzWH.png" /></figure><p>When you paste the thread dump in this section, Intellij IDEA will analyze the thread dump and show you a consolidated summary of threads in various states. You could also include multiple such thread dumps and analyze them in one view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Q7Cb6S9fzVlOANmX.png" /></figure><p>Online thread dump analyzers even go a step ahead and show potential deadlocks or blocked calls. You can play around with this for some applications even in your local so that you guys can feel more comfortable with this when a situation asks for it. If you have questions as you try this, please do drop your comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4e50d2b2da8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How does HBase scale?]]></title>
            <link>https://shripatibhat.medium.com/how-does-hbase-scale-b35aa55bf246?source=rss-b8d2c65eef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/b35aa55bf246</guid>
            <category><![CDATA[hbase]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[scale]]></category>
            <dc:creator><![CDATA[Shripati Bhat]]></dc:creator>
            <pubDate>Thu, 05 Aug 2021 17:42:49 GMT</pubDate>
            <atom:updated>2021-08-05T17:42:49.293Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AZcxeZ08UibeNwwMheRSnA.png" /></figure><p>HBase is a column-oriented database. It belongs to the NoSQL family of databases which means that there are no fixed rows, columns, or defined structure in the database which all data in the database must compulsorily adhere to. To understand how HBase scales with these dynamic data components within it, we would need to understand the components in HBase.</p><h3>Zookeeper:</h3><p><a href="https://www.engati.com/blog/install-hbase-on-mac-in-5-minutes">HBase is a distributed database</a>. As with any distributed database, there has to be a component that centrally manages the metadata of all other components. HBase uses a Zookeeper for this task. Zookeeper manages the meta-information like the number of region servers, location of all components (master, region server). Zookeeper constantly does heartbeats with all components, reports to the Master Server in case of region server failure, and also performs master re-election in case of a Master Server node failure.</p><p>Putting in Zookeeper as a component here might be a little bit confusing because it can be considered as a dependency rather than a component. But HBase is so closely knit to Zookeeper for functioning that it could almost be treated as a component in HBase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rLUSzwZReusdNx9uqBPkPw.jpeg" /><figcaption>Hbase Internal working</figcaption></figure><h3>HMaster:</h3><p>As the name suggests, HMaster is the Master Server that monitors region servers. In HBase1.6, the metadata existed in Zookeeper, and hence the clients could reach the required region server even when Master Server is down. HMaster only comes into the picture on table creation or alter when a new region server is added or when there is a failure in one of the existing region servers. WALs are used to transfer the current state to another Master when the current Master Server crashes.</p><h3>Region Servers:</h3><p>Region Servers are primarily responsible for doing handle the Read (GET) &amp; Write (PUT) requests that come from the client (via the ZK). In addition to this, Region Servers also manage Regions (smallest units of a table holding actual data).</p><h3>Compactions:</h3><p>Region Servers go through different types of Compactions.</p><p>Minor compaction just collates multiple smaller files on the disk into one to make the read more efficient and fast (occurs when more than a configurable amount of data is held in Memory — hbase.hregion.memstore.flush.size).</p><p>Major compaction, on the other hand (occurs once a week by default), combines all files stored into one per Region per store and also deletes any data that has to be cleaned up.</p><p>Hence even though the major compaction is intended to benefit reads, it ends up taking a lot of resources and can cause problems in the Production environment.</p><h3>Region:</h3><p>Regions are the smallest units comprising of a store per column family (which holds data in memory and persists it to disk after a threshold). Regions split automatically and is done by the Region Server. The Region Server first informs Zookeeper about splitting a region. It then creates daughter regions and splits HDFS files as needed. After successful completion, the metadata is updated in other region servers, Zookeepers, and master (in the same order). Thus, HBase automatically handles both splitting and compaction of data in regions to optimize the read operations.</p><h3>CAP Theorem:</h3><p>Now HBase is strongly consistent and unlike a few other NoSQL databases like MongoDB (when secondary reads are enabled — <a href="https://docs.mongodb.com/manual/reference/read-concern/or">https://docs.mongodb.com/manual/reference/read-concern/or</a> partition replica failure occurs) or Cassandra (through consistency level configuration -https://cassandra.apache.org/doc/latest/configuration/cass_yaml_file.html#idealconsistency-level)</p><p>Due to the unavailability of Regions during the split, HBase cannot provide Availability.</p><p>Consistency is achieved by reading / writing through Region Servers concerned. PartitionTolerance is achieved by replication of data files using the underlying HDFS.</p><h3>Wrapping up</h3><p>Hope you guys now know a little more about the various components in HBase and how it can be used to handle millions of data points and still return results in the order of a few milliseconds. That’s how easy it is to scale HBase.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b35aa55bf246" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A walkthrough on partitions in MySQL]]></title>
            <link>https://medium.com/database-dive/a-walkthrough-on-partitions-in-mysql-39551ddbcfe4?source=rss-b8d2c65eef10------2</link>
            <guid isPermaLink="false">https://medium.com/p/39551ddbcfe4</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[scale]]></category>
            <category><![CDATA[partition]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Shripati Bhat]]></dc:creator>
            <pubDate>Fri, 30 Jul 2021 15:16:29 GMT</pubDate>
            <atom:updated>2021-09-15T23:22:33.499Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ul3Uiedup1HZsRlGTE8NXA.jpeg" /><figcaption>MySQL Partitions</figcaption></figure><p>If you have chosen data to be stored in MySQL and if your data size is snowballing or if you are looking for faster access based on your predicates, then partitioning could be one solution that you want to understand better. In Engati, we deal with millions of users and conversations between users across 14 different channels. Querying this data for a particular customer’s user and expecting results in a few milliseconds is a business need for our flows. That’s where we adopt partitioning of data.</p><p>Imagine walking into a library where there are only 100 books. Here you won’t need to spend too much time organizing the books. Although it will still take you some time to find books there, you will still manage. Over time, you will remember where you kept a particular book. But imagine that you were in an enormous library, you surely don’t want to spend hours looking for one book. Here racks are arranged alphabetically so that you can find the book that you need easily.</p><p>Very similarly, datastores build caches to reply to queries when the dataset is small. But when the data in your datastore is in the order of hundreds of thousands or millions or billions of records, then datastores provide an option for you to create physical and/or logical segregations to find the data easily. MySQL only supports logical segregation of data called the partitions.</p><p>Just like books in a Library or Book Store can be arranged alphabetically by the name of the book or the name of the author or the year they were published, MySQL supports various types of partitioning strategies that can be used based on the business objective.</p><h3>Types of MySQL partitions</h3><p>There are many types of partitions that MySQL supports. Some of the most commonly understandable ones are:</p><h4>Hash Partitions</h4><p>As the name suggests, here, the data in the MySQL table is partitioned based on a hashing function of the column of your interest. This ensures more uniform and equal-sized partitions, and all you need to do is specify the number of partitions you need (which people generally people to be a power of 2). For example, partitioning by a <strong><em>name</em></strong> column in a <strong><em>User </em></strong>table</p><p>CREATE TABLE user (<br> id INT NOT NULL,<br> name VARCHAR(255) NOT NULL,<br> age INT NOT NULL<br>)<br>PARTITION BY HASH (name) PARTITIONS 16;</p><h4>Range Partitions</h4><p>Again the name suggests here the data in the MySQL table is partitioned based on a (non-overlapping) range of data stored in a column. For example, if you want to partition based on the value of a column <strong><em>age </em></strong>in a <strong><em>User</em></strong> table.</p><p>CREATE TABLE user (<br> id INT NOT NULL,<br> name VARCHAR(255) NOT NULL,<br> age INT NOT NULL<br>)<br>PARTITION BY RANGE (age) (<br> PARTITION p0 VALUES LESS THAN (20),<br> PARTITION p1 VALUES LESS THAN (40),<br> PARTITION p2 VALUES LESS THAN (60),<br> PARTITION p3 VALUES LESS THAN (80),<br> PARTITION p4 VALUES LESS THAN MAXVALUE <br>);</p><h4>List Partitions</h4><p>In this case, the table definition needs to provide a list of values for a column that would go in any partition. This partition type can be chosen when there is a list of different values of data going into a column like ENUM. A point to note here is that a list partition fails the insert operation if the value of the column is not defined in any of the partition definitions (unlike range partition). For instance, if you want to partition based on the <strong><em>continent</em></strong> column in a <strong><em>User</em></strong> table.</p><p>CREATE TABLE user (<br> id INT NOT NULL,<br> name VARCHAR(255) NOT NULL,<br> age INT NOT NULL,</p><p>continent VARCHAR(20) NOT NULL<br>)<br>PARTITION BY LIST COLUMNS (continent) (<br> PARTITION p0 VALUES IN (“ASIA”),<br> PARTITION p1 VALUES IN (“AFRICA”),<br> PARTITION p2 VALUES IN (“EUROPE”, “ANTARCTICA”),<br> PARTITION p3 VALUES IN (“NORTH AMERICA”, “SOUTH AMERICA”, “OCEANIA”)<br>);</p><p>As you can see, MySQL supports partitioning data of a column of data type <strong><em>integer</em></strong> or <strong><em>varchar </em></strong>with list partitions. The same is supported in range partitions too, by mapping a non-integer column value to an integer value. Hash partition has another variant called Linear Hash Partition, which uses a power of 2 algorithms to decide which partition the data gets inserted into v/s the regular modulus of a hash function value.</p><p>Partitioning data can come in handy if your table’s size grows in millions and the data lookup is slow despite adding different types of indexes on a table. In a follow-up blog we will talk about partitioning existing tables in MySQL, so stay tuned</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39551ddbcfe4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/database-dive/a-walkthrough-on-partitions-in-mysql-39551ddbcfe4">A walkthrough on partitions in MySQL</a> was originally published in <a href="https://medium.com/database-dive">Database Dive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>