/images/avatar.jpg

David Vlijmincx | Senior software developer

I am a Senior developer, Public speaker, Java blogger, and Author

Spring use Virtual threads

Introduction In this post, I quickly wanted to show you how to use virtual thread with Spring. All you have to do is enable it. That is if you are already running Java 21 and using Spring 3.2.0 or later. Enabling Virtual Threads To enable virtual threads all you need to do is to create an applications.properties file in the resource directory if you don't have one already, and add the following line:

Benchmarking Java code with JMH

Introduction In this post, we take a look at how to benchmark Java code using JMH. JMH is a tool or harness as they call it to benchmark code running on the JVM. The tool takes care of warm-ups, can prevent code optimizations, and running multiple variations of the benchmarks. Dependencies To use JMH in your project include the following dependencies in your pom.xml file. 1 2 3 4 5 6 7 8 9 10 <dependency> <groupId>org.

Virtual vs Platform Threads for API Calls

This post dives into virtual threads and explores if they are a silver bullet for making a high volume of API calls. Intro The application I am working on performs a significant number of concurrent REST calls (over 10_000) with minimal processing required on the response. This scenario seems ideal for virtual threads. Let's analyze how they perform application and if the switch is worthwhile. Background Virtual threads introduce an abstraction layer on top of traditional platform threads.

Virtual vs Platform Threads When blocking operations return too fast

final update See this post for the most accurate results: Virtual vs platform threads when making API calls Update After some feedback, I ran some new tests using code that is mentioned in JEP 444: Virtual Threads. which is this one: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 void handle(Request request, Response response) { var url1 = .