Boost Your Application’s Performance with Virtual Threads in Java and Spring: Exploring Project Loom

Amit Himani
6 min readJun 17, 2023

In my previous banking project, we had a situation where we received thousands of requests for authentication. To ensure security, we relied on a third-party system to send SMS OTPs for verification. However, sometimes the third-party system took longer than expected to acknowledge the request, causing delays. Thread per request model was utilized which means number of threads are in waiting state and new requests are in pool. We tried to optimise the performance by fine tuning number of threads, I wish we had virtual thread feature at that time. At that time, virtual thread concepts were not available in Java. This is where Project Loom comes into play.

In this article we will discuss following

  1. What is project Loom?
  2. How to use virtual threads?
  3. Spring MVC with virtual threads
  4. Performance test comparison of with and without virtual threads

What is Project Loom?

Project Loom acts as a helpful tool that aims to simplify your life as a developer. Its main objective is to make it easier for you to write, maintain, and observe applications that need to handle multiple tasks concurrently. It achieves this by…

--

--

Amit Himani

Cloud Architect with 15 years of experience. I enjoy reading about emerging technologies, staying up-to-date on tech and sharing with others through this blog