<?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 Maarten Smeets on Medium]]></title>
        <description><![CDATA[Stories by Maarten Smeets on Medium]]></description>
        <link>https://medium.com/@MaartenSmeetsNL?source=rss-918a6ecf5e32------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LYqoN9MWjCsqobt4aHoMKQ.png</url>
            <title>Stories by Maarten Smeets on Medium</title>
            <link>https://medium.com/@MaartenSmeetsNL?source=rss-918a6ecf5e32------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 06:04:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@MaartenSmeetsNL/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[AI Year Review 2025]]></title>
            <link>https://medium.com/researchable/ai-year-review-2025-f9dd082d02e5?source=rss-918a6ecf5e32------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9dd082d02e5</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[software-architecture]]></category>
            <dc:creator><![CDATA[Maarten Smeets]]></dc:creator>
            <pubDate>Mon, 19 Jan 2026 10:38:19 GMT</pubDate>
            <atom:updated>2026-01-20T13:23:24.394Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the past year, I’ve delivered almost-monthly presentations tracking the volatile evolution of Artificial Intelligence. This blog post is a curation of that journey. A look at the signals that truly stood out amidst the noise.</p><p>If 2024 was defined by the strategy that “bigger is better,” 2025 was the year that approach hit a wall. The industry encountered hard limits regarding energy, memory, and diminishing returns exemplified by Meta’s Behemoth and OpenAI’s GPT 4.5, learning a necessary lesson: a larger data center does not guarantee a smarter model.</p><p>At the same time, the narrative shifted. Raw scale was replaced by architectural stability, ecosystem interoperability, and strategic diversification of hardware and model suppliers. Rather than a single vendor dominating, a more fragmented landscape emerged with partnerships between major players and alternative labs eroding monopolies, pushing prices down, and accelerating API standardization. This reduced vendor lock-in and lowered integration friction, signaling the end of uncontested dominance for single incumbents.</p><p>In this context, Google made a strong come-back with Gemini 3 while others like xAI’s Grok embodied the “move fast and break things” ethos: rapid iteration brought benchmark competitiveness and viral adoption, but also controversies and real-world pitfalls.</p><p>In the wider economy, AI transitioned from novelty to operational utility. Quietly becoming the cost-saving background music in hotels and the engine behind fully synthetic commercials for major brands like Coca Cola and Toys “R” Us.</p><p>As we look toward 2026, the primary risks are no longer just technical, but physical and political: supply chain constraints and geopolitical challenges loom large.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8vqiVPdRFh9tFYrHbejloQ.png" /><figcaption>How AI Grew Up in 2025</figcaption></figure><h3>New architecture patterns due to the rise of agents</h3><p>Efficient usage of agents requires a suitable architecture. Read more about that <a href="https://medium.com/researchable/the-modern-ai-architecture-stack-3ec3fbf81848">here</a>. 2025 was the year this became very concrete.</p><ul><li>MCP (Model Context Protocol) became the de-facto “USB-C for tools”, with MCP servers showing up in many products.</li><li>Google pushed Agent2Agent (A2A) as the “agents talking to agents” layer, explicitly positioning it as vendor-neutral and production-ready (OAuth/OIDC, long-running tasks, artifacts).</li></ul><p>This allowed reuse of integrations (MCP), long running agent conversations (A2A), decoupling of servers and clients (MCP Gateway). It is always the question though whether this additional complexity is worth it for the use cases where a fixed flow is suboptimal (and this is usually a small percentage).</p><h3>Vibe coding matured</h3><p>Software Engineering as a profession is changing. Using vibe coding to quickly get started, generate prototypes, fix bugs or generate documentation became viable and gave an actual boost to developer productivity in 2025. It is not niche anymore and personally I think people not using AI tools to code will run into challenges in the future since they will not be able to compete with developers that do.</p><ul><li>Quickly building application scaffolds for demo’ s from prompts is possible now. For example using <a href="https://lovable.dev/">https://lovable.dev/</a>, <a href="https://v0.app/">https://v0.app/</a>, <a href="https://www.aura.build/">https://www.aura.build/</a> or others.</li><li>Vibe IDEs became widely available and popular. GitHub Copilot, OpenAI Codex, Claude Code, Google’s Antigravity, Cursor, Windsurf. Most of them use VSCode as base.</li></ul><p>This isn’t replacing software engineering. It’s compressing the distance between idea → prototype → first usable version. And that has a major impact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZnWOWzRW_ob33h29H8Gjpg.png" /><figcaption>Coding became so much easier</figcaption></figure><h3>Intelligence became decentralized</h3><p>The focus on efficiency over scale established the Small Language Model as the defining architecture of 2025. By decoupling reasoning capabilities from conversational fluency, the industry successfully compressed intelligence into sub-10 billion parameter models that operate locally on battery-powered hardware. This shift was driven by the twin necessities of privacy and zero-latency performance, forcing a transition where neural processing units on smartphones and wearables began processing sensitive data that previously demanded cloud transmission. Also in the defense sector there is great interest in the topic. It could enable (for example) drones to operate more independently of an internet connection or explicit steering signal removing a liability.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RWlKicberAxBj_dvMTrOaQ.png" /></figure><h3>Diversification in hardware and model suppliers</h3><p>Microsoft is moving beyond exclusive reliance on OpenAI, notably integrating Claude into GitHub and Microsoft 365 Copilot as a strategic partnership. Simultaneously, Anthropic has secured a major hardware deal with Google, challenging NVIDIA’s ubiquity. This diversification erodes monopolies, likely driving down prices and accelerating API standardization. This reduces vendor lock-in and integration friction for the industry, and signals the end of uncontested dominance for OpenAI and NVIDIA.</p><h3>Winners and losers</h3><h4>Winner: China with DeepSeek and Qwen</h4><p>China was pushed to focus on efficiency because its access to advanced Western AI chips is constrained by export controls and domestic self-reliance policies, forcing developers to optimize for lower computational cost and energy use rather than brute-force scale.</p><ul><li>DeepSeek shook up the world because they successfully dismantled the industry’s two biggest assumptions: that only massive US tech giants could build state-of-the-art models, and that performance gains required exponentially more budget. By releasing DeepSeek-R1, they didn’t just catch up; they proved that architectural efficiency beats raw scale. They delivered “reasoning” capabilities, previously only available behind the closed doors of OpenAI, at a fraction of the cost and energy. They commoditized high-end intelligence. Developers realized they didn’t need a billion-dollar data center to run world-class AI.</li><li>Alibaba Qwen models became the best performing open weights models at the end of 2025 surpassing Meta Llama.</li></ul><p>When Chinese teams released efficient, cheaper, and open-weight models that delivered performance close to very expensive Western counterparts, it drove widespread adoption of Chinese models, and forcing Western labs and policymakers to reassess strategies around openness, cost and innovation.</p><p>This is good news for people who do not want to be dependent on the large suppliers (want to avoid vendor lock-in and US dependence) and want to run models in their own data center.</p><h4>Winner: Google’s comeback year</h4><p>Google spent years being the company with the most AI research and the least convincing product narrative. In 2025 it started acting like a company that wants to win again. New models like Gemini 3 and Nano Banana were state of the art and scored best on benchmarks. Google Antigravity also quickly gained popularity. Google is back in the game!</p><h4>Loser: Meta</h4><p>At the start of 2025 the Meta Llama models were state of the art and the best open weights models. However at the end of 2025, Meta is not a serious player anymore. Meta’s Behemoth failed (they even cheated on benchmarks) and the newer Meta models are outperformed in almost all possible ways by Chinese competitors. In addition, Meta bet big on the so-called metaverse. A VR environment. This is being defunded within Meta at the moment. I doubt Meta is going to make a serious comeback in the open source model world. Currently they are betting on augmented reality glasses. We’ll see how that’ll work out for them.</p><h4>Loser: Stability AI</h4><p>Stable Diffusion was the first serious open source image generation model. A large ecosystem was created around it by the community using it. Tools like ControlNet emerged, many finetunes and Lora’s were created. The company however did not do well financially. Important people within the company went away. Some moved to companies like Black Forest Labs (creator of Flux models). Competing products arose like Flux, Qwen Image, Z Image Turbo. Stability AI lost the community due to various reasons. They still exist but as a relatively small SaaS provider and do not play a meaningful role in the open source image generation community anymore.</p><h3>Grok: Move fast and Break things</h3><p>xAI Grok one does not clearly fit in either winners or losers category but is worth mentioning. From virtually non-existent to benchmark-competitive in under a year, xAI pulled off a technical marvel, but the cost was deepfake scandals, extremist outputs, and hallucinated “facts”.</p><ul><li><strong>Non-consensual sexual “nudification” / deepfake abuse<br></strong>Including reports of content involving apparent minors), with regulators and watchdogs investigating and X applying partial/geofenced restrictions.</li><li><strong>Hate speech / extremist outputs<br></strong>High-profile incidents of antisemitic content and praise for Hitler, prompting takedowns and political backlash.</li><li><strong>Misinformation risk when used as a “fact-checker”<br></strong>Hallucinations + reliance on X posts can amplify falsehoods at scale.</li><li><strong>Owner/ideology alignment concerns<br></strong>Positioned as “anti-woke/free speech,” with reporting that Grok can mirror Musk’s views or be manipulated around Musk-related topics.</li><li><strong>Privacy/data-use concerns<br></strong>A flaw in the sharing feature caused “private” user conversations to be indexed by search engines, exposing sensitive data to the web, from passwords to personal confessions.</li><li><strong>Inconsistent safeguards across surfaces<br></strong>Restrictions applied inside X, while similar capabilities persist via the standalone app/website in some cases.</li></ul><p>I would not recommend using Grok in business context, because likely in the coming year(s) there will be more scandals and issues like above. Grok is going to be used at the US Department of War. What could go wrong?</p><p>You cannot trust Grok output. It might be factually incorrect, misaligned and even illegal. Virtually every other supplier does a better job at this.</p><h3>Other media</h3><h4>Image editing became practical</h4><p>Text-to-image was last year’s party trick. In 2025, editing became relevant.</p><ul><li><strong>Open weights <br></strong>Flux Kontext and Qwen Image Edit are capable of convincingly editing photos based on text prompts while keeping consistency. These models have open weights and can run on local hardware.</li><li><strong>Proprietary</strong><br>OpenAI ChatGPT Images and Google Nano Banana are powerful solutions capable of even more.</li></ul><p>Of course deepfakes become a lot more easy to create and realistic using such tooling so a photo is no convincing evidence anymore. People are easy to fool so please check your sources!</p><h4>AI can generate usable commercials</h4><p>Tools like Google Veo, OpenAI Sora and Runway are capable of generating video’s of usable commercial quality. Companies like Coca Cola and Toys “R” Us have used it in their public commercials.</p><p>Better open weights video generation models have become available (also some including audio!). These can run on local hardware. Examples like WAN, HunyuanVideo, LTX. Not the same quality as the proprietary commercial models though.</p><h4>AI music getting traction</h4><p>Music generation using tools such as Suno is becoming available and licenses tend to be a lot cheaper than a licenses to play human created music, making this a viable alternative. This is of course not good news for musicians. Companies like Carrefour, Brico, Krëfel, X2O, Oh’Green, W Hotels (Marriott) already use AI generated music in public spaces instead of traditional human made music.</p><h3>The look forward to 2026. Constraints</h3><p>If 2024 was “bigger is better,” 2025 ended with “bigger is expensive,” and 2026 looks like “bigger is… often unavailable.” The limiting factor is no longer model architecture . It’s supply chains under geopolitical stress and a market that’s running out of patience for marginal gains.</p><h4>Supply chains under pressure</h4><ul><li><strong>US–EU frictions<br></strong>US reducing its aid to Ukraine after the Ukraine was invaded by Russia and US threats of Greenland hostile takeover, add political risk pushing Europe toward digital autonomy and reduced dependency on US platforms. For example expect market share of Mistral in the EU to rise.</li><li><strong>Europe–China tensions</strong> are also rising<br>The Dutch government’s intervention at Nexperia is a concrete example of chips becoming a strategic asset, not just a market product. Add the possible China Taiwan invasion on top, and “chip availability” becomes a serious concern.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hvapSzdLF_mR2CPIAN5LTQ.png" /><figcaption>Can’t we just be friends and all work on making it better for everyone? Don’t fight please!</figcaption></figure><h4>Chips go to data centers first</h4><p>AI data center demand will keep absorbing hardware production capacity which means consumer markets suffer and prices drift upward when scarcity hits.</p><p>A prime example of this is Nvidia project DIGITS. Initially unveiled in early 2025 as a affordable inference machine of $3,000, the system was later rebranded as the Nvidia DGX Spark and saw its price climb to $3,999. With current scarcity now pushing the effective buyable price in the EU to approximately €4,750.</p><p>Also the memory prices have become unpleasant recently;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L4mreCcsQl_NdMNe.png" /><figcaption>Image taken from <a href="https://www.pcbuildadvisor.com/we-tracked-ram-memoryprices-in-2025-this-is-what-we-found-and-what-you-should-expect-in-2026/">https://www.pcbuildadvisor.com/we-tracked-ram-memoryprices-in-2025-this-is-what-we-found-and-what-you-should-expect-in-2026/</a></figcaption></figure><p>Thus for consumers and data center suppliers alike, now it not a good time to buy.</p><h4>Investors want an ROI story</h4><p>After two years of unprecedented AI investments, incremental functional gains feel smaller while the bills keep rising. In 2026, I expect investors to demand clearer returns and if expectations become more realistic, a correction could reduce hardware demand and bring pricing back down.</p><h4>Practical takeaway</h4><p>I’m lowering my investment risk profile for the coming period and postponing buying a new inference system, because I expect meaningful price drops later in 2026.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9dd082d02e5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/researchable/ai-year-review-2025-f9dd082d02e5">AI Year Review 2025</a> was originally published in <a href="https://medium.com/researchable">Researchable | Strategic Data &amp; AI-partner</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NVIDIA's Moat is Leaking: The Rise of High-Bandwidth CPUs]]></title>
            <link>https://medium.com/researchable/nvidias-moat-is-leaking-the-rise-of-high-bandwidth-cpus-b4d4578457e4?source=rss-918a6ecf5e32------2</link>
            <guid isPermaLink="false">https://medium.com/p/b4d4578457e4</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[epyc]]></category>
            <category><![CDATA[nvidia]]></category>
            <category><![CDATA[moe]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Maarten Smeets]]></dc:creator>
            <pubDate>Fri, 02 Jan 2026 13:24:15 GMT</pubDate>
            <atom:updated>2026-01-14T11:58:52.652Z</atom:updated>
            <content:encoded><![CDATA[<p>For years, the industry assumption was that the path to Artificial General Intelligence (AGI) was simply a matter of engineering logistics. We built the data centers and bought the HBM under the doctrine that “bigger is better”. But as we reach 2026, the failure of dense, monolithic models like Meta’s 2-trillion parameter “Behemoth” and OpenAI’s GPT 4.5 have proven that this era is over.</p><p>We are witnessing an efficiency correction. The industry is pivoting from massive dense models to efficient Mixture of Experts (MoE) architectures, fundamentally restructuring how intelligence is computed and stored.</p><p>This isn’t just a software change; it has ripple effects that are reshaping the hardware landscape. In this post, I want to analyze how this “DeepSeek Effect” shattered the capital moat of training, why memory bandwidth has replaced FLOPs as the critical bottleneck, and why your next inference server might need a high-bandwidth CPU rather than a scarce GPU.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-tc0fJpmGqA07H8aUDbJZA.png" /><figcaption>Due to MoE models, high bandwidth CPUs are becoming a viable alternative to expensive GPUs</figcaption></figure><h3>The Wall: The Collapse of “Bigger is Better”</h3><p>We have been operating under the assumption that 10-trillion parameter dense models were the inevitable future. That assumption has essentially collapsed.</p><p>The most telling example is Meta’s “Behemoth” project. Designed as a 2-trillion parameter dense model, where every parameter is active for every calculation. It was supposed to be the apex of AI. Instead, it became a case study in inefficiency. The sheer scale introduced training instabilities that were algorithmically fragile, and the reliance on synthetic data led to “model collapse,” where the model started drifting from reality.</p><p>We have hit a performance plateau. The days where doubling the size of a model meant doubling its intelligence are over. Now, making a model twice as big might barely improve it, but it will definitely cost four times as much to run.</p><p>Just look at the reception of OpenAI’s GPT-4.5. Instead of being celebrated for its size, it was criticized for being “bloated”. Users found it unnecessarily wordy, using far more tokens and therefore more energy and money to convey the exact same amount of information.</p><h3>The Pivot: DeepSeek, Qwen, and the MoE Revolution</h3><p>If dense models are the past, what is the future? It seems to be Mixture of Experts (MoE).</p><p>The shockwave hit early last year when DeepSeek released DeepSeek-V3. The industry standard for training a top-tier model was around $100 million. DeepSeek did it for $5.6 million.</p><p>How? By decoupling “knowledge capacity” from “inference cost.” DeepSeek-V3 has a massive 671 billion parameters, but it only activates 37 billion per token. This is a fundamental architectural shift. It proves that intelligence isn’t about brute force; it’s about routing efficiency.</p><p>Alibaba’s Qwen 3 series has taken this further. The Qwen 3–235B model activates only 22 billion parameters per token, allowing it to punch way above its weight class while remaining economically viable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IguZ_KEFgC_XXnWm56qPWQ.png" /><figcaption>MoE architecture has been a major enabler in making inference cheaper.</figcaption></figure><h3>The Hardware Realignment: Bandwidth is the New Bottleneck</h3><p>This is where the story gets fascinating from a hardware perspective. The shift from dense monolithic models to Mixture of Experts (MoE) has fundamentally changed the physics of AI inference.</p><p>With MoE, the computational load (FLOPs) drops significantly because the model only calculates a fraction of the weights per token. However, the <em>entire</em> massive model must still reside in memory to be accessible. Consequently, the bottleneck has shifted from Compute (How fast can I calculate?) to Memory Bandwidth (How fast can I move data?).</p><p>Attempting to run these massive models on traditional GPU clusters is becoming economically unviable. To get 128GB+ of VRAM, you are forced to chain together multiple consumer cards (like RTX 4090s) or buy exorbitant enterprise cards. This leads to complex, hot, power-hungry systems that are a nightmare to manage outside of a data center.</p><p>The industry’s answer to the VRAM problem is Unified Memory Architecture (UMA). Placing massive RAM pools directly next to the compute silicon. But not all UMA is created equal.</p><h4><strong>Nvidia DGX Spark</strong></h4><p>Nvidia recently launched “Project Digits” (DGX Spark), marketing it as a “personal AI supercomputer” for developers.</p><ul><li>Specs: GB10 Grace Blackwell Superchip, 128GB Unified Memory.</li><li>The Catch: The memory bandwidth is capped at 273 GB/s. While 128GB is enough to store a quantized version of DeepSeek-V3, the low bandwidth acts as a choked pipe, making token generation sluggish.</li></ul><h4><strong>Mac Studio (M4 Max)</strong></h4><p>In a strange twist, a consumer desktop has humiliated the specialized developer tool. The Mac Studio (M4 Max) with 128GB of memory hits the “magic number” for local inference.</p><ul><li>Performance: It delivers a staggering 546 GB/s of bandwidth . Double that of the DGX Spark.</li><li>Cost: At roughly $4,500, it is a plug-and-play solution.</li><li>The Downside: It is a closed garden. The RAM is soldered; you cannot upgrade it later.</li></ul><h3><strong>The Unexpected Winner: AMD EPYC (“Turin”)</strong></h3><p>For those who need future-proofing without the “walled garden” of Unified Memory, the 5th Gen AMD EPYC 9005 is the standout choice.</p><p>The bottleneck for MoE models is moving data from RAM to the cores. Apple and NVIDIA solve this with soldered, on-chip memory pools. AMD solves it with the EPYC 9005’s massive I/O, featuring 12 memory channels per socket that allow standard RAM to rival accelerator speeds.</p><ul><li>Raw Throughput: It delivers ~600 GB/s of bandwidth.</li><li>The Price of Openness: Unlike the fixed memory of the DGX or Mac, this platform uses commodity DDR5 ECC modules. A complete system with a 192GB configuration (12 x 16GB) costs roughly €5,000.</li></ul><p>This represents a victory for traditional architecture. For memory-bound MoE inference, you don’t necessarily need a GPU; you need a wide lane for your data. The EPYC provides exactly that; fast, vast, and fully expandable memory access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FeBPLBe8fzMEAMv1aYJz5w.png" /><figcaption>All systems cost around roughly €5K. The AMD EPYC system can run the largest models. The Gen 4 AMD EPYC is about 1/4 slower but for about the same cost you create a system with double the RAM making it possible to run even larger models.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*co3hAvl6Uue8wPxSVyjy1Q.png" /><figcaption>AMD EPYC “Turin” is a surprising winner in the affordable inference competition</figcaption></figure><h3>Conclusion</h3><p>The AI industry is sobering up. The “bubble” hasn’t burst (yet?), but the free lunch of monolithic scaling is definitely over.</p><p>For those of us building systems, the takeaway is clear:</p><ul><li>Architecture Matters: We are moving away from dense, brute-force models to sparse, efficient MoE architectures (DeepSeek, Qwen).</li><li>Hardware is Shifting: Don’t just blindly buy GPUs. For local inference of these new models, High-Bandwidth CPUs (like EPYC) are becoming the optimal cost-performance vehicle.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4d4578457e4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/researchable/nvidias-moat-is-leaking-the-rise-of-high-bandwidth-cpus-b4d4578457e4">NVIDIA&#39;s Moat is Leaking: The Rise of High-Bandwidth CPUs</a> was originally published in <a href="https://medium.com/researchable">Researchable | Strategic Data &amp; AI-partner</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Modern AI Architecture Stack]]></title>
            <link>https://medium.com/researchable/the-modern-ai-architecture-stack-3ec3fbf81848?source=rss-918a6ecf5e32------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ec3fbf81848</guid>
            <category><![CDATA[mcp-gateway]]></category>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[a2a-protocol]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[mcp-server]]></category>
            <dc:creator><![CDATA[Maarten Smeets]]></dc:creator>
            <pubDate>Mon, 24 Nov 2025 11:43:57 GMT</pubDate>
            <atom:updated>2026-01-14T11:58:55.443Z</atom:updated>
            <content:encoded><![CDATA[<p>The hype around Agentic AI is real, but moving from a compelling demo to a production-ready system reveals significant architectural gaps. Most developers start by wrapping APIs for basic function calling , a method that works for prototypes but creates a fragile foundation for scale. While function calling offers flexibility, it often degrades into a high-maintenance monolith plagued by tight coupling and operational overhead. This guide outlines a clear architectural roadmap to solve these issues, taking you from basic tool usage to a resilient, federated architecture using MCP, Gateways, and A2A protocols.</p><h3>Decoupling Agents from Tools with MCP</h3><p>The primary challenge with a basic function-calling architecture is tight coupling. In early iterations, the agent’s code frequently possesses direct, hardcoded knowledge of the implementation of its tools. Consequently, every time a new data domain is added, developers are forced to update the backend API, the client calling it, and the tool definition registered within the agent itself.</p><p>The solution to this rigidity is the Model Context Protocol (MCP), a standard that fundamentally alters the dynamic between agents and tools. By adopting MCP, the agent no longer houses hardcoded definitions. Instead, it queries a single MCP endpoint at runtime to discover available tools and their schemas dynamically.</p><p>This architectural shift unlocks zero-touch tool evolution, where adding a new capability only requires updating the server-side manifest. Connected clients automatically discover and utilize the new tool without requiring any changes to their own code. Furthermore, this approach encourages the design of intent-based APIs that allow the LLM to reason more effectively about when to employ a specific tool, rather than getting bogged down in granular data access.</p><h3>Centralizing Control with an MCP Gateway</h3><p>As an AI system matures and expands to include external data sources beyond curated internal datasets, teams encounter a new wave of complexity. While having access to diverse data streams is advantageous, it necessitates a new pattern to manage the chaotic reality of multiple, independent tool servers.</p><p>Scaling introduces specific challenges, such as fragmented security where each endpoint demands its own authentication logic, and poor observability that makes it difficult to monitor system health or attribute costs across distributed requests. Additionally, as the number of tools grows, the manifest can become unwieldy, consuming the LLM’s valuable context window and driving up costs.</p><p>To address these issues, architects should implement an MCP Gateway, a centralized reverse proxy situated between the AI agent and its backend tool servers. This component transforms the architecture by acting as a unified security perimeter, enforcing a single, auditable policy across all downstream services.</p><p>The Gateway also provides topology abstraction, meaning the agent only needs to connect to one endpoint regardless of how many services lie behind it, allowing backends to be migrated or swapped without touching agent code. Crucially, this centralization allows for “manifest virtualization,” where the Gateway dynamically filters which tools are exposed based on the user’s role or context. This capability significantly reduces context window usage and provides a centralized control point for rate-limiting and token budgeting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O1qrm8TlAoJlxRCEFQE96A.png" /><figcaption>A single MCP Gateway sits between AI agents and both internal and external tool servers, unifying auth, policy, routing, and observability while exposing a single, simplified endpoint to clients.</figcaption></figure><h3>Enabling Collaboration with the A2A Protocol</h3><p>While the MCP-based architecture provides a robust foundation for static integrations where an agent calls a tool and receives a reply, it faces limitations when tackling complex, long-running tasks.</p><p>One major hurdle is the “Synchronous Barrier.” Complex queries that require analyzing massive datasets may take minutes to process, making a standard synchronous request-response model unviable due to potential timeouts and blocked user interfaces. Furthermore, high-quality outputs often require “Iterative Clarity,” where the agent must pause to ask clarifying questions mid-process rather than demanding all information upfront.</p><p>To overcome these barriers, systems can adopt the Agent-to-Agent (A2A) protocol, which governs “horizontal” communication between collaborating agents, distinct from the “vertical” communication of agents calling tools.</p><p>Implementing A2A unlocks asynchronous “fire and forget” capabilities, allowing systems to handle long-running tasks without timeouts and notify users when results are ready. It facilitates multi-agent federation where independent agents can discover each other’s capabilities via “Agent Cards” and coordinate work, such as a primary agent delegating specific sub-tasks to specialized counterparts. This protocol also introduces a trust and accountability layer using digital signatures to verify identities and create auditable records of task handoffs. Finally, it supports human-in-the-loop workflows, enabling the system to pause and request clarification before resuming, which allows for truly conversational problem solving.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jWWaPGWjlKc1NQ6YAIgInA.png" /><figcaption>An external agent delegates a task to a domain agent via the A2A protocol, which in turn orchestrates MCP tool calls through a gateway to internal and external servers, then returns an aggregated, provenance-rich answer back to the caller.</figcaption></figure><h3>Summary</h3><p>Most teams don’t start with an architecture diagram; they start with a single happy path. And that’s fine. A well-designed fixed flow will often cover 80–90% of your use cases with minimal complexity and operational overhead.</p><p>The uncomfortable question is what you do about the remaining 10–20%. Are those edge cases trivial… or are they the high-value, high-risk journeys where a brittle, synchronous flow quietly fails your users?</p><p>Agentic flows, MCP, an MCP Gateway, and A2A all come with real cost: more moving parts, more policies, more dashboards to watch. They only make sense when they clearly beat a fixed flow. That suggests a pragmatic path:</p><ul><li>Start simple, and let fixed flows carry the easy 80–90%.</li><li>Introduce agentic flows where they demonstrably outperform static workflows.</li><li>Use MCP to decouple agents from tools so capabilities can evolve without client rewrites.</li><li>Add an MCP Gateway when you need a single control plane for auth, routing, logging, caching, and cost controls. One endpoint; many services.</li><li>Layer in A2A for long-running, multi-agent work where handoffs, callbacks, and provenance actually matter.</li><li>Pair all of this with curated domain data and solid observability so you can measure success, cost, and latency instead of guessing.</li></ul><p>In the end, the real architectural decision isn’t “fixed vs agentic.” It’s deciding which parts of your problem space deserve the full weight of an agentic, federated AI stack — and which are better served by a simple, reliable flow that just works.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ec3fbf81848" width="1" height="1" alt=""><hr><p><a href="https://medium.com/researchable/the-modern-ai-architecture-stack-3ec3fbf81848">The Modern AI Architecture Stack</a> was originally published in <a href="https://medium.com/researchable">Researchable | Strategic Data &amp; AI-partner</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Multi-Persona Chat App with LLMs: Prompt Engineering, Reasoning, and API Challenges]]></title>
            <link>https://medium.com/researchable/building-a-multi-persona-chat-app-with-llms-prompt-engineering-reasoning-and-api-challenges-239244931c60?source=rss-918a6ecf5e32------2</link>
            <guid isPermaLink="false">https://medium.com/p/239244931c60</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[reasoning]]></category>
            <dc:creator><![CDATA[Maarten Smeets]]></dc:creator>
            <pubDate>Thu, 17 Apr 2025 13:28:34 GMT</pubDate>
            <atom:updated>2026-01-14T11:57:37.508Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*C4zqla1AlZx4VEvf.png" /></figure><p>Recently, I started working on a multi-persona chat application as a hobby project. You can find it <a href="https://github.com/MaartenSmeets/AutoChatManager">here</a>, along with complete documentation on how to set it up and what it does. The interactions between characters and their environment are generated by an LLM, and throughout the development process, I learned several valuable lessons that I want to share in this post.</p><p>From prompt engineering to model selection and API usage, I ran into various challenges and had to refine my approach multiple times. Some things worked as expected, others didn’t, and a few surprised me entirely. This blog outlines the key takeaways — what worked, what didn’t, and what I would do differently next time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IsqzlKmjNNBaOrsL.png" /></figure><h3>Prompting for code editing</h3><h4>Separation of Code and Prompts</h4><p>When the code and prompts are in the same file and you update the file using for example ChatGPT or GitHub Copilot, it is likely the LLM will also make (usually unwanted) changes to the prompts. If you do not notice these changes, they can influence your application behavior. It is a smart thing to keep the prompts and code clearly separated and preferably in separate files to avoid this.</p><h4>High-Quality Inquiries</h4><p>I found that when making changes to code, it usually works better to one-shot the change instead of letting the LLM generate an answer and continue finetuning that with follow-up questions. Usually, the better models have quota which limit their use and thus asking fewer but more high-quality questions allow more efficient usage of that quota.</p><h4>Incremental Changes</h4><p>Usually when editing code using an LLM, I want to make several changes at the same time and I want to avoid making too many separate calls. I used to have prompts like the following which worked fine on small codebases;</p><pre>Update the following code and return the complete updated functions which need to be changed to achieve the requested functionality. no pseudocode, no suggestions for improvements, no partial implementations but complete working robust updated functions. Files or functions which do not need to be changed do not need to be mentioned.</pre><pre>INSTRUCTIONS</pre><pre>CHANGE 1: do this and that to the backend<br>CHANGE 2: fix this bug<br>CHANGE 3: update the frontend</pre><pre>Below is my complete codebase:</pre><pre>CODE</pre><pre>code...</pre><p>When the codebase became larger however, making many changes at the same time started to cause issues. It was hard to debug and usually the model did not manage to make all changes at the same time. This caused me to supply a single change request at a time to get better results.</p><h4>Model selection</h4><p>Many of the things relating to model choice and usage have been previously discussed <a href="https://technology.amis.nl/data-analytics/ai/unlocking-the-power-of-chatgpt-for-coding-insights-tips-and-best-practices/">here</a>. Some new models have become available in the meantime. I’ve mainly used o1 and o3-mini for this application. I do not have paid subscriptions for Claude, Gemini and DeepSeek but experiences with the free versions of those were worse. Claude and DeepSeek had difficulty making solid code changes in large codebases (did fine with small codebases) and Gemini did not have enough output tokens to be useful (at the moment of writing, limited to 8K tokens in Google AI Studio). Reasoning models did better than non-reasoning models for coding. No solid numbers/measures but personal experience.</p><p>Splitting the roles during development for a model into an architect and an editor and choose specific models for each task can yield even better results (see <a href="https://aider.chat/2024/09/26/architect.html">here</a>). I did not yet go that far but can imagine that for larger scale projects this can be beneficial.</p><h3>Prompting for the multi-persona chat application</h3><h4>Focused context</h4><p>At first, I send in a request which contained all the required information for generation of an interaction. Inputs were a lot of context, previous thoughts, previous visible actions from other characters, previous summaries. As output I wanted plan changes, appearance changes, dialogue, actions, reasons for every change. My prompt itself was very long and complicated with many instructions for interactions such as to prioritize responding to the latest message, to align actions to milestones in order to reach the goal, when to leave fields empty or not, try to keep everything within the characters behavioral patterns (which are of course described in great detail to steer behavior).</p><p>The results were not so good. There was little progress in the interactions / story. The characters tended to forget who they were in responding and would mix up responses. The replies were often not good in all output parameters.</p><p>I decided to functionally split up my flow. I limited the interaction to just action and dialogue. I decided to handle location, appearance, plan changes separately. Thus first create or update the steps and goal. Next generate the action/dialogue based on the plan and the context. Next determine if the action/dialogue lead to appearance and location changes.</p><p>This greatly reduced the context I needed to get my request to the LLM. It also very much simplified my prompts which were now a lot more focused. The drawback however is more LLM requests and similar context needs to be send multiple times.</p><h4>Systematic Prompt Structuring</h4><p>It is important what you put in the system prompt and what in the user prompt. System prompts should be mostly static and guide the general behavior of the model. User prompts are usually dynamic and specific. Some models like DeepSeek R1 do not support a separate system prompt. In such a case you should concatenate the system prompt and user prompt and provide them as a single prompt. A certain amount of redundancy helps guide the model answers but more redundancy means the other content gets less attention because it is a smaller part of the entire context.</p><p>Prompts can be model specific. They can work well on one model but not at all on another. This has many reasons. Clarity in prompts helps make prompts which can be used universally.</p><h4>Structured Outputs</h4><p>I would say using structured output in code is essential and it is not difficult to implement. Read for example <a href="https://ollama.com/blog/structured-outputs">here</a> and <a href="https://platform.openai.com/docs/guides/structured-outputs">here</a>. This allows you to supply an output JSON structure which the model output needs to conform to and most recent models support this. This works a lot better then asking the model to create JSON and parsing the response afterwards. It still helps to provide a sample output JSON in the request to improve the results. Also it helps to keep the output JSON simple and of course implement retries when certain fields are empty but should not be empty in the result or if there are relations between fields in the output which can be checked. When performing retries I supplied the previous request, response and an instruction what is wrong so the LLM can fix it. N.b. I use Pydantic models structured output. There are several libraries available which allow more elaborate output checking and make the retry cycle easier.</p><h4>API Selection</h4><p>When choosing an API, there are generally two options:</p><ul><li><strong>Chat API</strong> — Designed for multi-turn conversations, incorporating roles like “user” and “assistant.”</li><li><strong>Generate API</strong> — Optimized for single-turn requests, requiring all necessary context upfront.</li></ul><p>Initially, I assumed the Chat API would be a good fit for my multi-persona chat application. However, I quickly realized its limitations — it works well when the use case aligns perfectly, but lacks flexibility for more complex requirements.</p><p>The Generate API, on the other hand, presents a different challenge: since it processes a single request at a time, you must provide a fully constructed context for the model to make accurate decisions. This can become a lot of data, so my application summarizes messages after a certain threshold and even condenses those summaries when they accumulate.</p><p>Additionally, each character in my chat system has unique thoughts, emotions, and plans that influence their perspective. These internal states aren’t visible to others, leading different characters to generate distinct summaries of the same events. This approach ensures more nuanced and context-aware interactions but requires careful prompt structuring and context management.</p><h4>Reasoning</h4><p>Reasoning models are becoming more popular. OpenAI o1, o3, DeepSeek R1, Gemini 2 Thinking. Are they suitable for a usecase as a chat application? No. I had already implemented reasoning capabilities myself in several ways;</p><ul><li>Characters make plans and the next step in their plan and the goal is context for creating interactions</li><li>I ask the model to explain in several prompts why it does certain things. This helps guide the model to obtain more structured output</li></ul><p>Reasoning models are not really something new or special. What they do is output so-called ‘think tokens’ (also called reasoning tokens, and planning tokens). These tokens are output first in the response. The models creates its output based on the input and what has already been produced as output. In case of reasoning models the reasoning is output first and thus used in the generation of whatever comes after that. This has several consequences;</p><ul><li>The reasoning can be looked at and this can be used to debug/improve your request. Great for coding.</li><li>The usable output context is a lot smaller.The thinking tokens are usually not directly usable in the application.</li><li>Usable output is usually more concise / less verbose than is the case with non-reasoning models. When generating a story, I prefer more prose and more verbosity.</li></ul><p>I noticed that for this usecase it helps to use a model which is good in following complex instructions and does not reason since the reasoning is generated in separate requests and supplied. For me those models were at the moment of writing (this can quickly change) <a href="https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct">Llama 3.3 70B</a> and <a href="https://huggingface.co/mistralai/Mixtral-8x22B-v0.1">Mixtral 8x22B</a>. Mixtral is faster, and Llama 3.3 is smarter.</p><h4>Ensuring Text Diversity with Dual Similarity Measures</h4><p>I’ve used a two-way approach to keep the generated interactions — from a character’s actions to their dialogue — engaging and diverse. To avoid the pitfall of repetitive or overly similar outputs, I rely on two complementary methods:</p><p><strong>Embedding and Cosine Similarity</strong><br>An embedding model transforms text into high-dimensional vectors that encapsulate its semantic meaning. By computing the cosine similarity — the measure of the angle between two vectors — we can gauge how semantically close two pieces of text are. If, for example, a generated dialogue is nearly identical in meaning to the corresponding action or to recent messages from the same character, the cosine similarity score will be high (close to 1), triggering a flag for revision.</p><p><strong>Jaccard Similarity</strong><br>Complementing the embedding approach, I also use a token-based Jaccard similarity metric. This method compares the sets of words in the texts by calculating the ratio of their intersection over their union. Essentially, it provides a surface-level check that highlights when texts share many of the same words or phrases — even if their overall meanings differ somewhat. This extra layer helps catch literal overlaps that the embedding might overlook.</p><p><strong>Combined Evaluation</strong><br>Both similarity measures are applied to each candidate text against previous messages and across different fields (like comparing a character’s action with their dialogue). If either the cosine or the Jaccard similarity exceeds a predefined threshold (typically around 0.8), the system deems the output too repetitive and automatically prompts the model to regenerate the text with refined instructions. This dual strategy ensures that every interaction remains fresh and varied, steering clear of excessive repetition or verbatim copying from earlier dialogue.</p><h3>Finally</h3><p>Developing the AutoChatManager application has been an insightful journey, reinforcing several key lessons in prompt engineering and application design.</p><h4>Prompting for Code Editing</h4><ul><li><strong>Separation of Code and Prompts</strong>: Keeping code and prompts in separate files prevented unintended modifications during updates, ensuring application stability.</li><li><strong>High-Quality Inquiries</strong>: Formulating concise, well-thought-out questions led to more effective interactions with language models, optimizing resource usage.</li><li><strong>Incremental Changes</strong>: Implementing one change at a time facilitated easier debugging and maintained code integrity.</li><li><strong>Model Selection</strong>: Choosing the appropriate model is crucial. Reasoning models are great for coding!</li></ul><h4>Prompting for the Multi-Persona Chat Application</h4><ul><li><strong>Focused Context</strong>: Limiting the context provided to the language model improved the relevance and coherence of generated interactions.</li><li><strong>Systematic Prompt Structuring</strong>: Clearly defining system and user prompts enhanced the model’s understanding and response accuracy.</li><li><strong>Structured Outputs</strong>: Utilizing structured output formats ensured consistency and facilitated easier parsing of model responses.</li><li><strong>API Selection</strong>: Choosing the appropriate API, such as the Generate API over the Chat API, provided greater control over context management and interaction flow.</li><li><strong>Reasoning Model Use</strong>: Instead of relying on reasoning models to generate interactions, reasoning is handled separately in structured steps before being passed to the model. Models like Llama 3.3 70B and Mixtral 8x22B performed better for multi-character interactions than pure reasoning models like o1, o3, or DeepSeek R1.</li></ul><h4>Ensuring diversity in responses</h4><p>I use a two-way approach to ensure every character interaction stays engaging and diverse. First, an embedding model computes cosine similarity to capture the semantic closeness of texts, flagging any dialogue that mirrors actions or recent messages too closely. Then, a token-based Jaccard similarity check catches surface-level word overlaps. By applying both methods and regenerating outputs when either score exceeds a threshold (typically around 0.8), the system effectively prevents repetition and keeps the conversation dynamic.</p><h4>Building a Dynamic, Context-Aware Chat System</h4><p>The above strategies were instrumental in creating a dynamic, context-aware conversational application. By meticulously structuring prompts and outputs, and making informed design choices, the AutoChatManager delivers coherent and engaging multi-persona interactions. I hope these insights are beneficial to others embarking on similar projects. For a closer look at the application, you can find it <a href="https://github.com/MaartenSmeets/AutoChatManager">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=239244931c60" width="1" height="1" alt=""><hr><p><a href="https://medium.com/researchable/building-a-multi-persona-chat-app-with-llms-prompt-engineering-reasoning-and-api-challenges-239244931c60">Building a Multi-Persona Chat App with LLMs: Prompt Engineering, Reasoning, and API Challenges</a> was originally published in <a href="https://medium.com/researchable">Researchable | Strategic Data &amp; AI-partner</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reduce your gas and electricity bill!]]></title>
            <link>https://medium.com/@MaartenSmeetsNL/reduce-your-gas-and-electricity-bill-c819cbad81e8?source=rss-918a6ecf5e32------2</link>
            <guid isPermaLink="false">https://medium.com/p/c819cbad81e8</guid>
            <dc:creator><![CDATA[Maarten Smeets]]></dc:creator>
            <pubDate>Thu, 06 Oct 2022 08:57:29 GMT</pubDate>
            <atom:updated>2022-10-13T13:03:45.746Z</atom:updated>
            <content:encoded><![CDATA[<p>Due to the current challenges on the energy market, prices for both gas and electricity in the Netherlands and probably Europe as a whole have risen dramatically. In this blog post I’ll give some suggestions for things which can help you reduce your gas and electricity bill. Some of these are specific to the Netherlands.</p><p>What I’m trying to do is to optimize my gas/energy usage economically. Thus the purpose is to get a lower gas/electricity bill. You can have other motivations like you want to reduce CO2 emissions due to climate change or you do not want to use gas from countries which are not friendly to your country. Those motivations might lead to other choices. There are differences between countries and their regulations and everyone lives in a different house which can of course also influence the choices you make.</p><p>N.b. I’m no gas/energy expert but the below measures are things which I have looked at and which seem to help.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x1OWb2ea_6fzQncYM_-s-A.png" /><figcaption>Reduce your gas and electricity usage and thus your bill!</figcaption></figure><h3>General suggestions</h3><h4>Reduce gas</h4><p><strong>Insulate your house</strong><br>This is an obvious one and, especially in older houses, you can save a lot of money by this. You can do large operations like insulating your walls, loft, roof or floor but you can also relatively easily also do small things like</p><ul><li>use weatherstrips</li><li>insulate pipes. Especially if they transport hot water.</li><li>use thick curtains or thermo curtains to keep heat inside</li><li>making sure your mailbox when it is build inside your front door does not cause a draft. You could reduce this with a product like <a href="https://www.bol.com/nl/nl/p/brievenbusklep-wit/9300000002935138/?bltgh=l30l6rYT8OH4gDPEC0dBwA.4_23.26.ProductTitle">this</a>.</li><li>install radiator foil when you do not have floor heating for the radiators which are against walls which are connected to the outside. Radiator foil is cheap and easy to install. See for example <a href="https://www.bol.com/nl/nl/p/radiatorfolie-inclusief-12-magneten-van-bt-isolatie-mat-420-cm-x-74-cm-3-1-m2-isolatiemat-voor-radiatoren-energiebesparend-en-behagelijker-wonen-met-de-isolatiemat-voor-radiatoren-van-bt/9300000059071608/?s2a=">here</a>. It works best if you can directly attach it to your radiator.</li><li>close doors when you are not inside the room. Also remember heat goes up. The rooms at the ground floor, especially if they have high ceilings, are more difficult to keep warm. If you prevent air movement by closing doors, the heat stays in the same place longer.</li></ul><p><strong>Reduce your room temperature<br></strong>You can save a lot of gas by reducing your room temperature. This probably requires you to wear more clothes. The tip here is to use thermo underwear and layers. In your bed woollen blankets can help keep you warm at night. Often also you do not need to have all rooms at a high temperature so consider only heating the rooms you use often.</p><p><strong>Tweak your central heating system</strong><br>A central heating boiler (CV in Dutch) produces hot water for the tap and hot water for the radiators. The following (Dutch) site has some suggestions on this (<a href="https://www.milieucentraal.nl/energie-besparen/verwarmen-op-gas-of-hout/cv-ketel-onderhoud-en-instelling/#:~:text=Warm%20water%20op%2060%20graden,-Combiketels%20verwarmen%20niet&amp;text=Ze%20hebben%20een%20thermostaat%20voor,je%20het%20risico%20op%20Legionella.">here</a>)</p><ul><li>The hot water for the tap needs to be at least 60 degrees of Celsius to prevent the Legionella bacteria from causing issues. Higher is often not necessary!</li><li>The hot water for the radiators can usually be lowered to 60 degrees of Celsius when your house is well insulated and you have reasonably new radiators. The default setting could be as high as 95 degrees of Celsius which is not needed. Mind that a lower setting means it will take longer for your house to warm up.</li><li>Usually the central heating boiler has several settings related to heating. You can usually put in on ‘comfort’, ‘eco’ or ‘off’. This setting determines how long it will take until you have hot water when you open the tap or start the shower. When the setting is on comfort, it will use more gas than when set to eco. This can be a waste if you don’t mind waiting a bit longer for hot water.</li><li>The radiators can be tweaked to optimize the water flow going through and the heat it transfers. This is called hydronic balancing (see <a href="https://www.consumentenbond.nl/cv-ketel/waterzijdig-inregelen">here</a>). Look into it! It can make your radiators more efficient and help with keeping different rooms at a similar temperature. When you let someone do this, they can at the same time do maintenance on your central heating boiler.</li><li>A smart thermostat which turns the radiator heating lower or off when you are not there and for example at night, can also save a lot of gas. If you still have a manual thermostat, you will probably sometimes forget to turn it down when you are going to bed or when going on a holiday.</li><li>There are radiator ventilators which help in making radiators more efficient. See for example <a href="https://www.bol.com/nl/nl/p/speedcomfort-radiator-ventilator-mono-set-universeel-geschikt-voor-standaard-smalle-en-enkelplaats-radiatoren-en-convectoren-magnetisch/9300000024945474/?bltgh=nvFeyn6cG2wt6D04NthAJQ.2_6.11.ProductTitle">here</a>.</li><li>Prevent air and rust build-up inside your central heating system. Bleed your radiators once in a while (see for example <a href="https://vasco.eu/nl-nl/blog/verwarming-algemeen/je-verwarming-ontluchten-hoe-doe-je-dat">here</a>). Air is bad for heat transfer and can cause rust inside your pipes which is also not good for heat transfer. Rust can also cause issues inside the central heating boiler, especially if it is a relatively new one (when the pump uses direct current). You can prevent rust/air from accumulating inside your central heating system by using dirt separators and air vents (see for example <a href="https://www.youtube.com/watch?v=scjqVdlMBUU">here</a>). A dirt separator should be used for the water going into the central heating boiler and an air separator for the water leaving the central heating boiler.</li><li>Replace old central heating systems<br>Old central heating systems are often less efficient than new ones. New central heating systems have several features to achieve this which old ones mostly don’t have yet. Do look into whether you would benefit most from a heat pump, a hybrid central heating system (which can heat on gas and electricity) or another solution. Also consider legislation. For example in the Netherlands in the future, it will not be allowed anymore to buy a central heating system which only works on gas.</li><li>Use timers<br>You can use timers such as <a href="https://www.bol.com/nl/nl/p/perel-tijdklok-24-uur-met-randaarde/9200000098128290/?bltgh=vDJEWP7H5lwwCgRJaINMLw.2_18.25.ProductTitle">these</a> to cut power to devices you do not use structurally at certain times a day. For example why power your modem/WiFi router when you are asleep?</li></ul><p><strong>Dry air is easier to heat</strong><br>If the air in your house is relatively dry, the air is easier to heat. Read for example <a href="https://energyforums.net/hvac/how-humidity-affects-heating-and-cooling/">here</a> (there are many other sources). If you want to save on having to heat your house (gas or electricity), reduce humidity to below 40% in winter. This also helps reduce condensation of water on cold surfaces, which, as an additional benefit, can also prevent moulds from forming (see <a href="https://www.safeguardeurope.com/condensation">here</a>). The best way to go about this is to first measure the humidity inside your house and next take measures if required. You can buy a dehumidifiers to reduce humidity and of course make sure when taking a shower or bath, that the room is well ventilated.</p><p><strong>Shower</strong><br>A rain shower uses a lot of water which needs to be heated. Heating requires gas or electricity. You can save gas/electricity if you use a water saving shower head instead. Personally I prefer them anyway. You can of course also save on gas/electricity if you shower shorter. Taking a bath uses more gas/water than taking a shower if the shower is shorter than around 10 minutes (see <a href="https://www.theguardian.com/money/2022/mar/29/cheaper-bath-shower-energy-questions-answered-reduce-bills">here</a>).</p><h4>Reduce electricity</h4><p><strong>Reduce standby electricity usage</strong><br>When a device, for example a charger, is plugged in, it consumes electricity. Even when it is not in use. You can measure this by using relatively cheap devices like <a href="https://www.bol.com/nl/nl/p/ecosavers-energie-meter-mini-energieverbruiksmeter-energiemeter-electriciteitsmeter-compact-gs-keurmerk/9200000073365257/?Referrer=ADVNLGOO002063-G-139636893833-S-1677229351390-9200000073365257&amp;gclid=CjwKCAjwp9qZBhBkEiwAsYFsb8aY9HiyZqyCphgJhwal1LTFtJcZQ_wCQBAa3ltBkggrrugMWlsuOxoCM_YQAvD_BwE">these</a>. With the current electricity prices I noticed that my home workplace would use more than €150 euro of electricity a year when not in use! This can easily be avoided by using a power strip with an off button and turn it off when not in use.</p><p><strong>Use LEDs<br></strong>LED light bulbs are the most energy efficient light bulbs you can currently buy. Should you have ‘old fashioned’ light bulbs, you can save as much as 10 times the electricity for the same amount of light. Of course LED lights do not help you in heating your house. If you use smart LEDs, there will be slightly more electricity consumption, even when it is turned off since it needs to be able to respond to signals for turning it on (usually using WiFi or Bluetooth). This additional electricity usage is not that much though (see <a href="https://www.quora.com/Do-WiFi-LED-light-bulbs-use-more-electricity-than-traditional-LED-bulbs">here</a>).</p><p><strong>Use a hot water dispenser instead of a Quooker or water boiler</strong><br>A Quooker keeps water warm so you can have hot water when you need it. This however requires continuously keeping water warm / electricity. A regular water cooker often (depends on how you use it) heats too much water to a too high temperature. You can consider using a water dispenser (for example <a href="https://www.bol.com/nl/nl/p/moa-heetwaterdispenser-luxe-instant-waterkoker-2-3-liter-hwd25w/9300000015751073/?Referrer=ADVNLGOO002028-G-135322621901-S-1780708002624-9300000015751073&amp;gclid=CjwKCAjw7eSZBhB8EiwA60kCW4YZoH8GjbeIVw2jaY9Oy_zFxW-U0dPB12CPldfv-JZ1NZ8DcbqMuxoChZYQAvD_BwE">here</a>. usually between 50€ and 100€). Using such a device you can configure the temperature and amount of water to use which makes more efficiënt use of electricity. Boiling water using a water boiler or a kettle has <a href="https://www.libelle.nl/actueel/wat-is-goedkoper-een-kopje-thee-zetten-met-een-waterkoker-of-op-het-gasfornuis~b634e40d2/">similar cost</a> (currently).</p><p><strong>Replace old devices</strong></p><ul><li>Old freezers, refrigerators, washing machines, dryers, televisions (especially plasma or LED) are often a lot less efficient with their energy than modern versions.</li><li>Use laptops instead of desktop PCs. Laptops use a lot less power (they are made to last long on a battery). They usually have a lower life expectancy than desktops though and they are often more expensive for similar hardware when compared to desktops.</li><li>If you are running a server at home, especially if it is a desktop or similar, consider using hardware for it which uses less power. For example, a server often does not need a graphics card. An SSD is a lot more energy efficient than an HDD (<a href="https://www.tomshardware.com/features/ssd-vs-hdd-hard-drive-difference#:~:text=SSDs%20consume%20significantly%20less%20power,of%207%2D8W%20under%20load.">here</a>). Would a Raspberry Pi or something similar not be enough for your needs?</li></ul><p><strong>Use the eco programs on your dishwasher and washing machine</strong><br>The eco program, if your machine has one, usually takes longer to complete than the fast or regular programs. They are however more energy efficient. See for example <a href="https://www.milieucentraal.nl/energie-besparen/apparaten-in-huis/wasmachine/#:~:text=Met%20de%20eco%2Dknop%20was,het%20opwarmen%20van%20het%20water.">here</a>.</p><p><strong>Tweak your television</strong><br>Suppose you have a large OLED TV. It uses a lot of power when turned on and even when in standby (can be avoided with a power strip with off button as mentioned earlier). You can tweak your TV to reduce power usage. See for example <a href="https://www.coolblue.nl/en/advice/how-do-i-lower-the-energy-consumption-of-my-lg-television.html">here</a> for some suggestions for if you own a recent LG TV.</p><h3>Specific to the Netherlands</h3><p><strong>Solar cells good, heat pump bad</strong><br>Choose your energy/gas conservation measures carefully. Currently in the Netherlands solar cells have a really short return of investment. Definitely get them if you do not have them already. An air/water heat pump though has a very long return of investment if you can even save enough to make it worth the initial investment. See for example <a href="https://www.eigenhuis.nl/energie/maatregelen/duurzaam-verwarmen/warmtepomp/wel-of-niet-kopen#/">here</a>. If you have low gas usage, buying a heat pump in the Netherlands is currently not economically interesting. An air/air heat pump, also called airco (which can also do heating) is a lot more efficient than a mobile airco. It does use electricity and it will probably be most useful to cool during summer (using the electricity from your solar cells). City heating is not necessarily cheaper or more environment friendly when compared to using your own central heating system (does it burn wood or gas? is the price of what it burns used to calculate what consumers need to pay?). A boiler and heat collectors might be interesting to look at since they can reduce gas usage but do require electricity to pump water around and require quite some space. If you totally want to get rid of using gas, your total gas/electricity bill will probably rise. If for example you want to cook using induction, even during this energy crisis, you will still have to pay more than using gas. This is the current situation. It might change in the future.</p><p><strong>Check out government subsidies<br></strong>You do not have to pay for everything by yourself! The government provides several subsidies to make your home more gas/energy efficient or improve your home in general. In Groningen you can take a look at what you might get for earthquake damages (<a href="https://www.schadedoormijnbouw.nl/schade-gebouw/vaste-vergoeding">here</a>). If you have confirmed damages, you can get the <a href="https://www.snn.nl/">SNN subsidy</a> to increase the value of your home. If you are lucky, you can also get an additional 10K (<a href="https://www.snn.nl/particulier/subsidie-verduurzaming-en-verbetering-groningen-eu-10000">here</a>). If you have used the money to improve your home (for some subsidies that is a requirement), you can also use the same measures to request a more general subsidy for which you don’t have to live in Groningen (see <a href="https://www.milieucentraal.nl/energie-besparen/energiesubsidies-en-leningen/subsidies-verduurzamen-woning/">here</a> for some suggestions).</p><p><strong>The price ceiling. Gas users benefit most</strong><br>A relatively new policy sets a price ceiling for electricity and gas starting at januari 2023 but gas/energy are allowed to implement it as early as november 2022. Until a certain amount of usage you pay at maximum a specific price. Above that usage, you pay the market price which is most likely higher. If you manage to stay below the price ceiling, gas and electricity will be relatively cheap. A challenge is mainly high electricity usage. For example you do not have (enough) solar cells to cover your electricity usage (e.g. charging electric cars and using electricity to warm your house). You could end up above the ceiling for electricity. It might be worthwhile to consider whether it will be cheaper heating your house on gas than on electricity if you have the choice.</p><p><em>Originally published at </em><a href="https://javaoraclesoa.blogspot.com/2022/09/reduce-your-gas-and-electricity-bill.html"><em>https://javaoraclesoa.blogspot.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c819cbad81e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring: Blocking vs non-blocking: R2DBC vs JDBC and WebFlux vs Web MVC]]></title>
            <link>https://medium.com/oracledevs/spring-blocking-vs-non-blocking-r2dbc-vs-jdbc-and-webflux-vs-web-mvc-900d72ee19c1?source=rss-918a6ecf5e32------2</link>
            <guid isPermaLink="false">https://medium.com/p/900d72ee19c1</guid>
            <category><![CDATA[spring]]></category>
            <category><![CDATA[spring-data]]></category>
            <category><![CDATA[r2dbc]]></category>
            <category><![CDATA[jdbc]]></category>
            <category><![CDATA[benchmark]]></category>
            <dc:creator><![CDATA[Maarten Smeets]]></dc:creator>
            <pubDate>Tue, 28 Apr 2020 13:22:28 GMT</pubDate>
            <atom:updated>2020-04-28T13:22:28.472Z</atom:updated>
            <content:encoded><![CDATA[<p>Spring Framework version 5, released in Sept 2017, introduced Spring WebFlux. A fully reactive stack. In Dec 2019 Spring Data R2DBC, a reactive relational database driver was released. In this blog post I’ll show that at high concurrency, WebFlux and R2DBC perform better. They have better response times and higher throughput. As additional benefits, they use less memory and CPU per request processed and when leaving out JPA in case of R2DBC, your fat JAR becomes a lot smaller. At high concurrency using WebFlux and R2DBC is a good idea!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*f9xXS1t_dooRgY4k.png" /></figure><p>In this blog post I’ve looked at 4 implementations</p><ul><li>Spring Web MVC + JDBC database driver</li><li>Spring Web MVC + R2DBC database driver</li><li>Spring WebFlux + JDBC database driver</li><li>Spring WebFlux + R2DBC database driver</li></ul><p>I’ve varied the number of requests in progress (concurrency) from 4 to 500 in steps of 50 and assigned 4 cores to the load generator and to the service (my laptop has 12 cores). I’ve configured all connection pools to be 100. Why a fixed number of cores and connection pool size? In <a href="https://technology.amis.nl/2020/03/27/performance-of-relational-database-drivers-r2dbc-vs-jdbc/">a previous exploration of JDBC vs R2DBC data</a> changing those variables did not provide much additional insight so I decided to keep them fixed for this test reducing my test run time by several factors.</p><p>I did a GET request on the service. The service fetched 10 records from the database and returned them as JSON. First I ‘primed’ the service for 2 seconds by putting heavy load on the service. Next I started with a 1 minute benchmark. I repeated every scenario 5 times (separated by other tests, so not 5 times after each other) and averaged the results. I only looked at the runs which did not cause errors. When I increased concurrency to more than 1000, the additional concurrent requests failed without exception for all implementations. The results appeared reproducible.</p><p>As back end database I’ve used Postgres (12.2). I used <a href="https://github.com/wg/wrk">wrk</a> to benchmark the implementations (because of several recommendations). I measured</p><ul><li>Response time<br>As reported by wrk</li><li>Throughput (number of requests)<br>As reported by wrk</li><li>Process CPU usage<br>User and kernel time (based on /proc/PID/stat)</li><li>Memory usage<br>Private and shared process memory (based on /proc/PID/maps)</li></ul><p>You can view the test script used <a href="https://github.com/MaartenSmeets/db_perftest/blob/r2dbc/test_scripts/run_test.py">here</a>. You can view the implementations used <a href="https://github.com/MaartenSmeets/db_perftest/tree/r2dbc/test_apps">here</a>.</p><p>You can view the raw data which I used for the graphs <a href="https://github.com/MaartenSmeets/db_perftest/blob/r2dbc/test_scripts/restotal.txt">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*mdV8XbtMM-Kfsqr7.png" /></figure><p>It is clear that at higher concurrency, the response times of Spring Web MVC + JDBC starts to drop. R2DBC clearly gives the better response times at higher concurrency. Spring WebFlux also does better than a similar implementation using Spring Web MVC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*WKdmVnLl8FdeZzRZ.png" /></figure><p>Similar to the response times, Spring Web MVC with JDBC starts doing worse at higher concurrency. R2DBC clearly does best. Moving from Spring Web MVC to Spring WebFlux however also helps improving throughput but not as much as going from JDBC to R2DBC. At low concurrency, Spring Web MVC + JDBC does slightly better than Spring WebFlux + JDBC.</p><p><strong>CPU</strong><br> CPU was measured as CPU time during the entire run, the sum of process user and kernel time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*auYtoYFFXS9qKuyN.png" /></figure><p>Spring WebFlux with JDBC used least CPU. However as you’ve seen above, it also has the lowest throughput. When you look at the CPU used per request processed, you get a measure of how efficient the code/JVM was in utilizing the CPU:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*josCg0PiIlqLpvVw.png" /></figure><p>WebFlux and R2DBC use least CPU per request. R2DBC clearly uses less CPU per request than JDBC. At low concurrency however Web MVC + JDBC makes most efficient use of available memory. Memory usage per request processed, when any component is non-blocking (WebFlux of R2DBC is used), is more stable than a completely blocking stack (Web MVC + R2DBC).</p><p><strong>Memory</strong></p><p>Memory was measured as process private memory at the end of the run. Memory usage is garbage collection dependent. G1GC was used on JDK 11.0.6. Xms was 0.5 Gb (default 1/64 of my available 32 Gb). Xmx was 8 Gb (default 1/4 of my available 32 Gb).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*2LhjO60_ocniXkM-.png" /></figure><p>Web MVC starts to take more memory at higher concurrency while WebFlux is stable. At low concurrency, Web MVC + JDBC does best but at higher concurrency, WebFlux + R2DBC uses least memory per processed request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/0*OKI9u7TdVwgueyMV.png" /></figure><p><strong>Fat JAR size</strong></p><p>The below graph shows JPA is a big one. If you can’t use it in case of R2DBC, your fat JAR size drops in the order of 15Mb!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*Nk0en-vZn9GCqr6K.png" /></figure><p><strong>R2DBC and WebFlux, a good idea at high concurrency!</strong></p><p>At high concurrency, the benefits of using R2DBC instead of JDBC and WebFlux instead of Web MVC are obvious.</p><ul><li>Less CPU is required to process a single request.</li><li>Less memory required to process a single request.</li><li>Response times at high concurrency are better.</li><li>Throughput at high concurrency is better</li><li>The fat JAR size is smaller (no JPA with R2DBC)</li></ul><p>You’re not required to have a completely non-blocking stack to reap the benefits of using R2DBC or WebFlux. It is however best to use both at high concurrency. WebFlux + JDBC is not a good idea since it is not efficient in memory and CPU usage and also has a low throughput compared to the other tested services.</p><p>At low concurrency (somewhere below 200 concurrent requests), using Web MVC and JDBC, might give better results. Test this to determine your own break-even point!</p><p><strong>Some challenges when using R2DBC</strong></p><ul><li>JPA cannot deal with reactive repositories such as provided by Spring Data R2DBC. This means you will have to do more things manually when using R2DBC.</li><li>There are other reactive drivers around such as for example Quarkus Reactive Postgres client (which uses Vert.x). This does not use R2DBC and has different performance characteristics (see <a href="https://technology.amis.nl/2020/03/27/performance-of-relational-database-drivers-r2dbc-vs-jdbc/">here</a>).</li><li>Limited availability<br>Not all relational databases have reactive drivers available. For example, Oracle does not (yet?) have an R2DBC implementation.</li><li>Application servers still depend on JDBC. <br>Do people still use those for non-legacy in this Kubernetes age?</li><li>When Java Fibers will be introduced (Project Loom, could be Java 15), the driver landscape might change again and R2DBC might not become JDBCs successor after all.</li></ul><p><em>Originally published at </em><a href="https://javaoraclesoa.blogspot.com/2020/04/blocking-vs-non-blocking-in-spring.html"><em>https://javaoraclesoa.blogspot.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=900d72ee19c1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracledevs/spring-blocking-vs-non-blocking-r2dbc-vs-jdbc-and-webflux-vs-web-mvc-900d72ee19c1">Spring: Blocking vs non-blocking: R2DBC vs JDBC and WebFlux vs Web MVC</a> was originally published in <a href="https://medium.com/oracledevs">Oracle Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Performance! 3 reasons to stick to Java 8 for the moment]]></title>
            <link>https://medium.com/@MaartenSmeetsNL/performance-3-reasons-to-stick-to-java-8-for-the-moment-231340884c4a?source=rss-918a6ecf5e32------2</link>
            <guid isPermaLink="false">https://medium.com/p/231340884c4a</guid>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[graalvm]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Maarten Smeets]]></dc:creator>
            <pubDate>Fri, 28 Jun 2019 08:55:29 GMT</pubDate>
            <atom:updated>2019-06-28T08:55:29.721Z</atom:updated>
            <content:encoded><![CDATA[<p>It is a smart thing to move to newer versions of Java! Support such as security updates and new features are just two of them but there are many more. Performance might be a reason to stick to Java 8 though. In this blog post I’ll show some results of performance tests I have conducted showing Java 11.0.3 has slower startup times and slightly slower throughput compared to Java 8u202 when using the same Java code. Native images (a GraalVM feature) have greatly reduced startup time and memory usage at the cost of throughput. You can only compile Java 8 byte-code to a native image though (at the moment).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*LAQ24AC1v22dKrXC.jpg" /></figure><h3>Worse performance for Java 11</h3><p>I’ve done extensive measures on the performance of different JVMs and different microservice frameworks running on them. You can browse the scripts used <a href="https://github.com/MaartenSmeets/jvmperformance">here</a> and view a presentation which describes the test set-up <a href="https://www.slideshare.net/MaartenSmeets1/performance-of-microservice-frameworks-on-different-jvms-148401771">here</a>. The test I did was create minimal implementations of several frameworks, compiled them to Java 8 and Java 11 byte-code respectively, ran them in Docker containers on a specific JVM and put load on them. I send a message, waited for a response and then I send the next message (all synchronous). I’ve done the same test, which ran for 15 minutes per framework/JVM combination (millions of requests), several times and the results are reproducible. I paid specific attention to make sure the load test and the JVM used separate resources. Also, I first wrote the measurements in memory before writing them to disk at the end of the test. I did this to be able to measure sub-millisecond differences between the JVMs and frameworks and not my disk performance.</p><h4>Slightly worse throughput (response times)</h4><p>For every framework (Akka, Vert.x, Spring Boot, WebFlux, Micronaut, Quarkus, Spring Fu) I noticed that the performance on Java 8 (tested on Azul Zing, Oracle JDK, OpenJDK and OpenJ9) was slightly worse than on Java 11 (though less than a tenth of a millisecond). For OpenJ9 it is beneficial to go to Java 11 though when running Akka or Spring Boot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lvV2-KOEm9gmw9mTgJyZGA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jCr4pNgt6OOFJTsgaibfHg.png" /></figure><p>This could be related to the different garbage collection algorithm which is used by default. For Java 8 this is Parallel GC while for Java 11 this is G1 GC. G1 GC with 2Gb of heap performs slightly worse during my test than Parallel GC as you can see in the below graph. When reducing the heap though, G1 GC starts to outperform Parallel GC.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sMgprP0xAomaG_N11yMLdw.png" /></figure><p>I have not tried Java 11 with Parallel GC (-XX:+UseParallelGC) to confirm the drop in performance is caused by the GC algorithm. As you can see though the performance difference from Java 8 to Java 11 is consistent over the different JVMs (with exception of Akka, Spring Boot on OpenJ9) using different GC algorithms. For example, Zing 11 performs slightly worse then Zing 8 and Zing did not make the change in the default GC algorithm. Thus it is likely that when using the same algorithm for OpenJDK and Oracle JDK 8 and 11, there will still be slightly worse performance for JDK 11.</p><h4>Worse startup time</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V2Gx97UO1w4iGvbJtzDlRg.png" /></figure><p>As you can see in the above graph for the same Spring Boot application, startup time, running on a JVM with 2Gb of heap, for Java 11, was longer. I just showed the graph for Spring Boot but the same holds true for the other microservice frameworks.</p><h4>GraalVM native compilation only supports Java 8</h4><p>GraalVM 19 is currently (1st of June 2019) only available in a Java 8 variant. The native compilation option is still in an early adopters phase at the moment, but, even though throughput is worse (see the above graphs, Substrate VM), start-up time is much better! Throughput might be worse because pre-compilation could prevent some runtime optimizations (I have not confirmed this). See for example the below graph of Quarkus startup time on different JVMs. Also it is said memory usage is better when using native images but I’ve not confirmed this yet by own measurements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*CsrmnGrjyxjEgD8hLgLkFg.png" /></figure><p>If you want to use native images, for the moment you are stuck on Java 8. A good use-case for native images can be serverless applications where startup time matters and memory footprint plays a role in determining how much the call costs you.</p><h3>Finally</h3><h4>Java 11 specific features were not used</h4><p>These tests were performed using the same code but compiled to Java 8 and Java 11 byte-code respectively to exclude effects of compilation (although OpenJDK was used to compile to Java 8 and 11 byte-code in all cases). Usually you would write different code (using new features) when writing it to run on Java 11. For example, the Java Platform Module System (JPMS) could have been implemented or maybe more efficient APIs could have been used. Thus potentially performance on Java 11 could be better than on Java 8.</p><h4>Disclaimer</h4><p>Use these results at your own risk! My test situation was specific and might differ from your own situation thus performing your own tests and base your decisions on those results is recommended. This blog post just indicates that moving from Java 8 to Java 11 might not improve performance and prevents you from using native compilation at the moment.</p><p><em>Originally published at </em><a href="https://javaoraclesoa.blogspot.com/2019/06/performance-3-reasons-to-stick-to-java.html"><em>https://javaoraclesoa.blogspot.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=231340884c4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Minikube on Windows. Hyper-V vs Vagrant/VirtualBox]]></title>
            <link>https://medium.com/oracledevs/minikube-on-windows-hyper-v-vs-vagrant-virtualbox-f63e9d7c8240?source=rss-918a6ecf5e32------2</link>
            <guid isPermaLink="false">https://medium.com/p/f63e9d7c8240</guid>
            <category><![CDATA[oracle-cloud]]></category>
            <category><![CDATA[virtualbox]]></category>
            <category><![CDATA[vagrant]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Maarten Smeets]]></dc:creator>
            <pubDate>Sun, 10 Feb 2019 10:44:00 GMT</pubDate>
            <atom:updated>2019-02-15T23:49:05.285Z</atom:updated>
            <content:encoded><![CDATA[<p>Kubernetes is a system for running and coordinating containerized applications across a cluster of machines. Minikube runs a single-node Kubernetes cluster and can be used for local development. In this blog post I’ll compare 2 different ways to get a working Minikube environment on Windows based on experience with <a href="https://github.com/AMIS-Services/sig-kubernetes">a workshop</a> which we’ve created. One based on using Vagrant and VirtualBox (in which an Ubuntu environment is created) and one which uses Hyper-V (and an out of the box Minikube Linux distribution running on top). Do mind that many of the things in this blog post are a personal opinion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Z-VO06iYF1dwcZcIzDc9g.png" /></figure><h3>Why Minikube?</h3><p>At first I was not convinced using Minikube would provide sufficient environment to get to learn Kubernetes. There are several reasons though why I decided to go with Minikube.</p><h4>Differences in Kubernetes distributions</h4><p>When setting up something for a workshop or a blog, a purpose is to have it applicable to as many people as possible. The knowledge provided should be applicable in different environments. When using a complete Kubernetes distribution or a PaaS solution, only a part of the knowledge is reusable for different platforms. Minikube distributions are far more comparable than Kubernetes distributions (running locally or provided as PaaS).</p><p><strong>Kubernetes distributions differ significantly</strong></p><p>I started checking out complete Kubernetes distributions such as <a href="https://www.ubuntu.com/kubernetes/install">the one</a> provided by Canonical and <a href="https://github.com/oracle/vagrant-boxes/tree/master/Kubernetes">the one</a> provided by Oracle in Vagrant boxes. Quickly I discovered that they differ significantly in many aspects such as virtualization technology (LXC for Ubuntu vs containerd for Oracle Linux) and installation procedure (conjure, snap, juju for Ubuntu, Vagrant, shell scripts for Oracle Linux). Also the resulting environments were different in configuration and in what was pre-installed inside them.</p><p><strong>PaaS Kubernetes providers provide different experiences</strong></p><p>Also most PaaS providers provide a different experience and tools. Usually PaaS providers have specific CLI tools for their environment and specific web interfaces. Large PaaS providers are Google (GKE), Azure (AKS) and Amazon (EKS) thus should you be required to specialize, it is probably safest to choose one of those. Oracle also has a PaaS Kubernetes solution (OKE). Google donated Kubernetes to the CNCF and is probably most advanced in its implementation but I do not know this for sure. On most cloud providers you can do unmanaged Kubernetes (do it yourself on IaaS) or managed (on PaaS). Again, the choices are largely provider specific.</p><h4>Light on resources and easy to install</h4><p>Since my target audience for blog posts is mostly developers and developers often develop locally on their own laptop, the ease of installation and resource usage are important.</p><h3>Minikube on Windows using Hyper-V</h3><p>When using Hyper-V, you cannot use VirtualBox (5.x) at the same time to run VMs; you need to make a choice and switching afterwards requires a Windows restart. The reason for this is that when Hyper-V is running, Hyper-V claims the hardware resources required to provide virtualization and provides an abstraction on top. The only way to access those resources is through an Hyper-V interface. This is also the reason why Hyper-V running on top of Hyper-V works and other virtualization technologies on top of Hyper-V are often an issue (unless they implement the Hyper-V interface). When VirtualBox is running, VirtualBox asks the host for access to the required resources and not Hyper-V. When Hyper-V is not running underneath the host, the host can provide this. Otherwise the host is (more or less) just a VM running on Hyper-V and cannot help VirtualBox with its requirements (something like ‘the wrong person to ask’). Getting started with Minikube on Windows requires the use of several tools and some configuration;</p><ul><li>Hyper-V needs to be enabled and the Hyper-V manager installed. Hyper-V is an out of the box Windows 10 feature.</li><li><a href="https://chocolatey.org/">Chocolatey</a>. Chocolatey is a package manager for Windows which takes away the manual steps required for installing and updating software on Windows. Chocolatey is not required to install CLI tools and Minikube but saves you a lot of time. I can also recommend it for wider use and not just for Docker, Kubernetes, Minikube, Helm and such.</li><li>Hyper-V configuration. You need to create a Virtual Switch which is linked to the network adapter which obtains an IP for the Minikube or Docker Desktop Hyper-V VM to be accessible. Be aware that when your network changes (e.g. cable, wireless), you will need to select a different adapter. Hyper-V has <a href="https://github.com/kubernetes/minikube/issues/1766">a bug with using dynamic memory</a> and you need to disable it.</li><li><a href="https://www.docker.com/products/docker-desktop">Docker Desktop</a>. Software running in Minikube is packaged as Docker containers. The Minikube installation creates a VM which has a Docker registry. You use Docker to publish images to that registry. Docker Desktop includes Docker Machine which allows you to manage Docker hosts. In order to set the environment Docker requires to access your Minikube Hyper-V VM, you can use Minikube docker-env.</li><li><a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/">Kubectl</a>. This is the Kubernetes CLI. You will use this often.</li><li><a href="https://kubernetes.io/docs/tasks/tools/install-minikube/">Minikube</a> itself of course. Usually also Helm but this is out of scope for this post.</li></ul><h3>Minikube in Ubuntu in VirtualBox using Vagrant</h3><p>This setup requires you to build your own Ubuntu installation with a Vagrantfile. For this setup you need:</p><ul><li><a href="https://www.virtualbox.org/wiki/Downloads">VirtualBox</a>. This provides the virtualization.</li><li><a href="https://www.vagrantup.com/">Vagrant</a>. This makes creating a VirtualBox VM and prosioning it easy. Vagrant requires a Vagrantfile and provisioning scripts. Obtaining or writing these might seem the hardest part but it is actually pretty easy. You can find examples of such a Vagrant files <a href="https://github.com/AMIS-Services/sig-kubernetes/blob/master/SIG01/lab00-setup/InstallationMinikubeViaVagrantWorkShop.docx">here</a> and <a href="https://github.com/AMIS-Services/sig-kubernetes/tree/master/SIG01/lab03-helm/env">here</a>.</li></ul><p>No additional tools are required for this since the provisioning scripts will take care of creating the Ubuntu VM and install the required CLI tools such as docker, kubectl, minikube.</p><p>You cannot do nested virtualization within VirtualBox 5.x or earlier. Thus you will need to run minikube with — vm-driver=none within the VirtualBox machine to start Minikube. Also since it is a custom VM, you also manually need to start minikube proxy in order to have a consistent endpoint (host:port) for the API and the dashboard. In VirtualBox 6, nested virtualization is possible though the feature is still young (read more <a href="https://forums.virtualbox.org/viewtopic.php?f=1&amp;t=90831">here</a>). This might allow you to run VirtualBox, an Ubuntu VM on top and for example use KVM for the Minikube VM. This way you do not use a custom Minikube environment but an out of the box one making the environment easier to maintain and upgrade. Have not tested this yet though.</p><p>This does mean though that the CLI tools will be there also and that building Docker containers will need to be done within the VirtualBox container or you will need to work with a shared folder in order to obtain Docker images from your Windows environment. You might be able to expose this environment to the host and use the Windows CLI tools but I have not tried this yet and I’m not planning to. Using the Hyper-V solution would be easier if you want to use the Windows CLI tools. Docker Desktop explicitly states only Hyper-V support so there might be issues.</p><h3>Comparing the environments</h3><p>In order to compare the environments it is helpful to look at different aspects.</p><h4>How easy is it?</h4><p><strong>Installation</strong></p><p>The Hyper-V path requires the installation of several tools. Once this is done, it does not require much maintenance. The VirtualBox/Vagrant path requires less tools (quicker to get up and running), however it does require provisioning scripts which creates an environment for you. Setting up these scripts yourself can take some time (more than the Hyper-V environment installation). Once you have them, the recreation of the entire environment (Minikube + CLI tools) is automated and documented (infrastructure as code). You can also use provided scripts such as <a href="https://github.com/AMIS-Services/sig-kubernetes/blob/master/SIG01/lab00-setup/InstallationMinikubeViaVagrantWorkShop.docx">here</a> and <a href="https://github.com/AMIS-Services/sig-kubernetes/tree/master/SIG01/lab03-helm/env">here</a> to save yourself the work.</p><p><strong>Environment</strong></p><p>The environment created when using the Hyper-V path, require the local CLI tools to access the Minikube VM running on Hyper-V. The Hyper-V VM and the tools are separated and need to be managed that way as two separate things. The tools need connectivity to the VM (Hyper-V virtual switch configuration) and the host needs configuration to allow this connectivity. This can cause issues when for example you change your laptops network from wireless to wired. These connectivity challenges might be a benefit though since when using a full Kubernetes, you will need to configure and connect to a similar remote instance and you already know how that works when you have to deal with it regularly (<a href="https://martinfowler.com/bliki/FrequencyReducesDifficulty.html">frequency reduces difficulty</a>). A question is whether you want to deal with it regularly.</p><p>When using VirtualBox and have everything within that VirtualBox, connectivity is no issue since everything is located on the same machine; a single environment. Also creating backups of the complete environment (tools, configuration, running Minikube) becomes easy with clones and snapshots. The environment can quickly be rebuild and distributed (for a workshop for example) if necessary. On Hyper-V you can only easily do that for the Minikube machine but the tools need a local installation.</p><h4>Where are the CLI tools located?</h4><p><strong>Hyper-V</strong></p><p>The tools are installed natively on Windows. This is useful since if you are using a development environment on Windows, building a Docker container and deploying it to Kubernetes can be done from the same environment. Management of tools is also done on Windows. When using Chocolatey this is pretty easy. For large groups of developers, this tends to become everyone’s own responsibility, which has some risks. Benefit of having the tools native on Windows is that integration with other tools which are installed on Windows (such as an IDE) is easy.</p><p><strong>VirtualBox/Vagrant</strong></p><p>The tools are installed within the VirtualBox VM. If you are developing on Windows and want to use images within the VM, you have 2 options; figure out how to expose the VirtualBox VM to Docker Desktop (though it says only Hyper-V is supported) or develop completely from the VirtualBox VM. Developing from the VirtualBox VM has benefits such as isolation of the environment and you have the option to manage the development environment as code, allowing easy updates for large groups of developers. A drawback is the overhead of the virtualized environment / OS. This overhead is visible in CPU, memory and disk usage.</p><h4>Virtualization</h4><p>When using Hyper-V, a virtual machine runs in the background which can be managed from the Hyper-V manager. You can connect to it using RDP and can also use docker-machine to manage the machine from the CLI. Minikube runs within the Hyper-V VM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ae4rv6Wq-zxuWxR9LTBqLA.png" /></figure><p>You can login to this VM with user root. It uses docker-containerd inside to run containers. The custom Minikube Linux distribution is created by using <a href="https://buildroot.org/">Buildroot</a> (although you do not have to care). It runs kube-proxy and a single node Kubernetes cluster. Hyper-V is a Type 1 hypervisor. This means it works directly on hardware without having an OS layer in between. The host OS also runs through Hyper-V (installing Hyper-V actually puts Hyper-V between the host OS and the hardware). Since the host OS is the Parent Partition or Root Partition, there is not much delay of the host even though the host also accesses the hardware through the hypervisor. Since Hyper-V is dependent on the Root Partition for many things, there is some debate on whether Hyper-V is truly Type 1 and not Type 1+2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*RL2BbPlMHV5mMB0FR-8Z_A.png" /></figure><p>VirtualBox is a Type 2 hypervisor. It depends on the host OS for access to hardware. This means it is slower since there is an extra layer between the VM and the hardware; the host OS. Also since it cannot directly access hardware, VirtualBox needs to provide an abstraction of the hardware provided by the host OS to the guest and provides several drivers for this. For example you can choose different NICs for the guest. Hyper-V manager manages VMs running on Hyper-V but does not run them. To display a VM, RDP is used. VirtualBox actually runs VMs itself, in my experience VirtualBox provides a more seamless experience (between host/guest and hypervisor/guest) for developers when compared to Hyper-V + Hyper-V manager. With VirtualBox, the VMs run on VirtualBox which runs on the host. With Hyper-V the VM runs on the same hypervisor the host runs.</p><p>Both Hyper-V and VirtualBox provide paravirtualization drivers. These drivers allow the guest to access the hypervisor in an optimized manner.</p><h3>Finally</h3><h4>Summary</h4><p>To summarize see the below table. Of course many things are personal opinions. Yours might differ!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FHeFcuKRvhMyx0gF8bjryA.png" /></figure><p>Which setup works best for you depends on your personal tastes. Generally speaking; if you like Windows, go for Hyper-V/Chocolatey and if you prefer Linux, go for VirtualBox/Vagrant. I haven’t done much with Apple products so can’t compare those with the above setups. I can imagine it would be similar to the Windows setup. The Minikube environments created by both setups are comparable in usage. It is useful to get some experience with both in order to increase your personal experience. When getting started with Kubernetes or want to develop locally, I can definitely recommend Minikube! When learning Kubernetes, do not expect it to be easy. It will take some time to get the hang of it. As indicated, some of the knowledge you gain might be platform specific and not generally applicable. Kubernetes basics however are portable.</p><h4>Alternatives</h4><p>There are of course many alternatives worth investigating</p><ul><li>Using VirtualBox 6 nested virtualization feature</li><li>Using Minikube to create a standard VirtualBox Minikube VM. See for example <a href="https://rominirani.com/tutorial-getting-started-with-kubernetes-on-your-windows-laptop-with-minikube-3269b54a226">here</a>. This way you can still use the Windows CLI tools but don’t have to manage a custom VM. You might have connectivity issues tools/VM but since VirtualBox is (in my experience) easier to configure (you will not need to fiddle with Hyper-V memory bugs, virtual switches), this setup would probably be easier to use than Hyper-V.</li><li>Getting rid of Windows altogether (or dual boot or virtualized) and switch to for example Ubuntu or other developer friendly distributions. This would probably make working with Minikube easiest. You could use KVM for the Minikube host and install the CLI tools locally. Docker on Linux is also easier than on Windows.</li></ul><p><em>Originally published at </em><a href="https://javaoraclesoa.blogspot.com/2019/02/minikube-on-windows-hyper-v-vs.html"><em>javaoraclesoa.blogspot.com</em></a><em> on February 10, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f63e9d7c8240" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracledevs/minikube-on-windows-hyper-v-vs-vagrant-virtualbox-f63e9d7c8240">Minikube on Windows. Hyper-V vs Vagrant/VirtualBox</a> was originally published in <a href="https://medium.com/oracledevs">Oracle Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JVM performance: OpenJ9 uses least memory. GraalVM most. OpenJDK distributions differ.]]></title>
            <link>https://medium.com/@MaartenSmeetsNL/jvm-performance-openj9-uses-least-memory-graalvm-most-openjdk-distributions-differ-428bbd2affc1?source=rss-918a6ecf5e32------2</link>
            <guid isPermaLink="false">https://medium.com/p/428bbd2affc1</guid>
            <category><![CDATA[memory-management]]></category>
            <category><![CDATA[jvm]]></category>
            <category><![CDATA[graal]]></category>
            <category><![CDATA[openjdk]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Maarten Smeets]]></dc:creator>
            <pubDate>Sat, 15 Dec 2018 10:45:28 GMT</pubDate>
            <atom:updated>2018-12-16T07:23:19.002Z</atom:updated>
            <content:encoded><![CDATA[<p>In <a href="https://medium.com/@MaartenSmeetsNL/comparing-jvm-performance-zulu-openjdk-openjdk-oracle-jdk-graalvm-ce-48b012c9a8d">a previous blog post</a> I created a setup to compare JVM performance of several JVMs. I received some valuable feedback on the measures I conducted and requests to add additional JVMs. In this second post I’ll look at some more JVMs and I’ve added some measures like process memory usage and startup time. Also I’ve automated the test and reduced the complexity of the setup by removing haproxy and testing a single JVM at a time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*90plc35TIYi7NClhe0zVRg.png" /></figure><h3>Setup</h3><h4>Test application</h4><p>I’ve used the reactive Spring Boot application from <a href="https://github.com/MaartenSmeets/gs-reactive-rest-service/tree/master/complete">here</a>.</p><h4>JVMs</h4><p>The JVMs which were looked at;</p><ul><li>openjdk:8u181</li><li>oracle/graalvm-ce:1.0.0-rc9</li><li>adoptopenjdk/openjdk8:jdk8u172-b11</li><li>adoptopenjdk/openjdk8-openj9:jdk8u181-b13_openj9–0.9.0</li><li>azul/zulu-openjdk:8u192</li><li>store/oracle/serverjre:8</li></ul><p>The versions were the currently available latest versions of the respective JVMs. I also quickly looked at Azul Zing but couldn’t get a Docker image with my application running quickly enough so for now I skipped this.</p><h4>Automated tests</h4><p>I’ve used SoapUI loadrunner to automate my tests with. First I executed a 10s ‘primer’ loadtest to reach a steady state. Next I performed a 5 minute test with the following settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L62Gfp2c-SE7EdTtPiYzvQ.png" /></figure><h4>Dockerfile</h4><p>I’ve used the following Dockerfile:</p><pre>FROM openjdk:8u181<br>VOLUME /tmp<br>ARG JAR_FILE<br>COPY ${JAR_FILE} app.jar<br>ENTRYPOINT [&quot;java&quot;,&quot;-Djava.security.egd=file:/dev/./urandom&quot;,&quot;-XX:+UnlockExperimentalVMOptions&quot;,&quot;-XX:+UseCGroupMemoryLimitForHeap&quot;,&quot;-jar&quot;,&quot;/app.jar&quot;]</pre><p>And of course varied the FROM entry. This way of automation also made it a bit more difficult to include Zing as there are no Docker Hub images available for it. Creating an image myself did not work out of the box with the supplied examples and since it is just one of the JVMs to look at I decided to post this without Zing.</p><h4>Docker-compose</h4><p>The people from Docker have reduced the options which are available in the v3 docker-compose.yml file. In order to set memory limits and configure your network stack, a v2 docker-compose.yml is required. I’ve used the following:</p><pre>version: &#39;2&#39;<br>services:<br>  spring-boot-jdk:<br>    image: &quot;spring-boot-jdk&quot;<br>    container_name: spring-boot-jdk<br>    ports:<br>    - &quot;8080:8080&quot;<br>    networks:<br>            - dockernet<br>    mem_limit: 1024M<br>  prometheus:<br>    image: &quot;prom/prometheus&quot;<br>    ports:<br>    - &quot;9090:9090&quot;<br>    volumes:<br>     - ./prom-jdks.yml:/etc/prometheus/prometheus.yml<br>    container_name: prometheus<br>    networks:<br>            - dockernet<br>  grafana:<br>     image: &quot;grafana/grafana&quot;<br>     ports:<br>     - &quot;3000:3000&quot;<br>     container_name: grafana<br>     networks:<br>            - dockernet<br>networks:<br>    dockernet:<br>        driver: bridge<br>        ipam:<br>            config:<br>            - subnet: 192.168.0.0/24<br>              gateway: 192.168.0.1</pre><p>I’ve used a memory limit to make sure all the JVMs were running under a similar amount of available memory.</p><p>I stopped, removed and recreated the spring-boot-jdk container. Everytime with a different JVM.</p><h4>process-exporter</h4><p>Why hardcode the network settings in the docker-compose.yml file? I wanted to measure the complete JVMs memory. When using for example Micrometer, you only get the memory used inside the JVM and not the memory the OS process uses. In order to achieve this, I’ve used <a href="https://github.com/ncabatoff/process-exporter">process-exporter</a> with the following configuration process-exporter.yml in the proc-exp folder:</p><pre>process_names:<br>  # comm is the second field of /proc/&lt;pid&gt;/stat minus parens.<br>  # It is the base executable name, truncated at 15 chars.  <br>  # It cannot be modified by the program, unlike exe.<br>  - comm:<br>    - java<br>    cmdline: <br>    - app.jar</pre><p>This monitors java processes which have app.jar in their command-line. If I didn’t also check the command-line, my Java test processes would also be included and I didn’t want that.</p><p>Next I started process-exporter on my host with:</p><pre>docker run -d — rm -p 9256:9256 — privileged -v /proc:/host/proc -v `pwd`/proc-exp:/config ncabatoff/process-exporter — procfs /host/proc -config.path /config/process-exporter.yml</pre><p>I wanted to monitor process exporter with Prometheus inside my Docker container. To make this possible, my host (=gateway from within the Docker network) should be available at the same IP so I could configure that in my Prometheus configuration.</p><h3>Results</h3><h4>Response time</h4><p>I did HTTP GET requests from SOAPUI. This is the average response time of the service measured after a steady state was reached. The reported response times by Micrometer from within the applications, were as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hCxccl2QmQfyDJZFceomMg.png" /></figure><p>OpenJDK and Oracle JDK were fastest while AdoptOpenJDK was slowest. When looking at what SOAP UI reported as response times, we see something different.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*pqvHLazL4geFAI-QtTb_Og.png" /></figure><p>This differs from what I measured previously. In that previous measure GraalVM appeared to provide the slowest response times while during this test, that was clearly not the case and GraalVM was one of the faster JVMs when looking at measures from within the JVM but also from outside the JVM.</p><p>Between the different measures, there was also quite a lot of difference. The response times from OpenJDK are slowest here instead of fastest. This makes me wonder if the measures from within the JVM across JVMs are really comparable and if they are measuring the same thing. This might differ due to implementation differences? AdoptOpenJDK was slowest in response times both when looking at within JVM measures and outside.</p><h4>Startup time</h4><p>This is the period reported by Spring Boot about how long it took for the application to start and how long the JVM was running before the application was actually up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*2oE1bM9FbGONAcztmC71JQ.png" /></figure><p>Here again we see the results are not quite as reproducible as I would want. Adopt OpenJ9 was clearly slowest in both tests for application startup followed by GraalVM. There’s no clear winner though.</p><h4>Process memory usage</h4><p>This is a result from process exporter on how much memory the Java process took in total. This consists of virtual, reserved/resident and swap memory. Swap memory was for all JVMs zero during the test. Virtual memory also consists of shared libraries (which are also used by other programs). When looking at resident and virtual memory I saw the following (using <a href="https://grafana.com/dashboards/249):">https://grafana.com/dashboards/249):</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0tFv7EvEJFVNR8OlK_wiDw.png" /></figure><p>Clear winner here with least memory usage is OpenJ9 followed at distance by Oracle JDK. OpenJDK and GraalVM use most memory (both virtual and resident).</p><h4>JVM memory usage</h4><p>This is the heap and non-heap inside the JVM measured with Micrometer and exposed to Prometheus. Non-heap consists of reserved memory, a cache and PermGen space. Heap consists of several memory areas in which the JVM moves stuff around.</p><p><strong>Heap</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dRqJ-yEj_2aidAvAcHxvPg.png" /></figure><p>I’ve used the following Grafana dashboard: <a href="https://grafana.com/dashboards/4701.">https://grafana.com/dashboards/4701.</a> When looking at heap memory, OpenJ9 seems clearly to be the winner followed again at distance by Oracle JDK. GraalVM uses most memory for the same application within the JVM. When looking at the parts the heap consists of, the different JVMs show some remarkable differences. Especially OpenJ9 behaves really differently compared to the other JVMs.</p><p><strong>Non heap</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xQx6Bk9SPRT7oPwBK0GmiA.png" /></figure><p>While the other JVMs do not reserve much memory for the non-heap, OpenJ9 does, although it uses less memory. GraalVM uses most non heap memory. When we look at a bit more detail of what happens in the non-heap area we see the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1MIKQFw9luhhw5CEGgzmAQ.png" /></figure><p>OpenJ9 (the 4th bar in the graphs) clearly behaves differently.</p><p><strong>Threads</strong></p><p>When looking at threads, GraalVM uses slightly more threads and OpenJ9 a lot when compared to the other JVMs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nV5AqF0jJBDTVvJss0uW7Q.png" /></figure><p>It is interesting to notice that even though OpenJ9 uses more threads, it does not use more memory.</p><h3>Conclusions</h3><h4>Difficult to reproduce / large error</h4><p><strong>Startup times</strong><br> <strong><br></strong> OpenJ9 and GraalVM are slowest to start. The results here are also not that reproducible so I should do more tests on this with larger applications.</p><p><strong>Response times</strong></p><p>Since the response times measured inside and outside of the JVM differed a lot and the results were not solidly reproducible, I won’t draw any conclusions here yet.</p><h4>Reproducible results / small error</h4><p><strong>Memory usage</strong></p><p>Upon request I also looked at OS process memory using process-exporter. Also I’ve split up heap and non-heap memory. All memory measures provided similar results in that the JVM which used most memory was GraalVM and the JVM which used least memory (by far) was OpenJ9. If memory usage is a concern I would recommend you to consider OpenJ9 as an option.</p><h4>Some notes</h4><p><strong>Not looked at yet / things to consider</strong></p><ul><li>Different applications show different performance characteristics. I should also test with different types of applications and especially larger ones containing more complex logic</li><li>non-reactive Spring Boot and MicroProfile have not been added</li><li>only compared Java 8 JVMs because for GraalVM at the moment of writing there was no newer version available yet. Is Java 11 faster? (I’m going to skip 9 and 10, no Oracle LTS versions)</li><li>Azul Zing should be added as it is claimed to be fast</li><li>GraalVM can produce native executables. Interesting to also use them in a comparison.</li><li>Garbage collection behavior also differs. I have measures but did not have the time yet to look at it in more detail.</li><li>I should spend time to make the setup and measures available in a suitable way so others can reproduce them.</li><li>Measures might differ when running on different systems (Windows, MacOS, Linux) or different processor architectures.</li><li>I did not do specific tuning of individual JVMs; all ran using default settings. I’m considering adding memory limits as parameters to the JVMs and maybe use a similar garbage collection strategy.</li></ul><p><strong>GraalVM</strong></p><p>Of course GraalVM is much more than just a JVM in that is allows you to run other languages such as Javascript (not confuse this with Nashorn or Rhino) and R in a seamless matter and allows you to create native executables which are supposed to be much faster. Haven’t tested this yet though.</p><p><em>Originally published at </em><a href="http://javaoraclesoa.blogspot.com/2018/12/comparing-jvm-performance-startup-time.html"><em>javaoraclesoa.blogspot.com</em></a><em> on December 15, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=428bbd2affc1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Comparing JVM performance; Zulu OpenJDK, OpenJDK, Oracle JDK, GraalVM CE]]></title>
            <link>https://medium.com/@MaartenSmeetsNL/comparing-jvm-performance-zulu-openjdk-openjdk-oracle-jdk-graalvm-ce-48b012c9a8d?source=rss-918a6ecf5e32------2</link>
            <guid isPermaLink="false">https://medium.com/p/48b012c9a8d</guid>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[jvm]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[performance]]></category>
            <dc:creator><![CDATA[Maarten Smeets]]></dc:creator>
            <pubDate>Fri, 23 Nov 2018 15:29:21 GMT</pubDate>
            <atom:updated>2018-12-04T14:35:37.745Z</atom:updated>
            <content:encoded><![CDATA[<p>There are many different choices for a JVM for your Java application. Which would be the best to use? This depends on various factors. Performance being an important one. Solid performance research however is difficult. In this blog post I’ll describe a setup I created to perform tests on different JVMs at the same time. I also looked at the effect of resource isolation (assigning specific CPUs and memory to the process). This effect was negligible. My test application consisted of a reactive (non-blocking) Spring Boot REST application and I’ve used Prometheus to poll the JVMs and Grafana for visualization. Below is an image of the used setup. Everything was running in Docker containers except SoapUI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y92D5B6ShhPLbu0o942t1A.png" /></figure><h3>Isolated measures</h3><p>How can you be sure there is not something interfering with your measures? Of course you can’t be absolutely sure but you can try and isolate resources assigned to processes. For example assign a dedicated CPU and a fixed amount of memory. I also did several tests which put resource constraints on the load generating software, monitoring software and visualization software (assign different CPUs and memory to those resources). Assigning specific resources to the processes (using docker-compose v2 cpuset and memory parameters) did not seem to greatly influence the measures of individual process load and response times. I also compared startup, under load and without load situations. The findings did not change under these different circumstances.</p><h4>Assigning a specific CPU and memory to a process</h4><p>Using docker-compose to configure a specific CPU for a process is challenging. The version 3 docker-compose format does not support assigning a specific CPU to a process. In addition, the version 3 format does not support assigning resource constraints at all when you use docker-compose to run it. This is because the people working on Docker appear to want to get rid of docker-compose (which is a separately maintained Python wrapper around Docker commands) in favor of docker stack deploy which uses Docker Swarm and maybe Kubernetes in the future. You can imagine assigning a specific CPU in a potentially multi host environment is not trivial. Thus I migrated my docker-compose file back to version 2 format which does allow assigning specific CPUs to test this. The software to generate load and monitor the JVMs I assigned to specific CPUs not shared by the JVMs processing the load. I used the taskset command for this.</p><h4>Measures under the same circumstances</h4><p>How can you be sure that all measures are conducted under exactly the same circumstances? When I run a test against a JVM and run the same test scenario again tomorrow, my results will differ. This can have various causes such as different CPUs pickup the workload and those CPUs are also busy with other things or I’m running different background processes inside my host or guest OS. Even when first testing a single JVM and after the test, test another single JVM, the results will not be comparable since you cannot role out something has changed. For example I’m using Prometheus to gather measures. During the second run, the Prometheus database might be filled with more data. This might cause adding new data might be slower and this could influence the second JVM performance measures. This example might be rather far fetched though but you can think of other reasons by measures taken at different times can differ. That’s why I choose to perform all measures simultaneously.</p><h3>Setup</h3><p>My setup consisted of a docker-compose file which allowed me to easily start 4 times a reactive Spring Boot application running on the different JVMs. In front of the 4 JDKs I’ve put an haproxy instance to load balance requests. Why did I do this? To make sure there was no difference between the different tests by time related differences I did not account for; all JVMs were put under the same load at the same time.</p><p>In order to monitor results I’ve used Micrometer to provide and endpoint to enable Prometheus to read JVM metrics. I’ve used Grafana to visualize the data using the following dashboard: <a href="https://grafana.com/dashboards/4701">https://grafana.com/dashboards/4701</a></p><p>Since GraalVM is only available currently as a JDK 8 version, I’ve also used a JDK 8 version for the other JVMs also. When the container is running, the JVM version can be checked by accessing the actuator url: localhost:8080/actuator/env</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*xNQe8SVq_T4TkRmySEwemQ.png" /></figure><p>or with for example</p><pre>docker exec -it store/oracle/serverjre:8 java -version</pre><p>I’ve used the following versions:</p><ul><li>GraalVM CE rc9 (8u192)</li><li>OpenJDK 8u191</li><li>Zulu 8u192</li><li>Oracle JDK 8u181</li></ul><p>Why the difference in versions? These were the versions which were available to me at the moment of writing this blog post on hub.docker.com.</p><h4>Getting started</h4><p>You can download the code <a href="https://github.com/MaartenSmeets/gs-reactive-rest-service">here</a> from the complete folder. You can run the setup with:</p><pre>sh ./buildjdkcontainers.sh</pre><pre>docker-compose -f docker-compose-jdks.yml up</pre><p>Next you can access</p><ul><li>the haproxy (which routes to different the JVMs) at localhost:8080</li><li>Prometheus at localhost:9090</li><li>Grafana at localhost:3000</li></ul><p>You need to configure Grafana to access Prometheus;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JC1c8xIXk8rXOxdyQTthBw.png" /></figure><p>Next you need to import <a href="https://grafana.com/dashboards/4701">the dashboard</a> in Grafana;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*1sL2A-U6dOeggiKkK5UlwA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ee27E4d_dP1QsAA7uRfx_Q.png" /></figure><p>Next you can do a load test on <a href="http://localhost:8080/hello">http://localhost:8080/hello</a> (HTTP GET) and see the results in the Grafana dashboard. Prometheus itself can also feed information to Grafana and HAproxy can also by using an exporter. I did not configure this in my setup.</p><h4>Different OSs</h4><p>A difference between the different Docker images was the OS used within the image. The OS can be determined with:</p><pre>docker exec -it store/oracle/serverjre:8 cat /etc/*-release</pre><ul><li>azul/zulu-openjdk:8 used Ubuntu 18.04</li><li>oracle/graalvm-ce:1.0.0-rc9 used Oracle Linux Server 7.5</li><li>openjdk:8 used Debian GNU/Linux 9</li><li>store/oracle/serverjre:8 used Oracle Linux Server 7.5</li></ul><p>I don’t think this would have had much effect on the JVMs running inside (with Alpine I would have expected an effect). At least Oracle JDK and GraalVM use the same OS.</p><h3>Results</h3><p>Using the JVM micrometer dashboard, it was easy to distinguish specific areas of difference in order to investigate them further.</p><h4>CPU usage</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LTHGYpLhnFG0EYQ3Y0DGDg.png" /></figure><p>GraalVM had the highest CPU usage overall during the test. Oracle JDK the lowest CPU usage.</p><h4>Response times</h4><p>Overall GraalVM had the worst response times and OpenJDK the best followed closely by Oracle JDK and Zulu. On average the difference was about 30% between OpenJDK and GraalVM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mrAMf-f6gWda3QFwzpkAfQ.png" /></figure><h4>Garbage collection</h4><p>Interesting to see is that GraalVM loads way more classes then the other JDKs. OpenJDK loads least classes. The difference between GraalVM and OpenJDK is about 25%. I have not yet determined if this is a fixed amount of additional classes overhead for GraalVM or if this scales with the amount of classes used and this is a fixed percentage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CPw0jUbG2r4naxPxIWTD7g.png" /></figure><p>Of course these additional classes could cause delays during garbage collection (although this correlation might not necessarily be a causation). Longer GC pause times for GraalVM is exactly what we see below though.</p><p>Below is a graph of the sum of the GC pause times. The longest pause times (the one line on top) are GC pause times due to allocation failures in GraalVM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8nu5XrE7k6u1Rnf9AK33zA.png" /></figure><h4>Memory usage</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sgo6EWDQlj1olZBxTQqXrw.png" /></figure><p>JVM memory usage is interesting to look at. As you can see in the above graph, the OpenJDK JVM uses most memory. The garbage collection behavior of GraalVM and Zulu appears to be similar, but GraalVM has a higher base memory usage. Oracle JDK does less garbage collections it appears. When looking at averages the OpenJDK JVM uses most memory while Zulu uses the least. When looking at a zoomed out graph over a longer period, the behavior of Oracle JDK and OpenJDK seem erratic and can spike to relatively high values while Zulu and GraalVM seem more stable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*I9OapTHbXYNgSxgV9zXD-g.png" /></figure><h3>Summary</h3><p>Overview I’ve conducted a load test using SOAP UI with a reactive Spring Boot REST application running on 4 different JVMs behind a round robin haproxy load balancer. I’ve used Prometheus to poll the JVM instances (which used Micrometer to produce data) every 5 seconds and used Grafana and Prometheus to visualize the data. The results would suggest GraalVM is not a suitable drop-in replacement JVM for for example OpenJDK since it performs worse, uses more resources, loads more classes and spends more time in garbage collection.</p><ul><li>GraalVM loads more classes for the same application</li><li>GraalVM causes the slowest response times for the application</li><li>GraalVM uses most CPU (to achieve the slowest response time)</li><li>GraalVM uses most time on garbage collection</li><li>Zulu OpenJDK uses least memory of the compared JVMs. Zulu OpenJDK and GraalVM are more stable in their memory usage when comparing to Oracle JDK and OpenJDK.</li></ul><p>Of course since GraalVM is relatively new, it could be the metrics provided by Micrometer do not give a correct indication of actual throughput and resource usage. Also it could be my setup has liabilities which causes this difference. I tried to rule out the second though by looking at the metrics in different situations.</p><p>If you want to use the polyglot features of GraalVM, of course the other JVMs do not provide a suitable alternative. Also GraalVM provides a native compilation option which I did not test (I performed the test om the same JAR). This feature can potentially greatly increase performance.</p><h4>Further research</h4><p><strong>Native executables?</strong></p><p>GraalVM allows code to be compiled to a native executable. I’ve not looked at performance of these native files but potentially this could make GraalVM a lot more interesting. Also it would be interesting to see how the Prometheus metrics would behave in a native executable since there is no real JVM anymore in this case.</p><p><strong>Blocking calls</strong></p><p>The application used was simple; a reactive Spring Boot REST service. The behavior under load might differ with more complex applications or for example when using blocking calls in Spring Boot.</p><p><strong>Tweaking the JVM parameters</strong></p><p>I’ve not specifically tweaked the JVM performance. This was out of the box without any specific tweaks. I’ve not looked at defaults for parameters or specific parameters for certain JVMs. It might be tweaked parameters cause very different results.</p><p><strong>GraalVM EE and Java 11 (or 12 or …)</strong></p><p>It would be interesting to check out GraalVM EE since it is compiled with Oracle JDK instead of OpenJDK. I’ve not found a Docker image available of this yet. Also comparing Java 11 with Java 8 would be interesting. More to come!</p><p><em>Originally published at </em><a href="https://javaoraclesoa.blogspot.com/2018/11/comparing-jvm-performance-zulu-openjdk.html"><em>javaoraclesoa.blogspot.com</em></a><em> on November 23, 2018.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48b012c9a8d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>