Boost Your Application’s Performance with Virtual Threads in Java and Spring: Exploring Project Loom
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
- What is project Loom?
- How to use virtual threads?
- Spring MVC with virtual threads
- 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…