This module requires some dependencies to be download as listed below. (Also available in the README.md of the module) Now I open /structure/views and create a new view by clicking “Add View”. I name…
Imagine your web server only has a limit of 1000 threads configured and your backend server which mainly handles business logic has a limit of 400 threads. Under a high concurrency scenario, the overwhelming requests to the web server could lead to a breakdown of the backend server.
In this article, we are going to use the approach of batch processing to solve this problem. There are a few Java classes that play an important role in order to achieve it, including CompletableFuture, LinkedBlockingDeque, ScheduledExecutorService, and CountDownLatch. If you would like to explore the use cases of the abovementioned classes, this article will help you understand them. Let’s dive down to it.
To start with, I am going to start with a simple test case.
Let’s take a look line by line.
Firstly, we have a userService class. This service class mainly contains the business logic of how we are going to handle the orderId given by the user. We will take a closer look at this class later.
Next, we want to imitate the high concurrency scenario. As mentioned at the beginning of the article, let’s assume the number of threads now is 1000. But how are we going to realize that all threads are started together?
Here comes the CountDownLatch. A CountDownLatch class is fairly simple. Remember in high school, teachers always have this…
Many of us lead busy lives, and at times it feels like time passes by without even realizing it. This is caused by many aspects around us, some are so microscopic that we are unconscious of them…
When I first started freelance writing, getting started with new clients required a lot of time and energy. I didn’t have a good process in place, so there was lots of back and forth emailing and…
Smart Contracts are becoming increasingly popular everyday because of their automated nature. In Hyperledger Fabric terms, Smart Contracts are referred to as Hyperledger Fabric Chaincode. And…