In a Multi thread model the server assign incoming requests to a new thread similar as a client server architecture, the user generate a request by interaction with the application and then it sent to the server.
So every time a new request comes in the server maps a new trend from the thread pool to the incoming request, then the thread is responsible for processing those requests and sending back the response.
So the number of requests is equal to the number of threads used from the thread pool.
Now the thread present in the thread pool are in limited number based on the resources.
Now suppose we have millions of request coming in per second and as the thread present in above image are in limited number so there will a situation when all the threads are exhausted from the thread pool.
In that situation a new incoming request has to wait until the thread processes the last request and return back the result.
So this is a situation of scalability which could be resolve by adding more resources and creating more threads inside the thread pool.
But this is a costly solution.
We have an easier way of doing that using a single thread model.
Second Limitation of Multi thread model.
- If multi threaded model for every request server creates a separate thread which handle the request.
- If a thread acquire a lock in the shared resources and it is exclusive lock, it will block other threads, so this create a bottleneck situation in processing requests over shared resources and will affect the response time of the server.