OCCI connectionpool doesn't work well [message #137713]
Fri, 16 September 2005 04:23
Messages: 2 Registered: September 2005
In a multi-thread program I create a connectionpool, setting the maxconn as 1. All threads will create a pooled connection. But when the program is running, I logged in the database connected and selected the v$session table. I found the sessions number is not one. I am confuesd. I think the pooled connections are not the real connections to the database. If the maxconn is 1, the session number should be 1. Is it right? Does the connectionpool work or not?
Re: OCCI connectionpool doesn't work well [message #138000 ]
Mon, 19 September 2005 06:09
Messages: 28 Registered: July 2005
Junior Member
The ConnectionPool pools the physical connections. If the pool max is 5, there will be a maximum of 5 real physical connections with 5 primary(internal) sessions created. Now if the pool is used by 100 threads with 100 user sessions, you will see a total of 100+5 sessions. Do not bother about the 5 sessions, they are used for internal purposes.
If you are using StatelessConnectionPool, it pools the physical connections+sessions. That means if the pool max is 5, there will be a maximum of 5 real physical connections and 5 user sessions. The threads will have to get/put connections from/into this pool.
Re: OCCI connectionpool doesn't work well [message #138438 ]
Thu, 22 September 2005 00:56
Messages: 2 Registered: September 2005
Junior Member
Do the connection pool improve the performace?
The StatelessConnectionPool can work, but its performance is bad. The program can do 300 operations per second when using connectionpool. But when using stateless the program can only do about 30 operations per second. If I connected the database without any connection pool, the program can handle almost 1000 operations per second.
How can I improve the performance in a multi-thread program?
Re: OCCI connectionpool doesn't work well [message #138729 ]
Fri, 23 September 2005 04:48
Messages: 28 Registered: July 2005
Junior Member
What is your concurrency? When you don't use any pools and achieve 1000 operations per second, you may be having every thread having its own connection. What is the maximum number of threads? If you configure the pool max to be same as the max number of threads, you will achieve the same speed. The idea of pooling resources is to optimally use them. Please configure the pool max to the maximum concurrency of your database operations.i.e, how many threads do you want to be doing database operations at the same time. For connection pools, you have a session for every thread, but you pick a physical connection from the pool. For Stateless connection pools, you pick the session+connection from the pool. It should be used for short spanning database operations (like one execute+fetch) and not for long running transactions. Tune the pool's min/max parameters for achieving better concurrency.