<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Virtual-Threads on tsvinc</title>
    <link>https://tsvinc.dev/tags/virtual-threads/</link>
    <description>Recent content in Virtual-Threads on tsvinc</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Thu, 02 Jul 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://tsvinc.dev/tags/virtual-threads/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>The Throughput Was Always 115</title>
      <link>https://tsvinc.dev/posts/28-apis-same-throughput/</link>
      <pubDate>Thu, 02 Jul 2026 00:00:00 +0000</pubDate>
      <guid>https://tsvinc.dev/posts/28-apis-same-throughput/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part 17 of &lt;a href=&#34;https://tsvinc.dev/series/micronaut-256mb/&#34;&gt;the Micronaut native image series&lt;/a&gt;. Follows &lt;a href=&#34;https://tsvinc.dev/posts/designed-reactive-benchmark/&#34;&gt;Part 16&lt;/a&gt;, which compared reactive vs imperative on a lighter workload. Assumes familiarity with Project Reactor and virtual threads.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;115&#34;&gt;115&lt;/h2&gt;&#xA;&lt;p&gt;That&amp;rsquo;s the number. Requests per second. For all twelve scenarios.&lt;/p&gt;&#xA;&lt;p&gt;Reactive R2DBC on native: 115. Imperative JDBC on JVM: 115. Virtual threads with loom-carrier: 114.5. Reactive on JVM with 512 MB memory limit: 115.2. Imperative on JVM unlimited: 115.1.&lt;/p&gt;&#xA;&lt;p&gt;Twelve benchmark runs. Two codebases. Three runtime configurations. Six memory/container permutations each. 0% failure rate across the board. And the same number, over and over, like a metronome that doesn&amp;rsquo;t care what&amp;rsquo;s playing.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Designed a Reactive Benchmark. Imperative Won.</title>
      <link>https://tsvinc.dev/posts/designed-reactive-benchmark/</link>
      <pubDate>Tue, 30 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://tsvinc.dev/posts/designed-reactive-benchmark/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part 16 of &lt;a href=&#34;https://tsvinc.dev/series/micronaut-256mb/&#34;&gt;the Micronaut native image series&lt;/a&gt;. Follows &lt;a href=&#34;https://tsvinc.dev/posts/seven-scenarios-one-table/&#34;&gt;Part 15&lt;/a&gt;, which benchmarked the reactive service alone. Assumes familiarity with Project Reactor and virtual threads.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-hypothesis&#34;&gt;The Hypothesis&lt;/h2&gt;&#xA;&lt;p&gt;The workload was designed to make reactive shine. Six endpoints exercising parallel fan-out, scatter-gather, bounded concurrency, and backpressure. A Go mock server injecting realistic latency jitter — ISS at 10-50ms with 3% failures, NEO at 30-150ms, connection resets via &lt;code&gt;Hijack()&lt;/code&gt; + &lt;code&gt;conn.Close()&lt;/code&gt;. k6 ramping to 200 VUs then sustaining 500 req/s constant arrival. If reactive Micronaut had a home-court advantage anywhere, it was here.&lt;/p&gt;</description>
    </item>
    <item>
      <title>265 req/s on All Three Runtimes (Until You Add a Memory Limit)</title>
      <link>https://tsvinc.dev/posts/seven-scenarios-one-table/</link>
      <pubDate>Sat, 27 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://tsvinc.dev/posts/seven-scenarios-one-table/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part 15 of &lt;a href=&#34;https://tsvinc.dev/series/micronaut-256mb/&#34;&gt;the Micronaut native image series&lt;/a&gt;. Assumes familiarity with reactive Java (Mono/Flux) and container memory limits.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-draw&#34;&gt;The Draw&lt;/h2&gt;&#xA;&lt;p&gt;Native image, JVM, and virtual threads walk into a benchmark. Same reactive Micronaut service. Same k6 load profile. Same PostgreSQL. Same mock APIs with realistic latency jitter.&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;Runtime&lt;/th&gt;&#xA;          &lt;th&gt;Req/s&lt;/th&gt;&#xA;          &lt;th&gt;Errors&lt;/th&gt;&#xA;          &lt;th&gt;RSS (avg)&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Native (unlimited)&lt;/td&gt;&#xA;          &lt;td&gt;264&lt;/td&gt;&#xA;          &lt;td&gt;1.0%&lt;/td&gt;&#xA;          &lt;td&gt;273 MB&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;JVM (unlimited)&lt;/td&gt;&#xA;          &lt;td&gt;266&lt;/td&gt;&#xA;          &lt;td&gt;1.0%&lt;/td&gt;&#xA;          &lt;td&gt;551 MB&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;Virtual threads (unlimited)&lt;/td&gt;&#xA;          &lt;td&gt;265&lt;/td&gt;&#xA;          &lt;td&gt;1.0%&lt;/td&gt;&#xA;          &lt;td&gt;543 MB&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;265 req/s. All three. The error rates match the mock server&amp;rsquo;s configured failure rate — the application itself isn&amp;rsquo;t failing. Reactive code runs identically on native image, HotSpot, and loom-carrier Netty.&lt;/p&gt;</description>
    </item>
    <item>
      <title>ExecutorType.VIRTUAL Doesn&#39;t Exist</title>
      <link>https://tsvinc.dev/posts/executor-type-virtual/</link>
      <pubDate>Thu, 25 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://tsvinc.dev/posts/executor-type-virtual/</guid>
      <description>&lt;p&gt;&lt;em&gt;Part 14 in the &lt;a href=&#34;https://tsvinc.dev/series/micronaut-256mb/&#34;&gt;Memory Benchmark series&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-config-everyone-writes&#34;&gt;The Config Everyone Writes&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nt&#34;&gt;micronaut&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;executors&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;io&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;      &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;type&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;VIRTUAL&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Every tutorial. Every &amp;ldquo;Micronaut + virtual threads&amp;rdquo; blog post. Every AI suggestion. This is the obvious config. One property, clean intent.&lt;/p&gt;&#xA;&lt;p&gt;It crashes at startup:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;No enum constant io.micronaut.scheduling.executor.ExecutorType.VIRTUAL&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id=&#34;the-enum-that-actually-exists&#34;&gt;The Enum That Actually Exists&lt;/h2&gt;&#xA;&lt;p&gt;&lt;code&gt;ExecutorType&lt;/code&gt; in Micronaut 5.0.0 has five values:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;code&gt;SCHEDULED&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;CACHED&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;FIXED&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;WORK_STEALING&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;THREAD_PER_TASK&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;No &lt;code&gt;VIRTUAL&lt;/code&gt;. Never was one.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-config-that-works&#34;&gt;The Config That Works&lt;/h2&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-yaml&#34; data-lang=&#34;yaml&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nt&#34;&gt;micronaut&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;  &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;executors&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;    &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;io&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;      &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;type&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;l&#34;&gt;THREAD_PER_TASK&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;      &lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;virtual&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;kc&#34;&gt;true&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Two properties. &lt;code&gt;type&lt;/code&gt; selects the executor creation strategy &amp;ndash; &lt;code&gt;THREAD_PER_TASK&lt;/code&gt; maps to &lt;code&gt;Executors.newThreadPerTaskExecutor(factory)&lt;/code&gt;. &lt;code&gt;virtual&lt;/code&gt; sets that factory to produce virtual threads instead of platform threads.&lt;/p&gt;</description>
    </item>
    <item>
      <title>We Removed Reactor. Nothing Got Slower.</title>
      <link>https://tsvinc.dev/posts/reactor-removal-benchmark/</link>
      <pubDate>Sat, 20 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://tsvinc.dev/posts/reactor-removal-benchmark/</guid>
      <description>&lt;p&gt;We took the entire reactive stack out. R2DBC, Mono, Flux, Reactor Core, loom-carrier, &lt;code&gt;flatMap&lt;/code&gt; with its carefully-tuned concurrency arguments. Replaced it with JDBC, HikariCP, and blocking method calls. Same endpoints. Same Netty HTTP server. Same PostgreSQL. Same k6 load profile: 10 to 200 VUs, 500 req/s constant arrival rate, seven scenarios each.&lt;/p&gt;&#xA;&lt;p&gt;Throughput didn&amp;rsquo;t move. Latency dropped. Memory dropped. GC pauses dropped 63% at 256 MB.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-scoreboard&#34;&gt;The Scoreboard&lt;/h2&gt;&#xA;&lt;p&gt;This is &lt;a href=&#34;https://tsvinc.dev/series/micronaut-256mb/&#34;&gt;part of the series&lt;/a&gt; benchmarking a Micronaut 5.0.0 app under memory constraints. The reactive version is the one from &lt;a href=&#34;https://tsvinc.dev/posts/flatmap-backpressure/&#34;&gt;Part 10&lt;/a&gt; and &lt;a href=&#34;https://tsvinc.dev/posts/loom-carrier-reactive/&#34;&gt;Part 11&lt;/a&gt; — fully tuned, &lt;code&gt;flatMap&lt;/code&gt; concurrency bounded, R2DBC pool sized to match, loom-carrier enabled for virtual threads. The imperative version: JDBC/HikariCP, &lt;code&gt;THREAD_PER_TASK&lt;/code&gt; executor for virtual threads, same pool size.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Loom Carrier on a Reactive Stack: 78 MB for Free</title>
      <link>https://tsvinc.dev/posts/loom-carrier-reactive/</link>
      <pubDate>Wed, 17 Jun 2026 00:00:00 +0000</pubDate>
      <guid>https://tsvinc.dev/posts/loom-carrier-reactive/</guid>
      <description>&lt;p&gt;&amp;ldquo;Virtual threads don&amp;rsquo;t help reactive apps.&amp;rdquo; You&amp;rsquo;ve heard this. Probably said it. The reasoning is sound: a fully reactive stack — &lt;code&gt;Mono&lt;/code&gt;/&lt;code&gt;Flux&lt;/code&gt; from HTTP client through R2DBC to Netty — never blocks a platform thread. Virtual threads solve blocking. No blocking, no benefit. QED.&lt;/p&gt;&#xA;&lt;p&gt;We ran the benchmark anyway. The conventional wisdom is correct about throughput and wrong about everything else.&lt;/p&gt;&#xA;&lt;h2 id=&#34;the-stack&#34;&gt;The Stack&lt;/h2&gt;&#xA;&lt;p&gt;Space Observatory: Micronaut 5.0.0, Netty, R2DBC PostgreSQL, Reactor Core, Micrometer. Reactive end-to-end — no &lt;code&gt;subscribeOn(Schedulers.boundedElastic())&lt;/code&gt;, no blocking JDBC, no thread-per-request anywhere. GraalVM CE 25, Java 25.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
