1. Is Connection Pooling is different from Thread Pooling?
2. If One connection will be connected to One thread...How does thread pooling is going to affect Connection Pooling?
3. How does the Connection Pool and Thread Pool plays a significant role in Blocking I/O vs Non-Blocking I/O RDBMS?
Thread pooling fell out of favor long ago. There was a time when creating threads was an expensive operation - hence the idea to reuse them. But that is no longer the case, and consequently thread pools largely ceased to be used.
That is different from connection pools, which are widely used, because creating a DB connection is still a comparatively expensive operation.
posted 3 months ago
Can you please explain each question in detail to understand better?
I'm not sure that makes sense - you seem to be under the impression that thread pooling and connection pooling are somehow related - they're not. And blocking/non-blocking IO is yet another subject. If you have a more specific question about a particular situation, we could answer in more detail.
posted 3 months ago
We have an application built using JDBC which is blocking I/O
JDBC will send a query to a database and hold up the thread making the query until the result comes back.
JDBC is a series of APIs that talk to a database, but is blocking.
Attempts to scale JDBC have been implemented by putting JDBC connections behind a thread pool, but when the thread pool gets saturated, it can eventually block at accepting new work, defeating the whole endeavor.
Blocking JDBC behavior requires threads to be put into I/O wait until receiving a response.
How to fix or convert the existing application which uses JDBC as Non Blocking I/O ??
Pooling is a generic construct. A pool is a collection of identical (interchangeable) objects. You petition the pool manager to return one of them, use it, and then return it so that some other task can use it. The main advantage of pooling comes when you're managing objects that take a lot of work to create. That includes things like database connections, but really anything. There is at least one generic pool library in the Apache java libraries collections. In fact, the Apache generic database connection pool itself pulls in and uses the Apache generic pool library.
Tim Moores wrote:Thread pooling fell out of favor long ago. There was a time when creating threads was an expensive operation - hence the idea to reuse them. But that is no longer the case, and consequently thread pools largely ceased to be used.
I'm sure that the people who work on web application servers such as Tomcat would be interested in hearing that.
In fact, the J2EE standard expressly forbids that servlets or EJBs should spawn threads for precisely the reason that if you return a thread to the server pool (return from servlet) and it has child threads hanging off it, you've violated the core requirement that all pool objects be identical. Which can crash the server unpredictably.