<?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 Anish on Medium]]></title>
        <description><![CDATA[Stories by Anish on Medium]]></description>
        <link>https://medium.com/@godslaysall?source=rss-e8942cdb0956------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*am50R0OA9-QqKnV9</url>
            <title>Stories by Anish on Medium</title>
            <link>https://medium.com/@godslaysall?source=rss-e8942cdb0956------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:41:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@godslaysall/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[ Java 27 Deep Dive: What Actually Changed?]]></title>
            <link>https://medium.com/@godslaysall/java-27-deep-dive-what-actually-changed-a58e880c765c?source=rss-e8942cdb0956------2</link>
            <guid isPermaLink="false">https://medium.com/p/a58e880c765c</guid>
            <dc:creator><![CDATA[Anish]]></dc:creator>
            <pubDate>Wed, 30 Sep 2026 16:40:04 GMT</pubDate>
            <atom:updated>2026-09-30T16:54:41.194Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Java 27 is here. And no, this isn’t another release where you need to rewrite your application to benefit from it.</strong></p><p>JDK 27 was released on <strong>September 15, 2026</strong>. It is a <strong>non-LTS feature release</strong> in Java’s six-month release cadence. JDK 28 is scheduled for March 2027, while <strong>JDK 29 is currently planned as the next LTS release in September 2027</strong>.</p><blockquote><strong><em>Java 27 is not primarily about adding dozens of new language features.</em></strong></blockquote><blockquote><em>A lot of its value is underneath your application — in the JVM, garbage collection, object layout, security, observability and concurrency.</em></blockquote><p>If you’re a Spring Boot developer, backend engineer, cloud architect or JVM engineer, that’s where this release gets interesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F9WqmwXl4CCyAnnQ" /></figure><p>This article focuses on the major JEPs and migration changes that are most relevant to application developers and production JVMs. It does not attempt to catalogue every small library, compiler, tooling and implementation change in JDK 27.</p><p>Let’s look at what actually changed.</p><h3>☕ First: Where Does Java 27 Fit?</h3><p>Java continues to release a new feature version approximately every six months.</p><p>VersionReleaseStatusJava 21Sep 2023LTSJava 22Mar 2024FeatureJava 23Sep 2024FeatureJava 24Mar 2025FeatureJava 25Sep 2025<strong>LTS</strong>Java 26Mar 2026Feature<strong>Java 27Sep 2026FeatureJava 28Mar 2027</strong>Feature<strong>Java 29Sep 2027Planned LTS</strong>Java 30Mar 2028Feature</p><p>The OpenJDK release schedule places JDK 27 on September 15, 2026, JDK 28 on March 23, 2027, and JDK 29 on September 21, 2027.</p><p><strong>Official reference:</strong> OpenJDK JDK Release Schedule [1]</p><h3>The important takeaway</h3><p>If you’re running:</p><pre>Java 8<br>Java 11<br>Java 17<br>Java 21<br>Java 25</pre><p>you don’t need to jump to JDK 27 simply because it exists.</p><p>JDK 27 is a <strong>feature release</strong>. Java 25 is the current LTS release, while Java 29 is currently planned as the next LTS.</p><p>The right question is therefore not:</p><blockquote><em>“Should I immediately move everything to Java 27?”</em></blockquote><p>It is:</p><blockquote><strong><em>“Which JDK 27 changes matter to my workload, and what should I test before upgrading?”</em></strong></blockquote><h3>🔥 The Major JEPs in Java 27</h3><p>JDK 27 contains several important platform changes. The nine JEP-level changes that are particularly relevant to application and JVM developers are:</p><p>JEPFeatureStatus523G1 as Default GC in All Environments✅ Final527Post-Quantum Hybrid Key Exchange for TLS 1.3✅ Final531Lazy Constants⚠️ Preview532Primitive Types in Patterns, instanceof, and switch⚠️ Preview533Structured Concurrency⚠️ Preview534Compact Object Headers✅ Final536JFR In-Process Data Redaction✅ Final537Vector API🧪 Incubator538PEM Encodings of Cryptographic Objects⚠️ Preview</p><p><strong>Official reference:</strong> Oracle — Significant Changes in JDK 27 Release [2]</p><p>There are also important migration and compatibility changes, including the continued migration away from deep reflective mutation of final fields and the removal of several obsolete JVM mechanisms.</p><p>Now let’s break down what these changes actually mean.</p><h3>1️⃣ G1 Is Now the Default Garbage Collector Everywhere</h3><h3>JEP 523</h3><p>This change is easy to overlook.</p><p>But it matters.</p><p>G1 is <strong>not a new garbage collector</strong>.</p><p>G1 has been the default collector for server-class environments for years.</p><p>What changes in JDK 27 is that:</p><blockquote><strong><em>G1 becomes the default garbage collector in all environments.</em></strong></blockquote><p>This changes the JVM’s <strong>automatic default selection</strong>. It does not prevent an application from explicitly selecting another collector.</p><p>For example:</p><pre>java -jar application.jar</pre><p>does not require:</p><pre>-XX:+UseG1GC</pre><p>when using the JDK 27 default configuration.</p><p>However, an application that explicitly specifies another collector can still do so.</p><h3>Why G1?</h3><p>G1 divides the Java heap into regions and tries to collect regions that provide useful reclamation while working toward predictable pause targets.</p><p>Conceptually:</p><pre>Java Heap</pre><pre>┌────┬────┬────┬────┬────┬────┐<br>│ R1 │ R2 │ R3 │ R4 │ R5 │ R6 │<br>├────┼────┼────┼────┼────┼────┤<br>│ R7 │ R8 │ R9 │R10 │R11 │R12 │<br>└────┴────┴────┴────┴────┴────┘<br>              ↓<br>        Garbage Collection<br>              ↓<br>       Reclaim useful regions</pre><p>The important point is that Java 27 does <strong>not</strong> mean:</p><blockquote><em>“G1 suddenly became better.”</em></blockquote><p>It means:</p><blockquote><strong><em>The JVM now selects G1 by default across a broader range of environments.</em></strong></blockquote><h3>What does this mean for Spring Boot?</h3><p>Usually:</p><p><strong>Nothing in your application code.</strong></p><p>Your application:</p><pre>@SpringBootApplication<br>public class Application {</pre><pre>    public static void main(String[] args) {<br>        SpringApplication.run(Application.class, args);<br>    }<br>}</pre><p>doesn’t change.</p><p>The JVM underneath it does.</p><p>But don’t assume that changing the default collector automatically improves every application.</p><p>Measure:</p><pre>GC pause time<br>GC frequency<br>Allocation rate<br>CPU utilization<br>Heap usage<br>p99 latency<br>Throughput<br>Container memory</pre><p>For production services, compare those measurements before and after the JDK upgrade.</p><p><strong>Official reference:</strong> OpenJDK JEP 523 / Oracle JDK 27 Significant Changes [2]</p><h3>2️⃣ Compact Object Headers — A Very Interesting JVM Change</h3><h3>JEP 534</h3><p>This is one of the most interesting JVM-level changes in JDK 27.</p><p>Every Java object carries metadata in its object header.</p><p>Historically, object headers could consume significant memory, especially when an application creates millions of small objects.</p><p>JDK 27 makes <strong>Compact Object Headers the default object header layout in HotSpot</strong>.</p><p>Oracle documents the compact layout as reducing object headers from <strong>96 bits to 64 bits on 64-bit architectures</strong>.</p><p>Consider an application creating millions of objects:</p><pre>List&lt;Customer&gt; customers = new ArrayList&lt;&gt;();</pre><pre>for (int i = 0; i &lt; 10_000_000; i++) {<br>    customers.add(new Customer());<br>}</pre><p>The objects themselves may be small.</p><p>But when you have millions of them, object metadata becomes significant.</p><p>Compact headers aim to reduce that overhead.</p><h3>Why should cloud engineers care?</h3><p>Because memory is infrastructure.</p><p>Potentially:</p><pre>Smaller object headers<br>        ↓<br>Lower object overhead<br>        ↓<br>Reduced heap footprint<br>        ↓<br>Better deployment density<br>        ↓<br>Potentially lower memory pressure</pre><p>But there is an important nuance.</p><h3>⚠️ Don’t assume every object becomes exactly 4 bytes smaller</h3><p>The header reduction is real, but application-level memory savings depend on:</p><ul><li>object layout</li><li>field sizes</li><li>alignment</li><li>padding</li><li>compressed references</li><li>heap configuration</li><li>object population</li></ul><p>So don’t calculate:</p><blockquote><em>“96 bits → 64 bits, therefore my application uses exactly X% less memory.”</em></blockquote><p>Benchmark the actual workload.</p><p>This is a JVM optimization, not a guaranteed application-level memory reduction.</p><p><strong>Official reference:</strong> Oracle — Significant Changes in JDK 27 Release; JEP 534 [2]</p><h3>3️⃣ Primitive Types in Pattern Matching</h3><h3>JEP 532 — Fifth Preview</h3><p>Java has been gradually improving pattern matching.</p><p>JDK 27 continues that work by allowing primitive types to participate more naturally in pattern matching.</p><p>For example:</p><pre>Object value = 42;</pre><pre>if (value instanceof int i) {<br>    System.out.println(i);<br>}</pre><p>And:</p><pre>switch (value) {<br>    case int i -&gt; System.out.println(&quot;Integer: &quot; + i);<br>    case long l -&gt; System.out.println(&quot;Long: &quot; + l);<br>    default -&gt; System.out.println(&quot;Something else&quot;);<br>}</pre><p>The goal is to extend:</p><pre>instanceof<br>switch<br>patterns</pre><p>so primitive types can participate directly.</p><p>But there is more going on than simply allowing int inside instanceof.</p><p>The JEP defines how primitive patterns interact with:</p><ul><li>boxing</li><li>unboxing</li><li>widening conversions</li><li>narrowing conversions</li><li>exactness</li><li>pattern compatibility</li><li>dominance in switch</li></ul><p>That matters because primitive pattern matching needs well-defined behavior around conversions.</p><h3>⚠️ This is still preview</h3><p>JDK 27 represents the <strong>fifth preview</strong> of this feature.</p><p>So:</p><blockquote><strong><em>Preview ≠ production-stable API.</em></strong></blockquote><p>You need preview support to experiment with it.</p><p>Use it to understand the direction of Java, experiment in non-production code and provide feedback.</p><p>Don’t redesign a production codebase around it simply because you’re running JDK 27.</p><p><strong>Official reference:</strong> Oracle — Java Language Changes for JDK 27; JEP 532 [3]</p><h3>4️⃣ Structured Concurrency Continues Its Journey</h3><h3>JEP 533 — Seventh Preview</h3><p>This is one of the features worth watching closely.</p><p>Imagine a REST endpoint that needs to fetch:</p><pre>┌── Customer<br>Request ────────┼── Orders<br>                 └── Recommendations</pre><p>These operations are logically related.</p><p>Traditionally, you might create multiple asynchronous tasks and then manually manage:</p><ul><li>cancellation</li><li>exceptions</li><li>timeouts</li><li>joining</li><li>cleanup</li><li>partial failures</li></ul><p>Structured concurrency attempts to make this relationship explicit.</p><p>The core idea is:</p><blockquote><strong><em>The lifetime of child tasks is structured around the lifetime of their parent operation.</em></strong></blockquote><p>Conceptually:</p><pre>REST Request<br>     │<br>     ▼<br>Structured Task Scope<br>     │<br> ┌───┼────────┐<br> ▼   ▼        ▼<br>Customer Orders Offers<br> │   │        │<br> └───┼────────┘<br>     ▼<br>   Result</pre><p>A simplified JDK 27 example:</p><pre>try (var scope = StructuredTaskScope.open()) {</pre><pre>    var customer = scope.fork(() -&gt; getCustomer());<br>    var orders   = scope.fork(() -&gt; getOrders());<br>    var offers   = scope.fork(() -&gt; getOffers());</pre><pre>    scope.join();</pre><pre>    return new Result(<br>        customer.get(),<br>        orders.get(),<br>        offers.get()<br>    );<br>}</pre><p>The default StructuredTaskScope.open() configuration uses <strong>virtual threads</strong> for forked subtasks.</p><p>That makes structured concurrency particularly interesting for I/O-heavy workloads where one logical request fans out into multiple concurrent operations.</p><h3>Joiner policies</h3><p>JDK 27 also provides Joiner policies such as:</p><pre>allSuccessfulOrThrow()<br>anySuccessfulOrThrow()<br>awaitAllSuccessfulOrThrow()<br>allUntil(...)</pre><p>These policies determine how the scope handles successful completion, failure and cancellation.</p><p>For example:</p><pre>try (var scope =<br>         StructuredTaskScope.open(<br>             StructuredTaskScope.Joiner.anySuccessfulOrThrow())) {</pre><pre>    scope.fork(() -&gt; getFromServiceA());<br>    scope.fork(() -&gt; getFromServiceB());</pre><pre>    String result = scope.join();<br>}</pre><p>The anySuccessfulOrThrow() policy returns the result of a successful subtask and can cancel the remaining work once a successful result is available.</p><p>This is particularly useful for “first successful result” patterns.</p><h3>Why does this matter for microservices?</h3><p>Consider:</p><pre>GET /customer-dashboard</pre><pre>        │<br>        ├── Customer Service<br>        ├── Order Service<br>        ├── Recommendation Service<br>        └── Payment Service</pre><p>These calls are related to one logical request.</p><p>Structured concurrency provides a cleaner model for expressing that relationship.</p><p>And it becomes especially interesting when combined with <strong>virtual threads</strong>, which became a permanent feature in Java 21.</p><h3>⚠️ Still preview</h3><p>Structured Concurrency is still a preview API.</p><p>Its API can change.</p><p>So treat it as:</p><pre>Production<br>    ↓<br>Stable APIs</pre><pre>POC / Research<br>    ↓<br>Structured Concurrency<br>    ↓<br>Experiment<br>    ↓<br>Track future JDK releases</pre><p><strong>Official reference:</strong> Oracle JDK 27 StructuredTaskScope API; JEP 533 [4]</p><h3>5️⃣ Lazy Constants</h3><h3>JEP 531 — Third Preview</h3><p>Normally:</p><pre>static final ExpensiveObject OBJECT =<br>        createExpensiveObject();</pre><p>the value is initialized during class initialization.</p><p>But sometimes you want the semantics of a constant while delaying initialization until the value is actually needed.</p><p>JDK 27 continues the preview of LazyConstant.</p><p>Conceptually:</p><pre>Declare<br>   ↓<br>Do not initialize immediately<br>   ↓<br>First get()<br>   ↓<br>Initialize once<br>   ↓<br>Value never changes</pre><p>A simplified example:</p><pre>static final LazyConstant&lt;ExpensiveObject&gt; OBJECT =<br>        LazyConstant.of(MyClass::createExpensiveObject);</pre><p>Then:</p><pre>ExpensiveObject value = OBJECT.get();</pre><p>The first successful call initializes the value.</p><p>Subsequent calls return the already initialized value.</p><p>The important idea is:</p><blockquote><strong><em>Lazy constants combine delayed initialization with constant-like semantics.</em></strong></blockquote><p>The JVM can treat an initialized lazy constant as a true constant in situations where constant folding is possible.</p><p>This could be interesting for expensive initialization paths such as:</p><pre>Application startup<br>       ↓<br>Configuration<br>       ↓<br>Clients<br>       ↓<br>Expensive resources</pre><p>Not everything necessarily needs to be initialized immediately during startup.</p><h3>Important nuance</h3><p>A LazyConstant is unmodifiable, but the object stored inside it <strong>does not automatically become immutable</strong>.</p><p>For example, a lazy constant could hold an ArrayList; the reference/content of the lazy constant is fixed after initialization, but the list itself can still be mutable.</p><p>Also remember that a lazy constant strongly references its initialized content. That means it can keep an object reachable for the lifetime of the lazy constant.</p><h3>⚠️ Preview API</h3><p>LazyConstant is still a preview API in JDK 27.</p><p>Don’t treat it as a finalized Java API yet.</p><p><strong>Official reference:</strong> Oracle JDK 27 Significant Changes; java.lang.LazyConstant API [2][5]</p><h3>6️⃣ Post-Quantum Cryptography Comes to TLS 1.3</h3><h3>JEP 527</h3><p>This is one of the most significant security changes in JDK 27.</p><p>JDK 27 introduces <strong>post-quantum hybrid key exchange for TLS 1.3</strong>.</p><p>The basic idea is:</p><pre>Traditional key exchange<br>          +<br>Post-quantum key exchange<br>          ↓<br>     Hybrid exchange</pre><p>The hybrid approach combines a conventional mechanism with a post-quantum mechanism.</p><p>One of the hybrid named groups is:</p><pre>X25519MLKEM768</pre><p>Conceptually:</p><pre>X25519<br>   +<br>ML-KEM-768<br>   ↓<br>Hybrid TLS 1.3 key exchange</pre><p>The objective is to improve resilience against future quantum-computing attacks while retaining the properties of established cryptographic mechanisms.</p><p>And the important part for application developers is:</p><blockquote><em>Applications using the standard </em><em>javax.net.ssl APIs can benefit from the improved TLS capabilities without changing application code.</em></blockquote><h3>But there is an important production caveat</h3><p>TLS is a negotiation between peers.</p><p>Your Java application cannot unilaterally force the remote endpoint to support a hybrid key exchange.</p><p>The TLS peer must support a compatible named group.</p><p>If it doesn’t, the connection can negotiate another mutually supported group, subject to the configured TLS policies.</p><p>This matters when your application communicates with:</p><pre>Load balancers<br>API gateways<br>Kafka brokers<br>Databases<br>External APIs<br>Legacy Java services<br>Cloud services</pre><p>So don’t interpret this as:</p><blockquote><em>“Upgrade the JVM and every TLS connection automatically becomes post-quantum.”</em></blockquote><p>Instead:</p><blockquote><strong><em>Upgrade the JVM, understand the new TLS capabilities, and verify interoperability with the systems you actually connect to.</em></strong></blockquote><h3>Why should enterprise Java developers care?</h3><p>Because Java sits everywhere:</p><pre>Spring Boot<br>      ↓<br>REST APIs<br>      ↓<br>TLS<br>      ↓<br>Databases<br>      ↓<br>Kafka<br>      ↓<br>AWS services<br>      ↓<br>External APIs</pre><p>Security improvements at the JDK level can therefore have a much wider impact than a new Java keyword.</p><p><strong>Official reference:</strong> Oracle — Significant Changes in JDK 27; JEP 527 [2][6]</p><h3>7️⃣ PEM Encoding Gets a Third Preview</h3><h3>JEP 538</h3><p>PEM is everywhere in modern infrastructure.</p><p>You’ve probably seen:</p><pre>-----BEGIN CERTIFICATE-----<br>...<br>-----END CERTIFICATE-----</pre><p>or:</p><pre>-----BEGIN PRIVATE KEY-----<br>...<br>-----END PRIVATE KEY-----</pre><p>JDK 27 continues the preview of APIs for encoding and decoding:</p><ul><li>cryptographic keys</li><li>certificates</li><li>certificate revocation lists</li></ul><p>using PEM format.</p><p>This is primarily an <strong>interoperability API improvement</strong>.</p><p>It isn’t a new cryptographic algorithm.</p><p>Instead, it makes it easier for Java applications to consume and produce a format already widely used by:</p><pre>OpenSSL<br>Kubernetes<br>Cloud platforms<br>Certificate managers<br>API gateways<br>Load balancers<br>Enterprise infrastructure</pre><p>Again:</p><blockquote><strong><em>Preview ≠ final API.</em></strong></blockquote><p><strong>Official reference:</strong> Oracle — Significant Changes in JDK 27; JEP 538 [2]</p><h3>8️⃣ Vector API Moves to Its 12th Incubator</h3><h3>JEP 537</h3><p>This one is particularly interesting for:</p><ul><li>AI/ML numerical kernels</li><li>numerical computing</li><li>image processing</li><li>scientific computing</li><li>analytics</li><li>cryptography</li></ul><p>Normally, scalar code processes values individually:</p><pre>A + B<br>C + D<br>E + F<br>G + H</pre><p>Vector operations allow several values to be processed together:</p><pre>[A B C D] + [E F G H]<br>          ↓<br>       [results...]</pre><p>The Vector API provides a Java abstraction for expressing vector computations.</p><p>The JIT compiler can then map those operations to appropriate hardware vector instructions when supported.</p><p>This can provide performance advantages over equivalent scalar computations.</p><h3>But there is an important caveat</h3><p>Vector API is still an <strong>incubating API</strong>.</p><p>It is not a stable production API.</p><p>So:</p><pre>Performance-sensitive workload<br>          ↓<br>Benchmark<br>          ↓<br>Vector API experiment<br>          ↓<br>Measure<br>          ↓<br>Track JDK evolution</pre><p>Don’t introduce it simply because:</p><blockquote><em>“Vectorization sounds faster.”</em></blockquote><p>Benchmark the actual workload.</p><p><strong>Official reference:</strong> Oracle — Significant Changes in JDK 27; JEP 537 [2]</p><h3>9️⃣ JFR Can Redact Sensitive Data</h3><h3>JEP 536</h3><p>Java Flight Recorder — JFR — is one of the most useful tools for understanding JVM behavior in production.</p><p>But diagnostic data can contain sensitive information.</p><p>JDK 27 improves this by redacting sensitive data such as:</p><pre>Command-line arguments<br>Initial environment-variable values<br>Initial system-property values</pre><p>before the recording leaves the process.</p><p>That is important in cloud environments where JVM configuration or environment variables may accidentally contain:</p><pre>Passwords<br>API keys<br>Tokens<br>Connection strings<br>Internal configuration</pre><p>Conceptually:</p><pre>Application<br>    ↓<br>JFR recording<br>    ↓<br>Redaction<br>    ↓<br>Central observability platform<br>    ↓<br>Logs / dashboards / incident tooling</pre><p>This is an important principle:</p><blockquote><strong><em>Observability data needs security controls too.</em></strong></blockquote><p>JDK 27 enables default JFR redaction filters and provides mechanisms to customize them.</p><h3>Production caveat</h3><p>Don’t assume JFR redaction is a substitute for proper secret management.</p><p>Secrets should not be placed in command-line arguments, system properties or environment variables unnecessarily in the first place.</p><p>Use proper secret-management mechanisms such as your cloud provider’s secret manager or Kubernetes secrets where appropriate.</p><p>JFR redaction is an additional protection layer.</p><p><strong>Official reference:</strong> Oracle — Significant Changes in JDK 27; JEP 536 [2]</p><h3>⚠️ A Java 26 Migration Warning You Should NOT Ignore</h3><p>There is another compatibility issue that matters when moving to JDK 27.</p><p>But let’s get one thing straight:</p><blockquote><strong><em>The warning was introduced in JDK 26, not JDK 27.</em></strong></blockquote><p>JDK 27 continues that migration path.</p><p>The issue is <strong>deep reflection that mutates </strong><strong>final fields</strong>.</p><p>Normally:</p><pre>final String name;</pre><p>means the field should not be changed after initialization.</p><p>However, deep reflection has historically allowed frameworks and libraries to bypass normal access restrictions.</p><p>JDK 26 started issuing warnings when code mutates final fields through deep reflection.</p><p>JDK 27 continues this warning-based migration toward stronger enforcement in a future release.</p><p>This can affect:</p><pre>ORM frameworks<br>Serialization libraries<br>Dependency injection frameworks<br>Mocking frameworks<br>Bytecode manipulation libraries<br>Legacy frameworks</pre><h3>What should you do?</h3><p>Don’t start by suppressing the warning.</p><p>First identify:</p><pre>Application<br>    ↓<br>Framework<br>    ↓<br>Library<br>    ↓<br>Reflection<br>    ↓<br>final field mutation</pre><p>Then ask:</p><blockquote><strong><em>Which dependency is doing this, and is there an updated version that no longer requires it?</em></strong></blockquote><p>JDK 27 provides:</p><pre>--enable-final-field-mutation</pre><p>and:</p><pre>--illegal-final-field-mutation</pre><p>These are migration controls, not a permanent excuse to ignore the underlying compatibility problem.</p><h3>Test the future behavior</h3><p>A particularly useful migration test is:</p><pre>java --illegal-final-field-mutation=deny \<br>     -jar application.jar</pre><p>This proactively exposes code that depends on deep reflective mutation of final fields.</p><p>For deeper diagnostics:</p><pre>java --illegal-final-field-mutation=debug \<br>     -jar application.jar</pre><p>The goal is not to make the warning disappear.</p><p>The goal is to identify the dependency causing it and remove the dependency where possible.</p><p><strong>Official reference:</strong> Oracle — JDK 27 Significant Changes; JEP 500 [2][7]</p><h3>🗑️ Important Removals and Compatibility Changes in JDK 27</h3><p>A release deep dive shouldn’t focus only on new features.</p><p>Migration means understanding what disappeared too.</p><p>The following are some of the removals and compatibility changes most likely to matter during migration.</p><h3>Removed Linux VFORK launch mechanism</h3><p>This option is removed:</p><pre>-Djdk.lang.Process.launchMechanism=VFORK</pre><p>Applications should rely on the supported process-launch mechanisms rather than depending on the removed VFORK option.</p><p>If your deployment explicitly specifies a process launch mechanism, review it before migration.</p><h3>ThreadPoolExecutor.finalize() removed</h3><p>The ThreadPoolExecutor.finalize() method has been removed.</p><p>Code that explicitly depends on it should be reviewed.</p><p>More broadly:</p><blockquote><strong><em>Finalization remains deprecated for removal, and JDK 27 continues that migration by removing another specific finalizer implementation.</em></strong></blockquote><p>Prefer explicit resource management such as:</p><pre>try (Resource resource = ...) {<br>    // use resource<br>}</pre><p>with AutoCloseable.</p><h3>JVMCI removed</h3><p>JDK 27 removes the experimental JVM Compiler Interface and associated JVMCI-specific components and options.</p><p>This matters primarily to applications, tooling or custom JVM configurations that explicitly depended on these experimental interfaces.</p><p>Most ordinary Spring Boot applications will not be affected.</p><h3>Old verification options removed</h3><p>These launcher options are removed:</p><pre>-noclassgc<br>-noverify<br>-verifyremote<br>-Xverify:none</pre><p>There is no direct replacement for:</p><pre>-noverify<br>-Xverify:none</pre><p>Applications using these options should be reviewed before migrating.</p><h3>Why does this matter?</h3><p>Because production JVM configurations often live outside application code:</p><pre>Dockerfile<br>Kubernetes manifest<br>Helm chart<br>Jenkins pipeline<br>ECS task definition<br>Startup script<br>Environment variables</pre><p>So don’t just search the Java repository.</p><p>Search your deployment configuration too.</p><p><strong>Official reference:</strong> Oracle — JDK 27 Release Notes [8]</p><h3>📊 Java 27: What Is Actually Final?</h3><p>This distinction is important.</p><p>FeatureJDK 27 statusG1 default everywhere✅ FinalCompact Object Headers✅ FinalPost-Quantum TLS 1.3✅ FinalJFR Data Redaction✅ FinalPrimitive patterns⚠️ PreviewStructured Concurrency⚠️ PreviewLazy Constants⚠️ PreviewPEM Encoding⚠️ PreviewVector API🧪 Incubator</p><p>Preview features are implemented for experimentation and feedback, but their APIs or behavior may still change.</p><p>Incubator APIs are at an earlier stage and are specifically intended to gather experience and feedback before potential standardization.</p><p>That distinction matters when deciding what belongs in production code.</p><p><strong>Official reference:</strong> Oracle — Significant Changes in JDK 27 [2]</p><h3>☁️ What Does JDK 27 Mean for Spring Boot Developers?</h3><p>Suppose you’re building:</p><pre>Spring Boot<br>     +<br>PostgreSQL<br>     +<br>Kafka<br>     +<br>AWS<br>     +<br>Docker<br>     +<br>Kubernetes</pre><p>You don’t need to rewrite your application simply because the JDK changes.</p><p>A JDK upgrade is usually a <strong>runtime and dependency compatibility exercise</strong>, not an application rewrite.</p><p>Instead, investigate these areas.</p><h3>1. JVM Memory</h3><p>Compact Object Headers may change memory characteristics.</p><p>Monitor:</p><pre>Heap usage<br>Allocation rate<br>GC frequency<br>RSS<br>Container memory</pre><p>Don’t assume improvement.</p><p>Measure it.</p><h3>2. Garbage Collection</h3><p>Because G1 is now the default across environments, understand your actual GC behavior.</p><p>For example:</p><pre>java -Xlog:gc* -jar app.jar</pre><p>Compare:</p><pre>GC pauses<br>Full GC frequency<br>Heap expansion<br>CPU usage<br>p99 latency<br>Throughput</pre><p>before and after the migration.</p><h3>3. Reflection-heavy dependencies</h3><p>Pay attention to:</p><pre>final field mutation</pre><p>warnings.</p><p>Don’t blindly suppress them.</p><p>Find the dependency.</p><p>Upgrade it if possible.</p><h3>4. Dependency compatibility</h3><p>This is one of the most important real-world checks.</p><p>Review:</p><pre>JDK 27<br>   ↓<br>Spring Boot version<br>   ↓<br>Spring Framework<br>   ↓<br>Hibernate<br>   ↓<br>Jackson<br>   ↓<br>Tomcat / Netty<br>   ↓<br>Kafka client<br>   ↓<br>AWS SDK<br>   ↓<br>Test frameworks<br>   ↓<br>Build plugins</pre><p>A successful application compilation does not automatically prove runtime compatibility.</p><p>Run the complete integration and end-to-end test suite.</p><h3>5. Concurrency</h3><p>If you’re already using virtual threads, structured concurrency is particularly interesting.</p><p>Consider scenarios such as:</p><pre>API request<br>    ├── Customer<br>    ├── Orders<br>    ├── Inventory<br>    └── Recommendations</pre><p>where multiple operations belong to the same logical request.</p><p>But remember:</p><blockquote><em>Structured Concurrency is still preview.</em></blockquote><h3>6. Security</h3><p>If your application handles:</p><pre>TLS<br>Certificates<br>Private keys<br>External APIs<br>Kafka<br>Cloud services</pre><p>JDK 27’s security improvements deserve attention.</p><p>Don’t assume the security behavior of every external endpoint is identical.</p><p>Test interoperability.</p><h3>🧪 How I Would Test a Production Migration to JDK 27</h3><p>This is more important than any individual feature.</p><p>Don’t migrate a production service by changing:</p><pre>FROM openjdk:25<br>TO openjdk:27</pre><p>and hoping everything works.</p><p>Use a controlled migration.</p><pre>JDK 27 Migration<br>                   │<br>                   ▼<br>             Update CI/CD JDK<br>                   │<br>                   ▼<br>           Compile + Unit Tests<br>                   │<br>                   ▼<br>         Integration / E2E Tests<br>                   │<br>                   ▼<br>          Dependency Analysis<br>                   │<br>                   ▼<br>        Check Removed JVM Options<br>                   │<br>                   ▼<br>      Check final-field warnings<br>                   │<br>                   ▼<br>        Check TLS interoperability<br>                   │<br>                   ▼<br>         Load / Performance Test<br>                   │<br>                   ▼<br>         Compare JVM Metrics<br>                   │<br>                   ▼<br>            Canary Deployment<br>                   │<br>                   ▼<br>              Production</pre><h3>Step 1 — Verify the runtime</h3><pre>java -version</pre><p>Also verify what your container actually runs:</p><pre>docker exec &lt;container&gt; java -version</pre><p>Don’t assume the local JDK version is the same as the production runtime.</p><h3>Step 2 — Run your complete test suite</h3><pre>Unit tests<br>Integration tests<br>Contract tests<br>End-to-end tests</pre><p>Pay particular attention to:</p><pre>Reflection<br>Serialization<br>ORM<br>Mocking<br>Bytecode instrumentation<br>TLS<br>JVM agents</pre><h3>Step 3 — Search deployment configuration</h3><p>Look for old JVM options in:</p><pre>Dockerfiles<br>Helm charts<br>Kubernetes manifests<br>ECS task definitions<br>Jenkins pipelines<br>Startup scripts<br>Environment variables<br>Terraform<br>CloudFormation</pre><p>Search for:</p><pre>-X<br>-XX:<br>-Djdk.<br>--enable-<br>--illegal-</pre><p>This often finds migration problems before the application starts.</p><h3>Step 4 — Look for final-field warnings</h3><p>Run your service normally and inspect the logs.</p><p>For deeper investigation:</p><pre>java --illegal-final-field-mutation=debug \<br>     -jar application.jar</pre><p>Identify:</p><pre>Which class?<br>Which library?<br>Which framework?<br>Which operation?</pre><p>Then upgrade or replace the dependency where possible.</p><h3>Step 5 — Test the future behavior</h3><p>Run:</p><pre>java --illegal-final-field-mutation=deny \<br>     -jar application.jar</pre><p>If your application fails, identify and remove the dependency on deep reflective final-field mutation.</p><p>This gives you a much stronger migration signal than simply checking whether the application starts.</p><h3>Step 6 — Test TLS interoperability</h3><p>If your application is security-sensitive, test connections to important external systems:</p><pre>API gateways<br>Load balancers<br>Kafka<br>Databases<br>Third-party APIs<br>Internal services</pre><p>Verify:</p><pre>TLS version<br>Negotiated named group<br>Handshake success<br>Fallback behavior<br>Disabled algorithms<br>Custom SSL configuration</pre><p>Don’t assume that a successful local TLS test represents every production peer.</p><h3>Step 7 — Benchmark the JVM</h3><p>Measure:</p><pre>Startup time<br>CPU<br>Heap<br>RSS<br>Allocation rate<br>GC pauses<br>Throughput<br>p95 latency<br>p99 latency</pre><p>For memory-sensitive workloads, compare object/heap behavior before and after enabling the new JDK.</p><h3>Step 8 — Canary</h3><p>Don’t immediately upgrade every production instance.</p><p>Deploy a small percentage first.</p><p>Then compare:</p><pre>Error rate<br>Latency<br>CPU<br>Memory<br>GC<br>Throughput<br>TLS failures<br>Restart frequency</pre><p>against the existing JDK version.</p><blockquote><strong><em>The JDK upgrade is successful when your application metrics remain healthy — not when </em></strong><strong><em>java -version prints 27.</em></strong></blockquote><h3>🧪 Should You Use Preview Features?</h3><p>This is where developers sometimes get carried away.</p><p>Don’t do:</p><blockquote><em>“JDK 27 has Structured Concurrency, let’s rewrite our entire production system.”</em></blockquote><p>Instead:</p><pre>Production<br>    ↓<br>Use finalized features</pre><pre>Development / POC<br>    ↓<br>Experiment with previews</pre><pre>Benchmark<br>    ↓<br>Collect feedback</pre><pre>Future JDK<br>    ↓<br>Track API evolution</pre><pre>Final API<br>    ↓<br>Consider production adoption</pre><p>Preview features exist precisely because the API and/or semantics may still evolve.</p><p>The same principle applies to incubating APIs, where the API is at an even earlier stage.</p><h3>🔮 And What About Java 28?</h3><p>This section needs an important distinction.</p><p><strong>JDK 27 is a finalized release. JDK 28 is future-looking development material.</strong></p><p>JDK 28 is currently scheduled for <strong>March 23, 2027</strong>.</p><p>One major area to watch is <strong>Project Valhalla</strong>.</p><p>Current JDK 28 development includes work around <strong>Value Classes and Objects</strong>, alongside continued evolution of primitive patterns.</p><p>However:</p><blockquote><strong><em>JDK 28 development snapshots and preview specifications should not be treated as guaranteed final Java 28 behavior.</em></strong></blockquote><p>The API, specification and implementation can still evolve before the JDK 28 release.</p><h3>Why is Valhalla interesting?</h3><p>Traditional Java objects have identity:</p><pre>Object<br> ├── Identity<br> ├── Header<br> ├── Reference<br> └── Data</pre><p>Value-oriented programming moves toward data-oriented representations where certain types can avoid unnecessary object identity.</p><p>Conceptually:</p><pre>Value<br> └── Data</pre><p>The objective is to enable more efficient representations of certain data-oriented types.</p><p>This could become particularly important for:</p><pre>Memory efficiency<br>High-performance Java<br>Numerical workloads<br>Data-oriented programming<br>Large collections of small values</pre><p>This is one of the reasons Java’s evolution is increasingly happening at the JVM and object-model level rather than simply through new syntax.</p><p>But keep this distinction clear:</p><pre>JDK 27<br>    ↓<br>Released / final</pre><pre>JDK 28<br>    ↓<br>Future development<br>    ↓<br>Preview / evolving APIs<br>    ↓<br>Not yet a final contract</pre><p><strong>Official reference:</strong> OpenJDK Project Valhalla / JDK 28 development [9]</p><h3>🗓️ The Java Roadmap</h3><p>The current roadmap looks like this:</p><pre>2025 ─────────────── Java 25 LTS<br>                         │<br>                         ▼<br>2026 ── Java 26 ── Java 27<br>                         │<br>                         ▼<br>2027 ─────────────── Java 28<br>                         │<br>                         ▼<br>                    Java 29 LTS<br>                         │<br>                         ▼<br>2028 ─────────────── Java 30</pre><p>The current OpenJDK schedule places:</p><pre>Java 27 → September 2026<br>Java 28 → March 2027<br>Java 29 → September 2027<br>Java 30 → March 2028</pre><p>Java 29 is currently planned as the next LTS release.</p><p><strong>Official reference:</strong> OpenJDK JDK Release Schedule [1]</p><h3>🎯 What Should Java Developers Pay Attention To?</h3><p>Instead of ranking the features, think about them by workload.</p><h3>If your application creates millions of objects</h3><p>Look at:</p><p><strong>Compact Object Headers</strong></p><p>Understand:</p><pre>Object layout<br>Heap usage<br>Allocation<br>GC<br>Container sizing</pre><h3>If your application performs many concurrent operations</h3><p>Look at:</p><p><strong>Structured Concurrency</strong></p><p>Especially if you’re already using:</p><pre>Virtual Threads</pre><p>and need to coordinate several operations belonging to one request.</p><p>Remember that Structured Concurrency is still a preview API.</p><h3>If your application is TLS-heavy</h3><p>Look at:</p><p><strong>Post-Quantum Hybrid Key Exchange</strong></p><p>You may not need application changes, but your security posture and TLS interoperability are worth understanding.</p><h3>If you are interested in modern Java language evolution</h3><p>Look at:</p><p><strong>Primitive Types in Patterns</strong></p><p>But remember:</p><pre>Preview<br>   ≠<br>Production API</pre><h3>If you work on performance-sensitive systems</h3><p>Watch:</p><p><strong>Vector API</strong></p><p>and the broader evolution of:</p><p><strong>Project Valhalla</strong></p><p>These areas point toward a Java platform increasingly optimized for data-oriented and high-performance workloads.</p><h3>💡 The Bigger Picture</h3><p>JDK 27 isn’t about making Java look completely different.</p><p>It’s about making the <strong>existing Java platform better underneath your code</strong>.</p><p>Look beneath the familiar syntax:</p><pre>JDK 27<br>                         │<br>        ┌────────────────┼────────────────┐<br>        ↓                ↓                ↓<br>    Language           JVM             Security<br>        │                │                │<br>  Primitive          G1 / Memory       PQC / TLS<br>  Patterns           Compact Headers<br>        │                │<br>        └────────────────┼────────────────┐<br>                         ↓                │<br>                  Cloud Native            │<br>                         │                │<br>              ┌──────────┼──────────┐     │<br>              ↓          ↓          ↓     │<br>        Microservices   AI/ML   High-scale<br>                                  Systems</pre><p>The direction is becoming increasingly clear.</p><p>Modern Java isn’t evolving only through:</p><pre>if (...)<br>switch (...)<br>record (...)<br>sealed class (...)</pre><p>It’s also evolving through:</p><pre>JVM memory<br>Garbage collection<br>Object representation<br>Concurrency<br>Security<br>Observability<br>CPU-level optimization</pre><p>And that’s what makes JDK 27 interesting.</p><blockquote><strong><em>The biggest improvements aren’t necessarily the ones you type into your IDE.</em></strong></blockquote><blockquote><strong><em>They’re the ones happening inside the JVM while your existing application continues to run.</em></strong></blockquote><h3>📚 Official References</h3><p><strong>[1] OpenJDK — JDK Release Schedule</strong><br>Official release dates and release cadence.</p><p><strong>[2] Oracle — Significant Changes in JDK 27 Release</strong><br>Primary overview of JDK 27 language, library, security, runtime, monitoring and migration changes.</p><p><strong>[3] Oracle — Java Language Changes for JDK 27</strong><br>Primitive Types in Patterns, instanceof, and switch.</p><p><strong>[4] Oracle — </strong><strong>StructuredTaskScope API, Java SE 27</strong><br>Structured Concurrency API and virtual-thread-based default configuration.</p><p><strong>[5] Oracle — </strong><strong>LazyConstant API, Java SE 27</strong><br>Lazy initialization, constant semantics and thread-safety behavior.</p><p><strong>[6] OpenJDK — JEP 527: Post-Quantum Hybrid Key Exchange for TLS 1.3</strong><br>Hybrid TLS key-exchange design.</p><p><strong>[7] Oracle — Preparing for Final-Field Mutation Restrictions</strong><br>Migration guidance for reflective mutation of final fields.</p><p><strong>[8] Oracle — JDK 27 Release Notes</strong><br>Complete release notes, removals, compatibility changes and bug fixes.</p><p><strong>[9] OpenJDK — Project Valhalla / JDK 28 Development</strong><br>Forward-looking information about Value Classes and Objects.</p><h3>☕ One-line summary</h3><blockquote><strong><em>JDK 27 isn’t just another language release — it’s a JVM, memory, security, concurrency and observability release hiding behind familiar Java syntax.</em></strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a58e880c765c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Kafka: 15 Streaming Concepts You Should Know ]]></title>
            <link>https://medium.com/@godslaysall/apache-kafka-15-streaming-concepts-you-should-know-bcdb6c2c161a?source=rss-e8942cdb0956------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcdb6c2c161a</guid>
            <dc:creator><![CDATA[Anish]]></dc:creator>
            <pubDate>Sat, 26 Sep 2026 19:12:39 GMT</pubDate>
            <atom:updated>2026-09-26T19:12:39.145Z</atom:updated>
            <content:encoded><![CDATA[<h3>Apache Kafka: 15 Streaming Concepts You Should Know 🚀</h3><p>If you work with <strong>microservices, event-driven architecture, data pipelines, or distributed systems</strong>, Apache Kafka is one of those technologies that eventually becomes unavoidable.</p><p>But Kafka can feel complicated because several concepts interact with each other:</p><p><strong>Topics → Partitions → Offsets → Consumers → Consumer Groups → Lag → Rebalancing → Streams → Guarantees → Retention → Compaction</strong></p><p>This visual guide brings <strong>15 important Kafka concepts</strong> together. Let’s turn that cheat sheet into a practical explanation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*b5sXyWh4JG2kpFXk-q2ZDw.png" /></figure><h3>🟠 1. Publish — Producers Send Events</h3><p>Everything starts with a <strong>producer</strong>.</p><p>A producer sends events/messages to Kafka.</p><pre>Producer<br>   │<br>   │ Event<br>   ▼<br>Kafka Topic</pre><p>For example, an automotive application might publish:</p><pre>{<br>  &quot;vehicleId&quot;: &quot;VH12345&quot;,<br>  &quot;event&quot;: &quot;VEHICLE_STARTED&quot;,<br>  &quot;timestamp&quot;: &quot;2026-09-27T10:30:00Z&quot;<br>}</pre><p>The producer doesn’t normally send the message directly to a consumer.</p><p>Instead:</p><p><strong>Producer → Kafka Topic → Consumer</strong></p><p>This decoupling is one of Kafka’s biggest strengths.</p><h3>Why it matters</h3><p>The producer doesn’t need to know:</p><ul><li>Who consumes the event</li><li>How many consumers exist</li><li>Whether consumers are temporarily unavailable</li><li>How the event will be processed</li></ul><p>That’s the beauty of event-driven architecture. ⚡</p><h3>🔵 2. Topic — A Named Stream of Events</h3><p>A <strong>topic</strong> is a logical stream of events.</p><p>Think of a topic as a category or channel.</p><p>For example:</p><pre>vehicle-events<br>payment-events<br>order-events<br>notification-events</pre><p>A producer publishes messages to a topic:</p><pre>┌───────────────┐<br>Producer ──────►│ vehicle-events│<br>                └───────────────┘</pre><p>A topic doesn’t normally represent just one message type. It represents a stream of related events.</p><h3>🟣 3. Partition — Kafka’s Secret to Scalability</h3><p>This is one of the <strong>most important Kafka concepts</strong>.</p><p>A topic can be divided into multiple partitions.</p><pre>Topic: orders</pre><pre>Partition 0 → A B C D E<br>Partition 1 → F G H I J<br>Partition 2 → K L M N O</pre><p>Each partition is an <strong>ordered, append-only log</strong>.</p><p>Kafka can process different partitions in parallel.</p><p>That’s how Kafka achieves high throughput. 🚀</p><h3>Important rule</h3><p>Kafka guarantees ordering <strong>within a partition</strong>, not across the entire topic.</p><p>So:</p><pre>Partition 0:<br>A → B → C → D</pre><pre>Partition 1:<br>X → Y → Z</pre><p>Kafka doesn’t guarantee:</p><pre>A → X → B → Y → C</pre><p>across partitions.</p><h3>Partition key</h3><p>You can use a key to control partitioning.</p><p>For example:</p><pre>vehicleId = VH123</pre><p>Messages for the same vehicle can be routed to the same partition, allowing their relative order to be maintained.</p><h3>🟡 4. Offset — The Position of a Message</h3><p>Every record inside a partition has an <strong>offset</strong>.</p><p>Example:</p><pre>Partition 0</pre><pre>Offset:<br>  0    1    2    3    4    5<br>  │    │    │    │    │    │<br>  A    B    C    D    E    F</pre><p>An offset tells Kafka:</p><blockquote><em>“This is the position of this record inside the partition.”</em></blockquote><p>Offsets are <strong>partition-specific</strong>.</p><p>So:</p><pre>Partition 0 → Offset 42<br>Partition 1 → Offset 42</pre><p>are two different records.</p><h3>🔴 5. Consumer Group — Share the Work</h3><p>Now we reach the consumption side.</p><p>A <strong>consumer group</strong> is a set of consumers working together.</p><p>Suppose we have:</p><pre>Topic<br> ├── Partition 0<br> ├── Partition 1<br> └── Partition 2</pre><pre>Consumer Group<br> ├── Consumer A<br> ├── Consumer B<br> └── Consumer C</pre><p>Kafka can assign:</p><pre>Consumer A → Partition 0<br>Consumer B → Partition 1<br>Consumer C → Partition 2</pre><p>This allows the workload to be processed in parallel.</p><h3>Important limitation</h3><p>Within one consumer group:</p><blockquote><em>One partition can be actively consumed by only one consumer at a time.</em></blockquote><p>If you have:</p><pre>3 partitions<br>5 consumers</pre><p>only 3 consumers can actively consume partitions.</p><p>The remaining 2 consumers will be idle.</p><h3>🟠 6. Consumer Lag — How Far Behind Are You?</h3><p>Consumer lag is one of the most important operational metrics in Kafka.</p><p>Imagine:</p><pre>Latest Kafka Offset<br>        ↓<br>0 1 2 3 4 5 6 7 8 9</pre><pre>Consumer processed:<br>0 1 2 3 4</pre><p>The consumer is behind.</p><p>A simplified view:</p><pre>Lag = Latest Offset - Consumer Position</pre><p>For example:</p><pre>Latest offset = 1000<br>Consumer offset = 850</pre><pre>Lag = 150</pre><p>📈 Increasing lag can indicate:</p><ul><li>Slow processing</li><li>Insufficient consumers</li><li>CPU/memory constraints</li><li>Database bottlenecks</li><li>Downstream API latency</li><li>Too few partitions</li><li>Producer throughput exceeding consumer throughput</li></ul><p>For production Kafka systems, <strong>lag should be monitored continuously</strong>.</p><h3>🔄 7. Rebalancing — Kafka Rearranges the Work</h3><p>What happens when a consumer joins or leaves a consumer group?</p><p>Kafka may perform a <strong>rebalance</strong>.</p><p>Example:</p><pre>Before</pre><pre>Consumer A → P0<br>Consumer B → P1<br>Consumer C → P2</pre><p>Consumer B crashes.</p><p>Kafka may redistribute:</p><pre>Consumer A → P0 + P1<br>Consumer C → P2</pre><p>This is called <strong>rebalancing</strong>.</p><p>Rebalancing is necessary for availability, but frequent rebalances can negatively affect throughput.</p><p>Common causes include:</p><ul><li>Consumer crashes</li><li>Consumer restarts</li><li>Deployment</li><li>Group membership changes</li><li>Polling/processing taking too long</li><li>Configuration problems</li></ul><h3>🟦 8. Windowing — Group Events by Time</h3><p>When processing streams, sometimes you don’t want to process individual events.</p><p>You want to process <strong>events within a time window</strong>.</p><p>For example:</p><blockquote><em>Count the number of vehicle events every 5 minutes.</em></blockquote><pre>10:00 ───────── 10:05<br>       Window 1</pre><pre>10:05 ───────── 10:10<br>       Window 2</pre><p>This is called <strong>windowing</strong>.</p><p>Common window types include:</p><h3>Tumbling window</h3><p>Non-overlapping windows:</p><pre>[10:00 - 10:05]<br>[10:05 - 10:10]<br>[10:10 - 10:15]</pre><h3>Sliding window</h3><p>Windows overlap:</p><pre>[10:00 - 10:05]<br>      [10:01 - 10:06]<br>            [10:02 - 10:07]</pre><p>Windowing is heavily used in analytics and stream processing.</p><h3>⏰ 9. Grace Period — Handling Late Events</h3><p>Distributed systems don’t always receive events exactly when they happened.</p><p>Imagine an event occurred at:</p><pre>10:04</pre><p>but arrived at:</p><pre>10:07</pre><p>Your application may already have closed the 10:00–10:05 window.</p><p>A <strong>grace period</strong> allows Kafka Streams applications to accept events that arrive late.</p><p>For example:</p><pre>Window ends: 10:05<br>Grace period: 2 minutes</pre><pre>Accept events until: 10:07</pre><p>This is particularly useful when dealing with:</p><ul><li>Network delays</li><li>Mobile devices</li><li>Distributed systems</li><li>Unreliable upstream systems</li></ul><h3>🧠 10. State — Remembering What Happened</h3><p>Some stream-processing operations require memory.</p><p>For example:</p><pre>Event 1 → Vehicle = ON<br>Event 2 → Speed = 80<br>Event 3 → Temperature = 90</pre><p>The processor may need to remember previous events.</p><p>That information is <strong>state</strong>.</p><p>Conceptually:</p><pre>Events<br>  │<br>  ▼<br>Stream Processor<br>  │<br>  ▼<br>State Store</pre><p>State is important for operations such as:</p><ul><li>Aggregations</li><li>Joins</li><li>Counting</li><li>Deduplication</li><li>Windowed processing</li></ul><p>Kafka Streams can maintain local state stores and use changelog topics to support recovery.</p><h3>🟢 11. At-Least-Once Delivery</h3><p>Kafka’s delivery semantics are often summarized as:</p><h3>At-most-once</h3><p>A message may be processed:</p><pre>0 or 1 time</pre><p>Potentially losing messages.</p><h3>At-least-once</h3><p>A message is processed:</p><pre>1 or more times</pre><p>This avoids loss but can introduce duplicates.</p><p>Example:</p><pre>Kafka<br>  │<br>  ▼<br>Consumer<br>  │<br>  ├── Process event<br>  │<br>  └── Crash before commit</pre><p>The consumer restarts and processes the event again.</p><p>Result:</p><pre>Event → Processed twice</pre><p>This is why <strong>idempotent processing</strong> is extremely important.</p><h3>🎯 12. Exactly-Once</h3><p>Exactly-once semantics aim to ensure that the <strong>processing effect</strong> happens only once from the application’s transactional perspective.</p><p>Conceptually:</p><pre>Read event<br>   ↓<br>Process event<br>   ↓<br>Write result<br>   ↓<br>Commit transaction</pre><p>If something fails, Kafka can roll back the transaction rather than leaving a partially committed result.</p><p>Exactly-once processing is more complex than simply saying:</p><blockquote><em>“Kafka will never deliver a message twice.”</em></blockquote><p>That’s an important distinction.</p><h3>🔁 13. Idempotency — Safe Retries</h3><p>One of the most practical concepts in distributed systems is <strong>idempotency</strong>.</p><p>Suppose your consumer receives:</p><pre>Payment ID = PAY123<br>Amount = ₹5000</pre><p>It processes the payment.</p><p>Then the consumer crashes before acknowledging the Kafka record.</p><p>The same message arrives again.</p><p>Without idempotency:</p><pre>₹5000<br>+<br>₹5000<br>=<br>₹10,000 😱</pre><p>With idempotency:</p><pre>PAY123 already processed<br>        ↓<br>Ignore duplicate</pre><p>A common implementation is to store a unique event ID:</p><pre>event_id = ABC123</pre><pre>if event_id already exists:<br>    skip<br>else:<br>    process<br>    store event_id</pre><h3>Key idea</h3><p><strong>Retries + idempotent operations = much safer distributed systems.</strong></p><h3>🟤 14. Retention — How Long Does Kafka Keep Data?</h3><p>Kafka isn’t simply a queue where messages disappear immediately after consumption.</p><p>Kafka stores records according to <strong>retention policies</strong>.</p><p>For example:</p><pre>Topic retention = 7 days</pre><p>Kafka can retain records for that period even if consumers have already read them.</p><p>That enables:</p><pre>Consumer A → reads today</pre><pre>Consumer B → starts tomorrow<br>             ↓<br>        Can still read old events</pre><p>Retention can be configured based on:</p><ul><li>Time</li><li>Storage size</li></ul><p>For example:</p><pre>retention.ms<br>retention.bytes</pre><p>This makes Kafka useful for replaying historical events. 🔄</p><h3>🧹 15. Compaction — Keep the Latest Value</h3><p>Log compaction works differently from normal retention.</p><p>Suppose a topic contains:</p><pre>A → 100<br>B → 200<br>A → 150<br>A → 180<br>B → 250</pre><p>With compaction, Kafka can eventually retain the latest value for each key:</p><pre>A → 180<br>B → 250</pre><p>This is useful for maintaining the latest state of an entity.</p><p>Typical examples:</p><pre>customer_id → customer profile<br>vehicle_id  → latest vehicle state<br>product_id  → latest product information</pre><p>Compaction is particularly useful when a topic represents a <strong>state-changing stream</strong> rather than just an event history.</p><h3>📋 Putting Everything Together</h3><p>The 15 concepts aren’t isolated.</p><p>They form a complete Kafka mental model:</p><pre>PRODUCER<br>                 │<br>                 ▼<br>              TOPIC<br>                 │<br>          ┌──────┼──────┐<br>          ▼      ▼      ▼<br>       PART-0  PART-1  PART-2<br>          │      │      │<br>          └──────┼──────┘<br>                 ▼<br>          CONSUMER GROUP<br>                 │<br>       ┌─────────┼─────────┐<br>       ▼         ▼         ▼<br>   Consumer   Consumer   Consumer<br>       │<br>       ▼<br>      LAG<br>       │<br>       ▼<br>  REBALANCING<br>       │<br>       ▼<br> STREAM PROCESSING<br>       │<br> ┌─────┼───────────────┐<br> ▼     ▼               ▼<br>Window State        Grace Period<br> │<br> ▼<br>Delivery Semantics<br> │<br> ├── At-most-once<br> ├── At-least-once<br> └── Exactly-once<br>       │<br>       ▼<br>  Idempotency<br>       │<br>       ▼<br>Retention / Compaction</pre><h3>🚨 A Real-World Example</h3><p>Imagine an automotive platform receiving millions of events:</p><pre>Vehicle<br>   │<br>   │ telemetry<br>   ▼<br>Kafka<br>   │<br>   ├── vehicle-events<br>   ├── diagnostic-events<br>   └── alert-events<br>          │<br>          ▼<br>    Consumer Groups<br>          │<br>     ┌────┼─────┐<br>     ▼    ▼     ▼<br>   Alert Analytics Storage<br>   Service Service</pre><p>Now imagine consumers become slower than producers.</p><p>You might see:</p><pre>Producer rate:<br>10,000 events/sec</pre><pre>Consumer rate:<br>7,000 events/sec</pre><pre>              ↓</pre><pre>Consumer lag increases</pre><p>At this point, an engineer needs to investigate:</p><p><strong>Is the consumer slow?</strong></p><p><strong>Are there enough partitions?</strong></p><p><strong>Are consumers maxed out?</strong></p><p><strong>Is the database slow?</strong></p><p><strong>Is a downstream API timing out?</strong></p><p><strong>Are rebalances occurring frequently?</strong></p><p>This is where understanding Kafka fundamentals becomes much more valuable than simply knowing Kafka commands.</p><h3>🧩 The Kafka Mental Model</h3><p>If you’re preparing for a <strong>Java/Spring Boot, Microservices, Cloud Architect, or System Design interview</strong>, remember this chain:</p><blockquote><strong><em>Topic stores events → Partitions provide scalability → Offsets track positions → Consumer Groups distribute work → Lag tells you when consumers fall behind → Rebalancing redistributes partitions → Stream processing transforms events → Delivery semantics define reliability → Idempotency makes retries safe → Retention and Compaction determine how Kafka stores data.</em></strong></blockquote><p>That’s the Kafka mental model. 🧠</p><h3>🔥 15 Kafka Concepts — One-Line Revision</h3><p>#ConceptRemember it as<br>1📤 PublishProducers send events<br>2📂 TopicNamed stream of events<br>3🧩 PartitionParallel ordered log<br>4🔢 OffsetPosition in a partition<br>5👥 Consumer GroupConsumers sharing work<br>6📉 LagHow far behind consumers are<br>7🔄 RebalancingPartitions get reassigned<br>8🪟 WindowingGroup events by time<br>9⏰ Grace PeriodAccept late events<br>10🧠 StateRemember information between events<br>11🛡️ At-least-onceEvents may be processed again<br>12🎯 Exactly-onceProcessing effects are transactional<br>13🔁 IdempotencyRetries don’t duplicate effects<br>14🗄️ RetentionHow long records are kept<br>15🧹 CompactionKeep the latest value per key</p><h3>💡 Final Takeaway</h3><p>Kafka isn’t just:</p><blockquote><strong><em>“A messaging system.”</em></strong></blockquote><p>It’s better understood as a <strong>distributed, durable event log combined with a streaming ecosystem</strong>.</p><p>Once you understand these 15 concepts, topics like:</p><ul><li>Kafka consumer lag</li><li>Partition strategy</li><li>Consumer scaling</li><li>Message ordering</li><li>Offset management</li><li>Kafka Streams</li><li>Exactly-once processing</li><li>Event replay</li><li>Data retention</li><li>Log compaction</li><li>Microservices event-driven architecture</li></ul><p>become much easier to reason about.</p><p>And that’s when Kafka starts becoming less mysterious and much more predictable. 🚀</p><h3>📌 Save this for your Kafka revision</h3><p>If you’re learning Kafka, don’t memorize configuration properties first.</p><p>Start with the <strong>mental model</strong>:</p><p><strong>Producer → Topic → Partition → Offset → Consumer Group → Lag → Processing → Delivery Guarantee → Storage</strong></p><p>Once that flow is clear, the configuration starts making sense.</p><p><strong>Kafka becomes much easier when you stop treating it as a collection of APIs and start thinking in terms of distributed logs, parallelism, offsets, and processing guarantees.</strong> ⚡</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcdb6c2c161a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Finally Started Understanding Kafka ]]></title>
            <link>https://medium.com/@godslaysall/how-i-finally-started-understanding-kafka-a05d7ed7fc44?source=rss-e8942cdb0956------2</link>
            <guid isPermaLink="false">https://medium.com/p/a05d7ed7fc44</guid>
            <dc:creator><![CDATA[Anish]]></dc:creator>
            <pubDate>Sat, 26 Sep 2026 10:10:35 GMT</pubDate>
            <atom:updated>2026-09-30T16:58:38.557Z</atom:updated>
            <content:encoded><![CDATA[<h3>My journey from “Kafka transfers messages” to actually understanding what happens when things go wrong</h3><p>When I first started learning <strong>Apache Kafka</strong>, I thought it was pretty straightforward.</p><p>My understanding was something like:</p><blockquote><strong><em>“Kafka is a distributed event streaming platform used to transfer data asynchronously.”</em></strong></blockquote><p>Sounds good, right? 😄</p><p>But then someone asks:</p><blockquote><strong><em>“What happens if a consumer crashes after processing a message but before committing the offset?”</em></strong></blockquote><p>And suddenly…</p><p>😶‍🌫️<br><strong>“Umm… let me think.”</strong></p><p>That’s when I realized something important:</p><p><strong>Knowing Kafka definitions ≠ understanding Kafka.</strong></p><p>So I went back to the basics and started learning Kafka step by step.</p><p>This is what finally helped me understand it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/0*ItpPFuuzAfHSG6f-.png" /></figure><h3>🧩 First, What Problem Does Kafka Solve?</h3><p>Let’s take a simple e-commerce example.</p><p>Imagine a user places an order.</p><p>Normally, our Order Service might need to talk to several other services:</p><pre>┌──────────────────┐<br>                 │   Order Service  │<br>                 └────────┬─────────┘<br>                          │<br>             ┌────────────┼────────────┐<br>             ▼            ▼            ▼<br>        Payment       Inventory    Notification<br>         Service        Service       Service</pre><p>At first, this seems okay.</p><p>But as the system grows, things get messy.</p><p>The Order Service now depends on many other services.</p><p>What happens if the Notification Service is slow?</p><p>What happens if Inventory is temporarily down?</p><p>What happens if one service doesn’t respond?</p><p>😵‍💫</p><p>This is where an event-driven approach starts becoming useful.</p><p>Instead of directly calling everyone, the Order Service can publish an event:</p><pre>Order Service<br>      │<br>      │  &quot;Order Created&quot;<br>      ▼<br>   📨 Kafka<br>      │<br>      ├──────────► Payment Service<br>      │<br>      ├──────────► Inventory Service<br>      │<br>      └──────────► Notification Service</pre><p>Now the Order Service doesn’t need to know exactly who is interested in the event.</p><p>That was one of my first <strong>“Ohhh!” moments</strong> with Kafka. 💡</p><h3>☕ Kafka in Simple Words</h3><p>The easiest mental model I use now is:</p><blockquote><strong><em>Producer → Kafka → Consumer</em></strong></blockquote><p>That’s it.</p><p>At the basic level:</p><pre>👨‍💻 Producer<br>      │<br>      │ Event<br>      ▼<br>┌─────────────────┐<br>│      Kafka      │<br>│                 │<br>│  Topic          │<br>│  ├─ Partition 0 │<br>│  ├─ Partition 1 │<br>│  └─ Partition 2 │<br>└────────┬────────┘<br>         │<br>         ▼<br>   👨‍💻 Consumer</pre><p>The producer sends an event.</p><p>Kafka stores it.</p><p>The consumer reads it.</p><p>Of course, Kafka is much more powerful than this simple picture, but this mental model helped me get started.</p><h3>🧠 Then I Met Kafka’s Vocabulary</h3><p>This was probably the part where Kafka started throwing words at me:</p><p><strong>Producer</strong><br><strong>Consumer</strong><br><strong>Topic</strong><br><strong>Partition</strong><br><strong>Broker</strong><br><strong>Consumer Group</strong><br><strong>Offset</strong></p><p>At first:</p><blockquote><em>“Okay… that’s a lot of terms.” 😅</em></blockquote><p>But once I connected them together, it became much easier.</p><h3>📤 Producer</h3><p>The producer sends events to Kafka.</p><p>For example:</p><pre>📤 Producer</pre><pre>&quot;Order #101 Created&quot;<br>        │<br>        ▼<br>      Kafka</pre><h3>🗂️ Topic</h3><p>A <strong>topic</strong> is where related events are stored.</p><p>For example:</p><pre>Topic: orders</pre><pre>│<br>├── Order #101<br>├── Order #102<br>├── Order #103<br>├── Order #104<br>└── Order #105</pre><p>You can think of a topic as a stream of events.</p><h3>🧱 Partition</h3><p>Then I learned that a topic can be divided into multiple partitions.</p><pre>orders topic</pre><pre>┌───────────────┐<br>│ Partition 0   │ → Order 101, 104, 107...<br>├───────────────┤<br>│ Partition 1   │ → Order 102, 105, 108...<br>├───────────────┤<br>│ Partition 2   │ → Order 103, 106, 109...<br>└───────────────┘</pre><p>And this is where Kafka’s scalability starts making more sense.</p><p>Instead of one thing doing all the work…</p><pre>😓<br>              Consumer<br>                 │<br>          Process everything</pre><p>we can distribute the work:</p><pre>Partition 0 ───► Consumer A</pre><pre>Partition 1 ───► Consumer B</pre><pre>Partition 2 ───► Consumer C</pre><p>🔥 <strong>Parallel processing.</strong></p><p>That was another important “okay, now I get it” moment.</p><h3>👥 Consumer Groups</h3><p>Then came <strong>Consumer Groups</strong>.</p><p>This concept initially took some time for me to understand.</p><p>Suppose we have:</p><pre>orders topic</pre><pre>Partition 0<br>Partition 1<br>Partition 2</pre><p>And one consumer group:</p><pre>Consumer Group: order-service</pre><pre>Consumer A<br>Consumer B<br>Consumer C</pre><p>Kafka can distribute partitions among those consumers:</p><pre>Partition 0 ─────► Consumer A<br>Partition 1 ─────► Consumer B<br>Partition 2 ─────► Consumer C</pre><p>So instead of one consumer processing everything, multiple consumers can share the workload.</p><p>🚀 More consumers<br>→ more parallelism<br>→ better throughput</p><p>Of course, there are limits. For example, within one consumer group, you can’t have more active consumers than partitions for useful partition assignment.</p><p>That made the relationship between <strong>partitions and consumer groups</strong> much clearer to me.</p><h3>🔢 Then I Discovered Offsets</h3><p>This is one of the concepts I found really important.</p><p>Kafka uses an <strong>offset</strong> to represent a consumer’s position in a partition.</p><p>Think of it like a bookmark. 🔖</p><pre>Partition 0</pre><pre>0     1     2     3     4     5<br>│     │     │     │     │     │<br>A     B     C     D     E     F<br>                  ↑<br>               Offset</pre><p>The consumer can keep track of where it has reached.</p><p>That means Kafka isn’t just:</p><blockquote><em>“Here’s a message. Read it and forget about it.”</em></blockquote><p>The consumer has a position in the stream.</p><p>And this became <strong>very important</strong> when I started learning failure scenarios.</p><h3>💥 The Topic That Really Challenged Me</h3><h3>Delivery Semantics</h3><p>Kafka has three commonly discussed delivery guarantees:</p><pre>1️⃣ At-most-once<br>2️⃣ At-least-once<br>3️⃣ Exactly-once</pre><p>Honestly…</p><p>This is where I had to stop memorizing definitions and start thinking through actual scenarios.</p><p>The trick that helped me?</p><p>👉 <strong>Ask: “What happens if the consumer crashes right here?”</strong></p><p>That single question made these concepts much easier.</p><h3>1️⃣ At-Most-Once</h3><p>My first understanding was:</p><blockquote><em>“The message should be received at most once. If something goes wrong, message loss is acceptable.”</em></blockquote><p>The important part is <strong>avoiding duplicates</strong>.</p><p>Imagine:</p><pre>📨 Message arrives</pre><pre>      ↓</pre><pre>✅ Offset committed</pre><pre>      ↓</pre><pre>💥 Consumer crashes</pre><pre>      ↓</pre><pre>❌ Message may not be processed again</pre><p>Because the offset was committed before processing completed, the consumer may skip the message after restarting.</p><p>So:</p><h3>✅ Duplicate processing is avoided</h3><p>but…</p><h3>❌ Message loss can happen</h3><p>A simple way I remember it:</p><blockquote><strong><em>At-most-once = “Don’t process it twice, even if we lose it.”</em></strong></blockquote><h3>2️⃣ At-Least-Once</h3><p>Now let’s reverse the order.</p><p>The consumer processes the message first:</p><pre>📨 Message arrives</pre><pre>      ↓</pre><pre>⚙️ Process message</pre><pre>      ↓</pre><pre>✅ Commit offset</pre><p>Looks safer.</p><p>But what if this happens?</p><pre>📨 Message</pre><pre>      ↓</pre><pre>⚙️ Processing successful</pre><pre>      ↓</pre><pre>💥 Consumer crashes</pre><pre>      ↓</pre><pre>❌ Offset was NOT committed</pre><p>When the consumer comes back…</p><p>Kafka can give the message to the consumer again.</p><p>So:</p><pre>Message<br>   │<br>   ├──► Processed ✅<br>   │<br>   └──► Processed again 🔁</pre><p>Now we have a duplicate.</p><p>But the message wasn’t simply lost.</p><p>So:</p><h3>✅ Message loss is reduced</h3><p>but…</p><h3>⚠️ Duplicate processing can happen</h3><p>My mental shortcut:</p><blockquote><strong><em>At-least-once = “Make sure we don’t lose it, even if we process it again.”</em></strong></blockquote><p>This is also why <strong>idempotent processing</strong> matters so much.</p><h3>3️⃣ Exactly-Once</h3><p>And then…</p><p>🥁 <strong>Exactly-once.</strong></p><p>This one confused me the most at first.</p><p>I initially interpreted it as:</p><blockquote><em>“Kafka sends the message exactly one time.”</em></blockquote><p>But that’s too simplistic.</p><p>The important idea is about making sure the <strong>effect of processing isn’t applied multiple times</strong> in the supported exactly-once processing model.</p><p>Conceptually:</p><pre>Message<br>                │<br>                ▼<br>          ⚙️ Processing<br>                │<br>                ▼<br>        ┌───────────────┐<br>        │   Transaction │<br>        └───────┬───────┘<br>                │<br>                ▼<br>          Result committed</pre><p>So I stopped thinking:</p><blockquote><em>“The message physically exists only once.”</em></blockquote><p>And started thinking:</p><blockquote><strong><em>“The processing result should not be applied more than once.”</em></strong></blockquote><p>That distinction made the whole topic much clearer.</p><h3>🧠 The Cheat Sheet That Finally Stuck</h3><p>Here’s the simplest table I use now:</p><p>GuaranteeMain IdeaWhat Can Happen?1️⃣ At-most-onceAvoid duplicatesMessage can be lost2️⃣ At-least-onceAvoid message lossDuplicate processing can happen3️⃣ Exactly-onceAvoid duplicate effects in supported flowsMore complexity</p><p>Or even simpler:</p><pre>At-most-once<br>     ↓<br>No duplicate<br>     ↓<br>⚠️ Possible loss<br></pre><pre>At-least-once<br>     ↓<br>No intentional loss<br>     ↓<br>⚠️ Possible duplicate<br></pre><pre>Exactly-once<br>     ↓<br>Exactly-once processing semantics<br>     ↓<br>🎯 More guarantees, more complexity</pre><h3>🤔 The Question That Changed How I Study Kafka</h3><p>During my preparation, I realized that memorizing definitions wasn’t enough.</p><p>For example, I could easily say:</p><blockquote><em>“At-least-once means the message is delivered one or more times.”</em></blockquote><p>But what happens if someone asks:</p><blockquote><strong><em>“Consumer processed the message successfully, but crashed before committing the offset. What happens?”</em></strong></blockquote><p>Now I have to reason.</p><p>And that’s the real learning.</p><p>So whenever I study Kafka now, I ask:</p><h3>💭 “What happens if something fails at this exact point?”</h3><p>For example:</p><pre>Read Message<br>     │<br>     ▼<br>Process Message<br>     │<br>     ▼<br>Commit Offset</pre><p>Now imagine a failure after each step.</p><h3>💥 Crash after READ</h3><p>What happens?</p><h3>💥 Crash after PROCESS</h3><p>What happens?</p><h3>💥 Crash after COMMIT</h3><p>What happens?</p><p>Suddenly Kafka stops feeling like a collection of definitions.</p><p>It becomes a system I can reason about.</p><h3>🔄 Kafka Is Not Just “A Message Queue”</h3><p>Another thing I learned along the way:</p><p>Calling Kafka simply a <strong>message queue</strong> doesn’t capture everything it does.</p><p>Kafka is designed around <strong>event streams</strong>, durable storage, partitions, replication, consumer groups, and scalable processing.</p><p>One feature that really changed my mental model was <strong>retention</strong>.</p><p>A consumer reads an event…</p><p>but the event doesn’t necessarily disappear immediately just because one consumer read it.</p><p>Kafka retains records according to its retention configuration, and consumers track their positions using offsets.</p><p>That means events can potentially be <strong>re-read or replayed</strong>.</p><p>This is a very different mental model from:</p><pre>Message arrives<br>      ↓<br>Consumer reads<br>      ↓<br>💨 Message disappears</pre><p>Instead, think:</p><pre>Kafka Log</pre><pre>0   1   2   3   4   5   6<br>│   │   │   │   │   │   │<br>A   B   C   D   E   F   G<br>            ▲<br>            │<br>        Consumer<br>         offset</pre><p>Kafka keeps the log, and consumers maintain their own position in it.</p><p>That is a powerful concept.</p><h3>🏗️ My Current Mental Model of Kafka</h3><p>Today, this is roughly how I visualize Kafka:</p><pre>📤 PRODUCER<br>                     │<br>                     │ Event<br>                     ▼<br>          ┌─────────────────────┐<br>          │        KAFKA        │<br>          │                     │<br>          │      Topic          │<br>          │                     │<br>          │ ┌───────┐ ┌───────┐ │<br>          │ │Part 0 │ │Part 1 │ │<br>          │ └───────┘ └───────┘ │<br>          │         ┌───────┐   │<br>          │         │Part 2 │   │<br>          │         └───────┘   │<br>          └──────────┬──────────┘<br>                     │<br>           ┌─────────┴─────────┐<br>           ▼                   ▼<br>      👨‍💻 Consumer A       👩‍💻 Consumer B<br>           │                   │<br>           └─────────┬─────────┘<br>                     ▼<br>              👥 Consumer Group</pre><p>And behind all of this are concepts like:</p><pre>🏦 Brokers<br>💾 Storage<br>🔢 Offsets<br>📦 Partitions<br>🔁 Replication<br>👥 Consumer Groups<br>⚡ Parallel Processing<br>🛡️ Fault Tolerance</pre><h3>📚 What I Would Do Differently If I Started Again</h3><p>If I could restart my Kafka preparation, I wouldn’t try to memorize everything from day one.</p><p>I’d build the understanding in this order:</p><pre>Kafka<br> │<br> ├── 1. Why Kafka?<br> │<br> ├── 2. Producer / Consumer<br> │<br> ├── 3. Topics<br> │<br> ├── 4. Partitions<br> │<br> ├── 5. Consumer Groups<br> │<br> ├── 6. Offsets<br> │<br> ├── 7. Replication<br> │<br> └── 8. Delivery Semantics<br>        │<br>        ├── At-most-once<br>        ├── At-least-once<br>        └── Exactly-once</pre><p>And after every concept:</p><blockquote><strong><em>“What happens if something fails?”</em></strong></blockquote><p>That question is gold. 🥇</p><h3>❤️ What Kafka Taught Me</h3><p>The biggest lesson from learning Kafka wasn’t actually about Kafka.</p><p>It was about <strong>how to learn distributed systems</strong>.</p><p>At first, I was trying to remember definitions.</p><p>Then I started asking questions.</p><p>And questions forced me to understand the system.</p><p>Instead of:</p><blockquote><em>❌ “What is at-least-once?”</em></blockquote><p>I started asking:</p><blockquote><em>✅ “Where is the offset committed, and what happens if the consumer crashes before that?”</em></blockquote><p>Instead of:</p><blockquote><em>❌ “What is a partition?”</em></blockquote><p>I started asking:</p><blockquote><em>✅ “Why do we need partitions, and how do they help multiple consumers process data?”</em></blockquote><p>Instead of:</p><blockquote><em>❌ “What is Kafka?”</em></blockquote><p>I started asking:</p><blockquote><em>✅ “Why would I use Kafka instead of making every service call every other service directly?”</em></blockquote><p>That shift — from <strong>memorizing answers to understanding behavior</strong> — made Kafka much easier for me.</p><h3>🚀 Final Takeaway</h3><p>My Kafka journey started with:</p><blockquote><strong><em>“Kafka is used to transfer data asynchronously.”</em></strong></blockquote><p>Now my mental model is much richer:</p><pre>Events<br>  ↓<br>Producer<br>  ↓<br>Kafka<br>  ↓<br>Topics<br>  ↓<br>Partitions<br>  ↓<br>Consumers<br>  ↓<br>Consumer Groups<br>  ↓<br>Offsets<br>  ↓<br>Failure Handling<br>  ↓<br>Delivery Semantics</pre><p>And whenever Kafka gets confusing, I come back to one simple question:</p><h3>💡 “What happens when things go wrong?”</h3><p>Because that’s where the real understanding starts.</p><p>And honestly…</p><p>I’m still learning. 😄</p><p>But Kafka no longer feels like a giant list of scary terms.</p><p>It’s starting to feel like a system I can actually <strong>reason about</strong>.</p><p><strong>One concept at a time. 🚀</strong></p><h3>☕ Note to my future self</h3><p><strong>Don’t memorize Kafka.<br>Understand Kafka.<br>Draw it.<br>Break it.<br>Ask what happens when it fails.</strong></p><p>That’s how I’m learning it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a05d7ed7fc44" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deployment Strategies Every Engineer Should Know]]></title>
            <link>https://medium.com/@godslaysall/deployment-strategies-every-engineer-should-know-94754e909a42?source=rss-e8942cdb0956------2</link>
            <guid isPermaLink="false">https://medium.com/p/94754e909a42</guid>
            <dc:creator><![CDATA[Anish]]></dc:creator>
            <pubDate>Sat, 26 Sep 2026 10:04:57 GMT</pubDate>
            <atom:updated>2026-09-26T10:04:57.718Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>A practical guide to shipping code without turning every release into a production gamble.</strong></p><p>You’ve spent two weeks building a feature.</p><p>Tests pass. CI is green. Everything looks good.</p><p>You deploy.</p><p>Five minutes later, error rates start climbing.</p><p>Now you have a very different problem:</p><blockquote><strong><em>How do we release new code without making a small mistake everyone’s problem?</em></strong></blockquote><p>That’s what deployment strategies are really about.</p><h3>1. Rolling Deployment — Replace Gradually</h3><p>You have four instances running v1:</p><pre>v1   v1   v1   v1</pre><p>Instead of replacing everything at once:</p><pre>v2   v1   v1   v1<br>v2   v2   v1   v1<br>v2   v2   v2   v1<br>v2   v2   v2   v2</pre><p>That’s a <strong>rolling deployment</strong>.</p><p>Kubernetes uses RollingUpdate as the default Deployment strategy and lets you control the rollout using settings such as maxUnavailable and maxSurge.</p><p><strong>Why engineers like it</strong></p><ul><li>Minimal downtime</li><li>Doesn’t require a completely duplicated environment</li><li>Works naturally with containers and orchestration platforms</li></ul><p><strong>The catch:</strong> v1 and v2 coexist during the rollout.</p><p>So your new API and database changes need to be backward compatible.</p><h3>2. Blue-Green — Keep the Old Version Ready</h3><p>This approach maintains two environments.</p><pre>Load Balancer<br>                  /         \<br>                 ↓           ↓<br>             BLUE v1      GREEN v2<br>              LIVE          READY</pre><p>You deploy v2 to Green, test it, and then switch traffic.</p><pre>Before:<br>Users → Blue</pre><pre>After:<br>Users → Green</pre><p>If something goes wrong:</p><pre>Users → Blue</pre><p>That’s the appeal of Blue-Green: <strong>rollback can be a traffic switch rather than another application deployment.</strong></p><p>AWS documents Blue-Green deployment as running separate environments and shifting production traffic after the new environment has been validated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gvbSZUJcMKQQilhL" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HvnL9KfNOUnJf3CO" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*P9SaVhWokwszsuPd" /></figure><p>5</p><p><strong>The catch:</strong> You’re maintaining additional infrastructure.</p><h3>3. Canary — Don’t Give Everyone v2</h3><p>This is where deployment gets interesting.</p><p>Instead of sending everyone to v2:</p><pre>v1 → 100%</pre><p>start with:</p><pre>v1 → 95%<br>v2 → 5%</pre><p>Watch the system.</p><p>If things look healthy:</p><pre>v1 → 75%<br>v2 → 25%</pre><p>Then:</p><pre>v1 → 50%<br>v2 → 50%</pre><p>Eventually:</p><pre>v2 → 100%</pre><p>Google’s SRE guidance describes canarying as releasing to a subset first, evaluating the release, and then deciding whether to continue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tFX6bjD3Pm66E9bf" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-YHCTKl1J2uQoQ1a" /></figure><p>Monitor more than CPU:</p><ul><li><strong>5xx/error rate</strong></li><li><strong>p95/p99 latency</strong></li><li><strong>Database performance</strong></li><li><strong>Kafka consumer lag</strong></li><li><strong>Memory/CPU</strong></li><li><strong>Business metrics</strong></li></ul><p>The principle is simple:</p><blockquote><strong><em>Reduce the blast radius before increasing exposure.</em></strong></blockquote><h3>4. Shadow Deployment — Let v2 See Production</h3><p>Sometimes you don’t want users receiving responses from v2.</p><p>But you want v2 to experience real production traffic.</p><p>That’s <strong>shadow deployment</strong>.</p><pre>Request<br>                       │<br>                 ┌─────┴─────┐<br>                 ↓           ↓<br>               v1           v2<br>             PRIMARY       SHADOW<br>                 │           │<br>              Response     Ignored<br>                 │<br>                 ↓<br>                Use</pre><p>This is useful for:</p><ul><li>Major rewrites</li><li>Monolith → microservices migrations</li><li>Performance testing</li><li>New recommendation/ML systems</li></ul><p>But be careful.</p><p>If the request is:</p><pre>POST /payment</pre><p>you don’t want the shadow service charging the customer twice.</p><p>Shadow traffic usually needs side-effect controls, idempotency, or isolated dependencies.</p><p>AWS includes shadow deployment/testing among strategies used to reduce deployment risk.</p><h3>5. Feature Flags — Deployment ≠ Release</h3><p>Here’s one of the most useful ideas in modern software delivery.</p><p>You deploy the code:</p><pre>v2 deployed</pre><p>But keep the feature disabled:</p><pre>newCheckout = false</pre><p>Then gradually enable it:</p><pre>Internal users<br>      ↓<br>     1%<br>      ↓<br>    10%<br>      ↓<br>    50%<br>      ↓<br>   100%</pre><p>Now you have separated two decisions:</p><p><strong>Deployment:</strong> Is the code running?</p><p><strong>Release:</strong> Should users see the feature?</p><p>That gives you another escape hatch when something goes wrong.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LQrICZ64RGTpo8vy" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/0*SCAyIORwHsK5bpRS" /></figure><p>Feature toggles can be powerful, but stale flags create maintenance and testing complexity, so they should have an owner and a removal plan.</p><h3>6. Database Changes — The Rollback Trap</h3><p>Here’s where many deployment plans fall apart.</p><p>Suppose:</p><pre>v1 → first_name</pre><pre>v2 → full_name</pre><p>Don’t immediately rename or delete the old column.</p><p>Use <strong>expand and contract</strong>:</p><pre>1. Add full_name<br>       ↓<br>2. Deploy code supporting both<br>       ↓<br>3. Migrate the data<br>       ↓<br>4. Switch to full_name<br>       ↓<br>5. Remove first_name later</pre><p>Why?</p><p>Because application rollback is usually easy.</p><p><strong>Database rollback often isn’t.</strong></p><p>This becomes especially important when v1 and v2 coexist during rolling or canary deployments.</p><h3>The Real Production Pattern</h3><p>In real systems, you rarely pick just one strategy.</p><p>You combine them.</p><pre>Git<br>                 ↓<br>          CI/CD Pipeline<br>                 ↓<br>        Immutable Artifact<br>                 ↓<br>        Rolling Deployment<br>                 ↓<br>             5% Canary<br>                 ↓<br>           Observability<br>                 ↓<br>          Feature Flag<br>                 ↓<br>            100% Traffic</pre><p>And if something goes wrong:</p><pre>Error detected<br>              ↓<br>       Stop rollout<br>              ↓<br>       Disable feature<br>              ↓<br>         Roll back</pre><p>That’s much better than:</p><pre>Build → Deploy → Hope</pre><h3>Which Strategy Fits?</h3><p>SituationStrategyNormal application releaseRollingFast rollback mattersBlue-GreenHigh-risk production changeCanaryMajor rewriteShadowGradual feature releaseFeature FlagDatabase schema changeExpand &amp; Contract</p><p>These aren’t competing choices.</p><p>A production system can use <strong>all of them</strong>.</p><h3>One Question Before Every Production Deployment</h3><p>Before you press <strong>Deploy</strong>, ask:</p><blockquote><strong><em>If this release is broken, how will we know — and how quickly can we get back to safety?</em></strong></blockquote><p>If the answer is:</p><blockquote><em>“We’ll check the logs and figure it out.”</em></blockquote><p>You don’t have a deployment strategy yet.</p><p>A good deployment process gives you three things:</p><p><strong>Small blast radius.</strong><br> <strong>Fast feedback.</strong><br> <strong>Fast rollback.</strong></p><p>The tools will change — Kubernetes, ECS, Jenkins, GitHub Actions, Argo CD.</p><p>Those principles won’t.</p><h3>Ship small. Observe carefully. Roll back quickly.</h3><h3>References</h3><ul><li><a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/?utm_source=chatgpt.com">Kubernetes — Deployments</a></li><li><a href="https://sre.google/workbook/canarying-releases/?utm_source=chatgpt.com">Google SRE — Canarying Releases</a></li><li><a href="https://docs.aws.amazon.com/wellarchitected/latest/machine-learning-lens/deployment.html?utm_source=chatgpt.com">AWS — Deployment Strategies</a></li><li><a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-blue-green.html?utm_source=chatgpt.com">AWS ECS — Blue/Green Deployments</a></li><li><a href="https://developer.hashicorp.com/terraform/tutorials/aws/blue-green-canary-tests-deployments?utm_source=chatgpt.com">HashiCorp — Blue-Green &amp; Canary Deployments</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94754e909a42" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Java 26 Deep Dive: What Actually Changed?]]></title>
            <link>https://medium.com/@godslaysall/java-26-deep-dive-technical-changes-with-code-examples-a3645785a949?source=rss-e8942cdb0956------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3645785a949</guid>
            <dc:creator><![CDATA[Anish]]></dc:creator>
            <pubDate>Sat, 26 Sep 2026 09:33:51 GMT</pubDate>
            <atom:updated>2026-09-29T14:59:09.620Z</atom:updated>
            <content:encoded><![CDATA[<p>There is a lot of noise around every new Java release.</p><p>Every six months we see articles saying:</p><blockquote><em>“Here are the 10 amazing new Java 26 features!”</em></blockquote><p>But there is a better question to ask:</p><blockquote><strong><em>What actually changed in JDK 26 — and what should an existing Java application care about?</em></strong></blockquote><p>That distinction matters.</p><p>Some features are genuinely new in JDK 26.</p><p>Some are preview features that have been evolving for years.</p><p>And some — like Virtual Threads — are important to Java developers but <strong>have nothing to do with Java 26</strong>.</p><p>So let’s separate them.</p><h3>🧭 First: Understand the Categories</h3><p>Before looking at individual features, classify them:</p><pre>JDK 26<br>│<br>├── 🆕 New / enhanced<br>│   ├── HTTP/3<br>│   ├── AOT Object Caching with Any GC<br>│   ├── G1 throughput improvements<br>│   └── Final-field mutation warnings<br>│<br>├── 🔬 Preview / Incubator<br>│   ├── Structured Concurrency — 6th Preview<br>│   ├── Primitive Types in Patterns — 4th Preview<br>│   ├── PEM APIs — 2nd Preview<br>│   ├── Lazy Constants — 2nd Preview<br>│   └── Vector API — 11th Incubator<br>│<br>└── 📚 Existing features<br>    └── Virtual Threads — finalized in Java 21</pre><p>This distinction is more important than the number of features in the release.</p><h3>🔥 1. Primitive Types in Pattern Matching — Fourth Preview</h3><p>Java 26 continues the evolution of primitive types in pattern matching.</p><p>This is <strong>not new to Java 26</strong>.</p><p>The feature has been previewed across multiple releases and reaches its <strong>fourth preview</strong> in JDK 26.</p><p>The goal is to make primitive types usable naturally in pattern matching with constructs such as instanceof and switch.</p><p>Conceptually:</p><pre>Object value = 100;</pre><pre>if (value instanceof int number) {<br>    System.out.println(number);<br>}</pre><p>And:</p><pre>switch (value) {<br>    case int i -&gt; System.out.println(&quot;Integer: &quot; + i);<br>    case long l -&gt; System.out.println(&quot;Long: &quot; + l);<br>    default -&gt; System.out.println(&quot;Other&quot;);<br>}</pre><p>The important point is not:</p><blockquote><em>“Java 26 introduced pattern matching.”</em></blockquote><p>It didn’t.</p><p>Pattern matching itself has been evolving for years.</p><p>The interesting part is that Java continues to reduce the artificial boundary between <strong>reference types and primitive types</strong> in pattern matching.</p><p>⚠️ <strong>Still a preview feature.</strong></p><p>That means you should experiment with it, but you should not treat the syntax as finalized production Java yet.</p><h3>⚡ 2. Structured Concurrency — Sixth Preview</h3><p>Structured Concurrency is another feature that has been evolving for several Java releases.</p><p>JDK 26 brings it to its <strong>sixth preview</strong>.</p><p>And there is an important misconception to clear up:</p><h3>❌ This is not about try-with-resources.</h3><p>try-with-resources has existed since <strong>Java 7</strong>.</p><p>The interesting part is the <strong>StructuredTaskScope API</strong> and the structured lifecycle it gives to related concurrent tasks.</p><p>Consider a request that needs information from three independent services:</p><pre>Incoming Request<br>                         │<br>          ┌──────────────┼──────────────┐<br>          │              │              │<br>      Customer       Inventory       Payment<br>          │              │              │<br>          └──────────────┼──────────────┘<br>                         │<br>                       Join<br>                         │<br>                      Response</pre><p>The tasks belong to one logical operation.</p><p>With Structured Concurrency, that relationship becomes explicit:</p><pre>try (var scope = StructuredTaskScope.open()) {</pre><pre>    var customer =<br>        scope.fork(this::getCustomer);</pre><pre>    var inventory =<br>        scope.fork(this::getInventory);</pre><pre>    var payment =<br>        scope.fork(this::getPayment);</pre><pre>    scope.join();</pre><pre>    return new OrderResponse(<br>        customer.get(),<br>        inventory.get(),<br>        payment.get()<br>    );<br>}</pre><p>The important idea is <strong>structured lifetime</strong>.</p><p>Instead of creating independent tasks and manually managing their lifecycle, related tasks can be treated as a single unit.</p><p>That gives the runtime and the application a clearer model for:</p><ul><li>cancellation</li><li>failure propagation</li><li>task lifetime</li><li>joining</li><li>observability</li><li>request-scoped concurrency</li></ul><p>And tis is particularly interesting when combined with <strong>Virtual Threads</strong>.</p><p>⚠️ <strong>Still a preview feature.</strong></p><h3>🧵 3. Virtual Threads: Don’t Call This a Java 26 Feature</h3><p>This distinction is important.</p><p><strong>Virtual Threads were finalized in Java 21.</strong></p><p>So this:</p><pre>try (var executor =<br>        Executors.newVirtualThreadPerTaskExecutor()) {</pre><pre>    executor.submit(() -&gt; processRequest());<br>}</pre><p>is <strong>not a Java 26 feature</strong>.</p><p>It is Java 21 functionality.</p><p>And this:</p><pre>try (...) {<br>}</pre><p>is simply Java’s <strong>try-with-resources</strong>, introduced in Java 7.</p><p>So why mention Virtual Threads in a Java 26 article?</p><p>Because they provide important context for where Java concurrency is heading.</p><p>Think about the difference:</p><pre>Platform Thread<br>       │<br>       ▼<br>   OS-managed<br>       │<br>       ▼<br>More expensive</pre><p>versus:</p><pre>Virtual Thread<br>       │<br>       ▼<br>JVM-managed<br>       │<br>       ▼<br>Lightweight<br>       │<br>       ▼<br>Massive concurrency</pre><p>Virtual Threads are particularly useful for workloads that spend significant time waiting on I/O.</p><p>They improve <strong>scalability and throughput under concurrency</strong>.</p><p>They do not magically make CPU-bound work execute faster.</p><p>So the correct statement is:</p><blockquote><strong><em>Java 26 continues the evolution of modern concurrency, but Virtual Threads themselves are a Java 21 feature.</em></strong></blockquote><h3>🌐 4. HTTP/3 — A Genuine JDK 26 Addition</h3><p>Now we get to something genuinely new in JDK 26.</p><p>The Java HTTP Client API now supports <strong>HTTP/3</strong>.</p><p>HTTP/3 is built on QUIC rather than TCP:</p><pre>HTTP/3<br>   │<br>   ▼<br> QUIC<br>   │<br>   ▼<br> UDP</pre><p>Java applications can opt into HTTP/3:</p><pre>HttpClient client =<br>    HttpClient.newBuilder()<br>        .version(HttpClient.Version.HTTP_3)<br>        .build();</pre><pre>HttpRequest request =<br>    HttpRequest.newBuilder()<br>        .uri(URI.create(&quot;https://example.com&quot;))<br>        .GET()<br>        .build();</pre><pre>HttpResponse&lt;String&gt; response =<br>    client.send(<br>        request,<br>        HttpResponse.BodyHandlers.ofString()<br>    );</pre><p>One important detail:</p><p><strong>HTTP/3 is not the default protocol.</strong></p><p>Applications can opt in, and the HTTP Client can fall back to HTTP/2 or HTTP/1.1 depending on the discovery mode and server support.</p><p>HTTP/3 brings potential benefits such as:</p><ul><li>faster connection establishment</li><li>improved behavior under packet loss</li><li>reduced head-of-line blocking</li><li>QUIC-based transport</li></ul><p>For microservices that make large numbers of outbound HTTP calls, this is worth understanding.</p><p>But don’t assume:</p><blockquote><em>“HTTP/3 = automatically faster.”</em></blockquote><p>Actual gains depend on network conditions, server support, traffic patterns and deployment architecture.</p><h3>🚀 5. AOT Object Caching — Project Leyden Moves Forward</h3><p>This is another significant JDK 26 improvement.</p><p>Project Leyden has been working toward improving:</p><ul><li>startup time</li><li>warm-up time</li><li>application footprint</li></ul><p>JDK 26 brings <strong>Ahead-of-Time Object Caching with Any GC</strong>.</p><p>The important improvement is that AOT object caching is no longer tied to a particular garbage collector.</p><p>That includes <strong>ZGC</strong>.</p><p>Conceptually:</p><pre>Traditional JVM startup</pre><pre>Start JVM<br>   ↓<br>Load classes<br>   ↓<br>Link classes<br>   ↓<br>Initialize runtime<br>   ↓<br>JIT compilation / warm-up<br>   ↓<br>Application reaches peak performance</pre><p>AOT caching moves some of that work earlier:</p><pre>Training / Build<br>      ↓<br>AOT cache<br>      ↓<br>Cached classes + objects<br>      ↓<br>JVM startup<br>      ↓<br>Less work at runtime<br>      ↓<br>Faster startup / warm-up</pre><p>This is particularly interesting for:</p><p>☁️ Serverless workloads<br>🐳 Containers<br>📈 Auto-scaling services<br>⚡ Short-lived JVM processes</p><p>But there is an important operational consideration:</p><p><strong>The AOT cache is tied to the application and runtime environment.</strong></p><p>Changing application code, libraries or the JDK can require regenerating the cache.</p><p>So this isn’t simply:</p><pre>Enable flag → JVM becomes faster</pre><p>It is a build/runtime optimization that needs benchmarking and an appropriate deployment pipeline.</p><h3>🧠 6. G1 GC — Less Synchronization, Better Throughput</h3><p>JDK 26 also includes a G1 improvement focused on application throughput.</p><p>The problem is related to the synchronization overhead associated with G1’s write barriers and concurrent refinement.</p><p>The JDK 26 work reduces that synchronization overhead.</p><p>The goal is straightforward:</p><pre>Application<br>    │<br>    ▼<br>Object writes<br>    │<br>    ▼<br>Write barrier<br>    │<br>    ▼<br>Less synchronization<br>    │<br>    ▼<br>Better application throughput</pre><p>This is primarily a JVM implementation improvement.</p><p>You don’t normally need to change application code.</p><p>And this is a good reminder:</p><blockquote><strong><em>Don’t tune GC because a blog tells you to.</em></strong></blockquote><p>Measure:</p><pre>Allocation rate<br>GC pause time<br>CPU utilization<br>Heap utilization<br>Old-gen promotion<br>Application throughput</pre><p>Then make changes based on your workload.</p><p><strong>Don’t copy JVM flags from a blog and call it GC tuning.</strong></p><h3>⚠️ 7. Final-Field Mutation: The JDK 26 Warning You Should NOT Ignore</h3><p>This is arguably one of the most important migration-related changes in JDK 26.</p><p>JDK 26 starts issuing warnings when code uses deep reflection to mutate final fields in situations where that mutation has not been explicitly enabled.</p><p>Historically, code could use reflection to bypass normal final-field restrictions.</p><p>For example:</p><pre>Field field =<br>    MyClass.class.getDeclaredField(&quot;value&quot;);</pre><pre>field.setAccessible(true);</pre><pre>field.set(object, &quot;new value&quot;);</pre><p>That is problematic because final fields provide important guarantees to the Java language and JVM.</p><p>They enable optimizations and are fundamental to the semantics of immutable objects.</p><p>The direction of the platform is therefore:</p><pre>Deep reflection<br>      │<br>      ▼<br>Mutating final fields<br>      │<br>      ▼<br>JDK 26: Warning ⚠️<br>      │<br>      ▼<br>Future JDKs: Stronger enforcement</pre><h3>🔎 How Do You Find the Code Causing the Warning?</h3><p>This is where JDK 26 becomes particularly useful during migration.</p><p>Run:</p><pre>java \<br>  --illegal-final-field-mutation=debug \<br>  -jar application.jar</pre><p>debug mode reports the warning together with a stack trace for each illegal final-field mutation.</p><p>That lets you trace something like:</p><pre>Field.set()<br>     ↓<br>Reflection utility<br>     ↓<br>Serialization / mapping library<br>     ↓<br>Third-party dependency<br>     ↓<br>Your application</pre><p>And this is important:</p><h3>The offending code may not be yours.</h3><p>It could be coming from:</p><ul><li>serialization frameworks</li><li>object mappers</li><li>mocking libraries</li><li>dependency-injection frameworks</li><li>bytecode libraries</li><li>legacy dependencies</li></ul><p>This is why a JDK migration should include <strong>runtime warning analysis</strong>.</p><h3>🧪 Want to Test Future Behavior?</h3><p>You can explicitly test with:</p><pre>java \<br>  --illegal-final-field-mutation=deny \<br>  -jar application.jar</pre><p>In deny mode, illegal final-field mutation fails with IllegalAccessException.</p><p>This is useful for finding code paths that will not work once stricter enforcement becomes the default.</p><p>The migration flow becomes:</p><pre>Run JDK 26<br>      ↓<br>Collect warnings<br>      ↓<br>Find the stack trace<br>      ↓<br>Identify dependency / application code<br>      ↓<br>Upgrade or replace dependency<br>      ↓<br>Test with deny mode<br>      ↓<br>Remove the workaround</pre><h3>🛠️ What If a Legacy Library Still Needs It?</h3><p>JDK 26 provides an explicit opt-in mechanism:</p><pre>--enable-final-field-mutation=ALL-UNNAMED</pre><p>This grants the required capability to code in the unnamed module.</p><p>But treat this as a <strong>migration or compatibility mechanism</strong>, not as the preferred architectural solution.</p><p>The preferred direction is:</p><pre>Old library<br>    ↓<br>Upgrade<br>    ↓<br>Remove deep reflective mutation<br>    ↓<br>Run JDK 26 tests<br>    ↓<br>No warnings</pre><p>The platform is moving toward stronger integrity guarantees around final fields.</p><h3>🗑️ 8. Applet API Has Been Removed</h3><p>This one is less exciting for modern backend developers, but it matters for migration.</p><p>The old Java Applet API, deprecated for removal since JDK 17, has been <strong>removed in JDK 26</strong>.</p><p>So if you’re migrating a very old application, don’t treat JDK upgrades as simply:</p><pre>Change Java version<br>      ↓<br>Run Maven<br>      ↓<br>Fix compilation errors</pre><p>You also need to check:</p><pre>Removed APIs<br>Deprecated APIs<br>Illegal reflective access<br>Runtime warnings<br>Third-party dependencies<br>JVM flags</pre><h3>🔬 9. More Preview and Incubator Features</h3><p>JDK 26 also continues Java’s experimental evolution.</p><p>Some notable examples include:</p><h3>Structured Concurrency</h3><p><strong>Sixth Preview</strong></p><pre>JDK 19 → Incubator<br>JDK 21 → Preview<br>JDK 22 → Preview<br>JDK 23 → Preview<br>JDK 24 → Preview<br>JDK 25 → Fifth Preview<br>JDK 26 → Sixth Preview</pre><h3>Primitive Types in Patterns</h3><p><strong>Fourth Preview</strong></p><pre>JDK 23 → First Preview<br>JDK 24 → Second Preview<br>JDK 25 → Third Preview<br>JDK 26 → Fourth Preview</pre><h3>PEM Encodings of Cryptographic Objects</h3><p><strong>Second Preview</strong></p><h3>Lazy Constants</h3><p><strong>Second Preview</strong></p><h3>Vector API</h3><p><strong>Eleventh Incubator</strong></p><p>These are interesting for experimentation and future Java evolution.</p><p>But there is a simple rule:</p><blockquote><strong><em>Preview does not mean production-ready.</em></strong></blockquote><p>Don’t build a critical production architecture around a preview API simply because the syntax looks attractive.</p><h3>🎯 So What Actually Changed in JDK 26?</h3><p>A more accurate summary looks like this:</p><pre>Java 21<br> └── Virtual Threads finalized</pre><pre>Java 24<br> └── AOT Class Loading &amp; Linking</pre><pre>Java 25<br> ├── AOT Command-Line Ergonomics<br> ├── AOT Method Profiling<br> └── Structured Concurrency — Fifth Preview</pre><pre>Java 26<br> ├── HTTP/3<br> ├── AOT Object Caching with Any GC<br> ├── G1 throughput improvements<br> ├── Final-field mutation warnings<br> ├── Applet API removal<br> │<br> ├── Structured Concurrency — Sixth Preview<br> ├── Primitive Types in Patterns — Fourth Preview<br> ├── PEM APIs — Second Preview<br> ├── Lazy Constants — Second Preview<br> └── Vector API — Eleventh Incubator</pre><h3>🧩 What Should Existing Java Applications Actually Care About?</h3><p>If you’re running Java 21 or Java 25 in production, don’t immediately start rewriting your code.</p><p>Instead, evaluate JDK 26 in categories:</p><p>ChangeWhat it means for existing applicationsHTTP/3Relevant if your application is an HTTP client and HTTP/3 fits your networkAOT Object CachingPotential startup/warm-up improvement; benchmark itG1 improvementsJVM-level optimization; measure rather than manually tuneFinal-field warnings<strong>Investigate during migration</strong>Applet removalRelevant mainly to legacy applicationsStructured ConcurrencyExperiment with modern concurrency patternsPrimitive patternsLanguage evolution; still previewPEM APIsInteresting for cryptographic tooling; still previewLazy ConstantsJVM/language evolution; still previewVirtual ThreadsAlready available since Java 21</p><h3>🧠 The Bigger Lesson</h3><p>When reading a new Java release announcement, don’t just ask:</p><blockquote><strong><em>“What features were added?”</em></strong></blockquote><p>Ask:</p><pre>Was it...</pre><pre>🆕 Introduced?<br>✅ Finalized?<br>🔧 Enhanced?<br>🔬 Re-previewed?<br>🧪 Incubating?<br>🗑️ Removed?<br>⚠️ Generating migration warnings?</pre><p>That distinction is especially important for production systems.</p><p>Because:</p><pre>New feature<br>    ≠<br>Feature finalized<br>    ≠<br>Feature production-ready<br>    ≠<br>Feature relevant to your application</pre><p>And that’s probably the most useful way to look at Java 26.</p><p><strong>Don’t recycle Java 21 features and label them as Java 26 features.</strong></p><p>Instead, understand <strong>what actually changed, why it changed, and what it means for the applications you already run.</strong></p><p>#Java #Java26 #JDK26 #JVM #SpringBoot #Microservices #StructuredConcurrency #HTTP3 #VirtualThreads #G1GC #AOT #ProjectLeyden #JavaDevelopment #BackendDevelopment #CloudNative #SoftwareEngineering</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3645785a949" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>