Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2318208
  • 博文数量: 473
  • 博客积分: 12252
  • 博客等级: 上将
  • 技术积分: 4307
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-12 10:02
文章分类

全部博文(473)

文章存档

2012年(8)

2011年(63)

2010年(73)

2009年(231)

2008年(98)

分类: Oracle

2009-09-30 15:43:07

- icon9.gif  OCCI connectionpool doesn't work well [message #137713] Fri, 16 September 2005 04:23 Go to next message

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 Go to previous messageGo to next message

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.
- icon5.gif  Re: OCCI connectionpool doesn't work well [message #138438 ] Thu, 22 September 2005 00:56 Go to previous messageGo to next message

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 Go to previous message

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.
阅读(1791) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~