Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection was obtained from the connection pool wait time is very long #50

Closed
ljx0305 opened this issue Jun 11, 2016 · 2 comments
Closed
Assignees
Labels

Comments

@ljx0305
Copy link

ljx0305 commented Jun 11, 2016

From the connection pool for a link to wait a long time when, but into a single link to connection speed is quite fast

my test platform
window 10, qt 4.6.2 ,

test code:
int main()
{
char strTNS[] = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)))";
Environment::Initialize(Environment::Default | Environment::Threaded);
Environment::EnableWarnings(true);
Pool connPool;
Connection conn;
cout << "Oracle Connection Start Time: "<< time(NULL)<< std::endl;
conn.Open(strTNS,"test","test");
cout << "Oracle Connection Start Time: "<< time(NULL)<< std::endl;
conn.Close();
connPool.OpenOpen(strTNS,"test","test",Pool::ConnectionPool,1,5);
cout << "Oracle Pool Get Connection Start Time: "<< time(NULL)<< std::endl;
Connection poolConn = connPool.GetConnection();
cout << "Oracle Pool Get Connection End Time: "<< time(NULL)<< std::endl;
poolConn.Close;

 Environment::Cleanup();

 return 0;

}

output result:
Oracle Connection Start Time: 1465606583
Oracle Connection End Time:1465606583
Oracle Pool Get Connection Start Time: 1465606583
Oracle Pool Get Connection End Time: 1465606592

@vrogier
Copy link
Owner

vrogier commented Jun 23, 2016

Hi,

If it takes more times from the pool, it must be an Oracle client related topic.
There is no reason why OCILIB shall take more time. Same internal code.
Do subsequent connection retrieval take same time or is it only the first time ?
If it is only the first connection retrieval that is longer it may be normal as Oracle Client has more work to do for creating and allocating pool resources as the job is done the first time a connection is retrieved.

Regards,

Vincent

@vrogier
Copy link
Owner

vrogier commented Jul 2, 2016

Only connections retrieved from pools on Oracle Client 11g and above may present this issue.
Same code with 10g and bellow is working ok but slower with 11g/12C for connection pools (at least on Windows, using default tnsnames.ora)
Sessions pools do not present the issue whatever the Oracle version.
May be something to report to Oracle support...

Regards,

Vincent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants