Exploring the approaches to handling server’s requests
In client-server communication, we have a process flow where a client sends a request, the server receives it, and it starts to do some work. Once the server finishes its work, it replies to the client with a result. From the client’s perspective, this flow does not change. It’s always about sending a request and receiving a response. What can change, though, is how the server can internally handle how a request is processed.
There are two approaches to handling the server’s request processing: reactive and imperative. So, let’s see how a server can handle requests imperatively.
Imperative
In a traditional web application running on Tomcat, every request that’s received by the server triggers the creation of a worker thread on something called a thread pool. In Tomcat, a thread pool is a mechanism that controls the life cycle and availability of worker threads that serve application...