As your application grows, it’s natural to expect that performance may start to suffer due to increased load, data volume, and complexity. This can manifest as slow response times, high latency, and increased resource utilization. There are many factors that can contribute to these issues, such as inefficient data storage, poor network performance, and inadequate hardware resources.
Fortunately, there are also many tools and technologies available to help optimize application performance. One such technology is Hazelcast, a distributed in-memory data grid that can help improve performance by caching data in memory, reducing database access times, and enabling real-time processing.
In this article, we’ll share how we tackled the slow app issue during the software revamp for one of our clients.
The Need for Speed: Revamping a Slow Real-Time Bidding App
Our client asked us to make a complete revamp of the existing app. During the discovery phase, we figured out that there was plenty of room for improvement, especially in performance. The existing app version was somewhat slow, which was a critical issue considering the app’s nature.
A bidding process often evokes emotion and users get committed to winning, so they are trying to outbid each other at a very high pace. This leads to a very high volume of almost simultaneous bidding requests, which turned into a major technical challenge.
Behind the Scenes: Discovering the Problem
Here is how the application was implemented initially:
Whenever a user placed a bid, the following happened:
1.The request was sent to to an API layer
2.At the API layer the service was pre-processed and passed on to the service layer
3.Next, the bid was processed by a part of business logic, registered and saved in DB.
4.Only after these steps, other app clients were notified via WebSockets that the counter had changed. The crucial thing is that the entire process needs to be all completed in a matter of milliseconds.
Key problem
When investigating our logs and application performance metrics our team found that the most time-consuming operation in the entire chain was an interaction with the database. Reading the latest counter state from DB and updating it took most of the time.
At that point, we understood that direct interaction with the database was not a solution. We had to come up with something better. And we did.
We knew we had to act fast and give this app the makeover it deserved. So, we rolled up our sleeves and got to work. Further, we’ll share how we tackled this app revamp challenge and made it lightning-fast.
How We Improved the Performance of a Real-Time Bidding Java App with Hazelcast
As we were thinking over different solutions, one idea turned out to be particularly appealing.
We were curious about what would happen if the bid weren’t saved directly to the database. Instead, it would go to a sort of an in-memory database located close to server instances. Our team admitted that in that scenario, we would not block the whole process of incoming bids while previous bids were registering in our main database (which, as you remember, is the most time-consuming operation). ORIL selected Hazelcast as a fast in-memory database for our application.
What is Hazelcast?
Hazelcast is an open-source in-memory data grid platform that lets you store and process large amounts of data in a distributed and highly available way. This way it provides a fast, scalable, and fault-tolerant infrastructure for your app, allowing you to process large data sets in real time.
Hazelcast is frequently used in Java applications as a caching solution to improve performance and reduce latency. You may find it used for fraud detection, 360-degree customer view, microservices, risk management, digital transformation, IoT, and caching.
The platform offers the following advantages:
- Reduced the risk and costs of downtime
- Increased security based on Java cryptography architecture
- Combined high-density storage and the lowest available latency to perform under the most demanding conditions
- Available for multiple cloud platforms and on-premises deployments
How Hazelcast Solved Speed Issues in Our Application
The Hazelcast solution drastically changed the entire flow. Now, as a user places a bid, the request goes to the API layer, then the service layer which processes the request and stores data in Hazelcast, in-memory storage. Compared to sending the bid to the main database, this flow proved to be 20 times faster. It’s like giving the app a dose of Red Bull — it went from sleepy to completely awake.
It is important to note that we still use the “standard” database to store and process bids. However, with the new approach, it is done in a non-blocking asynchronous way.
Results
During our tests, we were excited to reveal that we can now have up to 10-20 times more bids being registered in 1 second compared to the previous solution. That’s amazing!
Basically, using Hazelcast and other in-memory data grids let you rapidly transition data parts that usually undergo modifications closer to servers. By adopting this approach, we managed to boost different parts of an application, which was our goal during software redevelopment.
Let’s Speed Up
So, there you have it — a slow app is not the end of the world. With the right tech stack like Hazelcast and a bit of magic from experienced developers, you can turn your lagging app into a swift and fast-loading one.
At ORIL, we helped our clients to successfully transform many products, which allowed businesses to reach their full potential. Whether you need a revamp or a fresh start, our app development services have got you covered. Don’t let a slow app hold you back — let us help you speed things up and take your business to the next level.